diff options
author | waker <wakeroid@gmail.com> | 2012-08-03 21:24:40 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-08-03 21:24:40 +0200 |
commit | 7a790cacc66ce2c48f98b867edc166626a89471f (patch) | |
tree | 036f6af515cb19484370f3b26dc90fcebae9d264 | |
parent | cdbcd7a738c98ee145ed148073a3948e1a79e2db (diff) |
alac: metadata fixes
-rw-r--r-- | plugins/alac/alac_plugin.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/alac/alac_plugin.c b/plugins/alac/alac_plugin.c index d1075a07..ba1e895b 100644 --- a/plugins/alac/alac_plugin.c +++ b/plugins/alac/alac_plugin.c @@ -368,28 +368,39 @@ int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value void alacplug_load_tags (DB_playItem_t *it, mp4ff_t *mp4) { char *s = NULL; + int got_itunes_tags = 0; for (int i = 0; metainfo[i]; i += 2) { if (mp4ff_meta_find_by_name(mp4, metainfo[i], &s)) { deadbeef->pl_add_meta (it, metainfo[i+1], s); + got_itunes_tags = 1; free (s); } } if (mp4ff_meta_find_by_name(mp4, "replaygain_track_gain", &s)) { deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKGAIN, atof (s)); + got_itunes_tags = 1; free (s); } if (mp4ff_meta_find_by_name(mp4, "replaygain_track_peak", &s)) { deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (s)); + got_itunes_tags = 1; free (s); } if (mp4ff_meta_find_by_name(mp4, "replaygain_album_gain", &s)) { deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMGAIN, atof (s)); + got_itunes_tags = 1; free (s); } if (mp4ff_meta_find_by_name(mp4, "replaygain_album_peak", &s)) { deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMPEAK, atof (s)); + got_itunes_tags = 1; free (s); } + if (got_itunes_tags) { + uint32_t f = deadbeef->pl_get_item_flags (it); + f |= DDB_TAG_ITUNES; + deadbeef->pl_set_item_flags (it, f); + } } int @@ -431,12 +442,10 @@ alacplug_read_metadata (DB_playItem_t *it) { if (mp4) { alacplug_load_tags (it, mp4); mp4ff_close (mp4); - deadbeef->pl_add_meta (it, "title", NULL); } /*int apeerr = */deadbeef->junk_apev2_read (it, fp); /*int v2err = */deadbeef->junk_id3v2_read (it, fp); /*int v1err = */deadbeef->junk_id3v1_read (it, fp); - deadbeef->pl_add_meta (it, "title", NULL); deadbeef->fclose (fp); return 0; } @@ -525,7 +534,8 @@ alacplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { char s[100]; snprintf (s, sizeof (s), "%lld", fsize); deadbeef->pl_add_meta (it, ":FILE_SIZE", s); - deadbeef->pl_add_meta (it, ":BPS", "16"); + snprintf (s, sizeof (s), "%d", demux_res.sample_size); + deadbeef->pl_add_meta (it, ":BPS", s); snprintf (s, sizeof (s), "%d", demux_res.num_channels); deadbeef->pl_add_meta (it, ":CHANNELS", s); snprintf (s, sizeof (s), "%d", demux_res.sample_rate); @@ -557,8 +567,6 @@ alacplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { } } - deadbeef->pl_add_meta (it, "title", NULL); - success: after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); |