summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/aac/aac.c62
-rw-r--r--plugins/libmp4ff/mp4atom.c2
-rw-r--r--plugins/libmp4ff/mp4ffint.h1
3 files changed, 41 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;
diff --git a/plugins/libmp4ff/mp4atom.c b/plugins/libmp4ff/mp4atom.c
index c735c2ae..823fa056 100644
--- a/plugins/libmp4ff/mp4atom.c
+++ b/plugins/libmp4ff/mp4atom.c
@@ -224,6 +224,8 @@ static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b,
return ATOM_DESCRIPTION;
else if (mp4ff_atom_compare(a,b,c,d, 'p','c','s','t'))
return ATOM_PODCAST;
+ else if (mp4ff_atom_compare(a,b,c,d, '-','-','-','-'))
+ return ATOM_CUSTOM;
else
return ATOM_UNKNOWN;
}
diff --git a/plugins/libmp4ff/mp4ffint.h b/plugins/libmp4ff/mp4ffint.h
index f4673b03..ec0b51bb 100644
--- a/plugins/libmp4ff/mp4ffint.h
+++ b/plugins/libmp4ff/mp4ffint.h
@@ -93,6 +93,7 @@ extern "C" {
#define ATOM_SEASON 170
#define ATOM_EPISODE 171
#define ATOM_PODCAST 172
+#define ATOM_CUSTOM 173
#define ATOM_UNKNOWN 255
#define ATOM_FREE ATOM_UNKNOWN