diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-04-17 22:23:46 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-04-17 22:23:46 +0200 |
commit | f7b69992c780be685f014808118a94aef3d87fed (patch) | |
tree | 9943c9ad1475f0042c3a5ef9497177f34879fc49 /plugins | |
parent | f29d6657ba7d4d08967fb369bae2e1b3c033bb53 (diff) |
added flags to each track in playlist, which bumped dbpl version to 1.2;
list of file tags is no longer written as metadata string, but as flags;
fixed couple of memory leaks;
blocked metadata editing in subtracks;
blocked metadata editing if playlist file format is less than 1.2;
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ffap/ffap.c | 15 | ||||
-rw-r--r-- | plugins/ffmpeg/ffmpeg.c | 1 | ||||
-rw-r--r-- | plugins/flac/flac.c | 13 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 1 | ||||
-rw-r--r-- | plugins/gtkui/trkproperties.c | 4 | ||||
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 5 | ||||
-rw-r--r-- | plugins/sndfile/sndfile.c | 2 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 7 | ||||
-rw-r--r-- | plugins/wavpack/wavpack.c | 3 |
9 files changed, 41 insertions, 10 deletions
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c index db3a505d..60ba9b18 100644 --- a/plugins/ffap/ffap.c +++ b/plugins/ffap/ffap.c @@ -1729,25 +1729,28 @@ ffap_insert (DB_playItem_t *after, const char *fname) { deadbeef->fclose (fp); ape_free_ctx (&ape_ctx); - DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, ape_ctx.totalsamples, ape_ctx.samplerate); - if (cue) { - deadbeef->pl_item_unref (it); - return cue; - } - // embedded cue deadbeef->pl_lock (); const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); + DB_playItem_t *cue = NULL; if (cuesheet) { cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), ape_ctx.totalsamples, ape_ctx.samplerate); if (cue) { deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue); deadbeef->pl_unlock (); return cue; } } deadbeef->pl_unlock (); + cue = deadbeef->pl_insert_cue (after, it, ape_ctx.totalsamples, ape_ctx.samplerate); + if (cue) { + deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue); + return cue; + } + deadbeef->pl_add_meta (it, "title", NULL); after = deadbeef->pl_insert_item (after, it); deadbeef->pl_item_unref (it); diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c index e157fd45..3030e349 100644 --- a/plugins/ffmpeg/ffmpeg.c +++ b/plugins/ffmpeg/ffmpeg.c @@ -504,6 +504,7 @@ ffmpeg_insert (DB_playItem_t *after, const char *fname) { DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue); return cue; } // now the track is ready, insert into playlist diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 0de7c7c6..5edb9526 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -541,7 +541,10 @@ cflac_init_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__Str } } deadbeef->pl_add_meta (it, "title", NULL); - deadbeef->pl_add_meta (it, "tags", "VorbisComments"); + uint32_t f = deadbeef->pl_get_item_flags (it); + f &= ~DDB_TAG_MASK; + f |= DDB_TAG_VORBISCOMMENTS; + deadbeef->pl_set_item_flags (it, f); } } @@ -663,6 +666,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) { DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), info.totalsamples, info.info.samplerate); if (last) { deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (last); return last; } } @@ -673,6 +677,8 @@ cflac_insert (DB_playItem_t *after, const char *fname) { if (info.file) { deadbeef->fclose (info.file); } + deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue_after); trace ("flac: loaded external cuesheet\n"); return cue_after; } @@ -748,7 +754,10 @@ cflac_read_metadata (DB_playItem_t *it) { FLAC__metadata_iterator_delete (iter); err = 0; deadbeef->pl_add_meta (it, "title", NULL); - deadbeef->pl_add_meta (it, "tags", "VorbisComments"); + uint32_t f = deadbeef->pl_get_item_flags (it); + f &= ~DDB_TAG_MASK; + f |= DDB_TAG_VORBISCOMMENTS; + deadbeef->pl_set_item_flags (it, f); error: if (chain) { FLAC__metadata_chain_delete (chain); diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 483c797f..b46a4926 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -256,6 +256,7 @@ main_properties_activate (GtkMenuItem *menuitem, return; } show_track_properties_dlg (it); + deadbeef->pl_item_unref (it); } void diff --git a/plugins/gtkui/trkproperties.c b/plugins/gtkui/trkproperties.c index 29611262..6f5c9ef6 100644 --- a/plugins/gtkui/trkproperties.c +++ b/plugins/gtkui/trkproperties.c @@ -108,7 +108,9 @@ show_track_properties_dlg (DB_playItem_t *it) { int allow_editing = 0; - if (deadbeef->is_local_file (it->fname)) { + int is_subtrack = deadbeef->pl_get_item_flags (it) & DDB_IS_SUBTRACK; + + if (!is_subtrack && deadbeef->is_local_file (it->fname)) { // get decoder plugin by id DB_decoder_t *dec = NULL; if (it->decoder_id) { diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 9cd51c2d..2dc1a88d 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -1152,6 +1152,10 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { it->fname = strdup (fname); deadbeef->rewind (fp); + // reset tags + uint32_t f = deadbeef->pl_get_item_flags (it); + f &= ~DDB_TAG_MASK; + deadbeef->pl_set_item_flags (it, f); /*int apeerr = */deadbeef->junk_apev2_read (it, fp); /*int v2err = */deadbeef->junk_id3v2_read (it, fp); /*int v1err = */deadbeef->junk_id3v1_read (it, fp); @@ -1164,6 +1168,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, buffer.duration*buffer.samplerate, buffer.samplerate); if (cue_after) { deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue_after); return cue_after; } diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index 09469206..e9467788 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -235,6 +235,8 @@ sndfile_insert (DB_playItem_t *after, const char *fname) { DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); if (cue_after) { + deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue_after); return cue_after; } diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 6e589c2e..a5a873ab 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -125,7 +125,10 @@ update_vorbis_comments (DB_playItem_t *it, vorbis_comment *vc) { } } deadbeef->pl_add_meta (it, "title", NULL); - deadbeef->pl_add_meta (it, "tags", "VorbisComments"); + uint32_t f = deadbeef->pl_get_item_flags (it); + f &= ~DDB_TAG_MASK; + f |= DDB_TAG_VORBISCOMMENTS; + deadbeef->pl_set_item_flags (it, f); } static DB_fileinfo_t * @@ -405,6 +408,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue); return cue; } @@ -414,6 +418,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue); return cue; } } diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c index f3205570..f54f0603 100644 --- a/plugins/wavpack/wavpack.c +++ b/plugins/wavpack/wavpack.c @@ -293,6 +293,7 @@ wv_insert (DB_playItem_t *after, const char *fname) { deadbeef->fclose (fp); WavpackCloseFile (ctx); deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (last); return last; } } @@ -301,6 +302,8 @@ wv_insert (DB_playItem_t *after, const char *fname) { if (cue_after) { deadbeef->fclose (fp); WavpackCloseFile (ctx); + deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (cue_after); return cue_after; } |