summaryrefslogtreecommitdiff
path: root/plugins/aac
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-08-21 21:18:59 +0200
committerGravatar waker <wakeroid@gmail.com>2012-08-21 21:18:59 +0200
commit6955b64286f7b96cf8a9f99c62607ec81bd323c9 (patch)
treeecb9faaecb354da9833e04f12762290519945ed2 /plugins/aac
parent4782c9fa4d956870914bb5128adcd53c198e2362 (diff)
added support for the "----" atom type to libmp4ff; added custom fields support to aac metadata, including replaygain
Diffstat (limited to 'plugins/aac')
-rw-r--r--plugins/aac/aac.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index c6b8d5ad..60b0fb2e 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -1084,33 +1084,47 @@ void
aac_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);
+
+ int n = mp4ff_meta_get_num_items (mp4);
+ for (int t = 0; t < n; t++) {
+ char *key = NULL;
+ char *value = NULL;
+ int res = mp4ff_meta_get_by_index(mp4, t, &key, &value);
+ if (key && value) {
got_itunes_tags = 1;
- free (s);
+ if (!strcasecmp (key, "replaygain_track_gain")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKGAIN, atof (value));
+ }
+ else if (!strcasecmp (key, "replaygain_album_gain")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMGAIN, atof (value));
+ }
+ else if (!strcasecmp (key, "replaygain_track_peak")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (value));
+ }
+ else if (!strcasecmp (key, "replaygain_album_peak")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMPEAK, atof (value));
+ }
+ else {
+ int i;
+ for (i = 0; metainfo[i]; i += 2) {
+ if (!strcasecmp (metainfo[i], key)) {
+ deadbeef->pl_add_meta (it, metainfo[i+1], value);
+ break;
+ }
+ }
+ if (!metainfo[i]) {
+ deadbeef->pl_add_meta (it, key, value);
+ }
+ }
+ }
+ if (key) {
+ free (key);
+ }
+ if (value) {
+ free (value);
}
}
- 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;