summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-08 13:03:01 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-08 13:03:01 +0200
commitdc028e1a6ac839b2d524b459ebc9b677aa5c8397 (patch)
tree4ef14a4e4bbd9c5260e24e6bac8ad7ea0f67ea49 /plugins
parentebc2929f0001ebe6563b4af6ab64ef217498c121 (diff)
ffmpeg: fixed reading replaygain info
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ffmpeg/ffmpeg.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index aaf05464..34116437 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -553,11 +553,31 @@ ffmpeg_read_metadata_internal (DB_playItem_t *it, AVFormatContext *fctx) {
}
#else
// ffmpeg-0.11 new metadata format
- AVDictionary *md = fctx->metadata;
AVDictionaryEntry *t = NULL;
int m;
- if (md) {
+ for (int i = 0; i < fctx->nb_streams + 1; i++) {
+ AVDictionary *md = i == 0 ? fctx->metadata : fctx->streams[i-1]->metadata;
+ if (!md) {
+ continue;
+ }
while (t = av_dict_get (md, "", t, AV_DICT_IGNORE_SUFFIX)) {
+ if (!strcasecmp (t->key, "replaygain_album_gain")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMGAIN, atof (t->value));
+ continue;
+ }
+ else if (!strcasecmp (t->key, "replaygain_album_peak")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMPEAK, atof (t->value));
+ continue;
+ }
+ else if (!strcasecmp (t->key, "replaygain_track_gain")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKGAIN, atof (t->value));
+ continue;
+ }
+ else if (!strcasecmp (t->key, "replaygain_track_peak")) {
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (t->value));
+ continue;
+ }
+
for (m = 0; map[m]; m += 2) {
if (!strcasecmp (t->key, map[m])) {
deadbeef->pl_append_meta (it, map[m+1], t->value);
@@ -569,22 +589,6 @@ ffmpeg_read_metadata_internal (DB_playItem_t *it, AVFormatContext *fctx) {
}
}
}
- else {
- for (int i = 0; i < fctx->nb_streams; i++) {
- md = fctx->streams[i]->metadata;
- while (t = av_dict_get (md, "", t, AV_DICT_IGNORE_SUFFIX)) {
- for (m = 0; map[m]; m += 2) {
- if (!strcasecmp (t->key, map[m])) {
- deadbeef->pl_append_meta (it, map[m+1], t->value);
- break;
- }
- }
- if (!map[m]) {
- deadbeef->pl_append_meta (it, t->key, t->value);
- }
- }
- }
- }
#endif
#endif
return 0;