diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-02 13:45:23 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-02 13:45:23 +0100 |
commit | 044a715c61f1b78cb569fd7711d794296b61b994 (patch) | |
tree | 64545d805efabd45c3d23e00d9729e20310f43db /plugins/vorbis | |
parent | 40d3a5c66105914c1113bc7ef0649e13b3db690f (diff) |
changed cuesheet loading APIs, embedded metadata now adds up with cuesheet metadata
Diffstat (limited to 'plugins/vorbis')
-rw-r--r-- | plugins/vorbis/vorbis.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 1006929f..f203f6bb 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -101,6 +101,9 @@ update_vorbis_comments (DB_playItem_t *it, vorbis_comment *vc) { else if (!strncasecmp (vc->user_comments[i], "copyright=", 10)) { deadbeef->pl_add_meta (it, "copyright", vc->user_comments[i] + 10); } + else if (!strncasecmp (vc->user_comments[i], "cuesheet=", 9)) { + deadbeef->pl_add_meta (it, "cuesheet", vc->user_comments[i] + 9); + } else if (!strncasecmp (vc->user_comments[i], "replaygain_album_gain=", 22)) { it->replaygain_album_gain = atof (vc->user_comments[i] + 22); } @@ -363,11 +366,6 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { } float duration = ov_time_total (&vorbis_file, -1); int totalsamples = ov_pcm_total (&vorbis_file, -1); - DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, fname, &plugin, "OggVorbis", totalsamples, vi->rate); - if (cue_after) { - ov_clear (&vorbis_file); - return cue_after; - } DB_playItem_t *it = deadbeef->pl_item_alloc (); it->decoder = &plugin; @@ -378,7 +376,25 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { // metainfo vorbis_comment *vc = ov_comment (&vorbis_file, -1); update_vorbis_comments (it, vc); + int samplerate = vi->rate; ov_clear (&vorbis_file); + + DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); + if (cue) { + deadbeef->pl_item_free (it); + return cue; + } + + // embedded cue + const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); + if (cuesheet) { + cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); + if (cue) { + deadbeef->pl_item_free (it); + return cue; + } + } + after = deadbeef->pl_insert_item (after, it); return after; } |