summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Timothy Redaelli <timothy.redaelli@gmail.com>2014-02-05 15:53:25 +0100
committerGravatar Alexey Yakovenko <waker@users.sf.net>2014-02-05 16:19:46 +0100
commit126e29459c4df3412a2fbcf52f210743abdb576e (patch)
tree5de72169e8d71bb034336331495e6cb46ef13c96
parent1be8124fc35a6b4ffd14bfc6008aee8a29a6e9f3 (diff)
ffmpeg: try to read metadata from streams too
-rw-r--r--plugins/ffmpeg/ffmpeg.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 9515465d..efedb7bd 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -556,16 +556,34 @@ ffmpeg_read_metadata_internal (DB_playItem_t *it, AVFormatContext *fctx) {
// ffmpeg-0.11 new metadata format
AVDictionary *md = fctx->metadata;
AVDictionaryEntry *t = NULL;
- while (t = av_dict_get (md, "", t, AV_DICT_IGNORE_SUFFIX)) {
- int m;
- for (m = 0; map[m]; m += 2) {
- if (!strcasecmp (t->key, map[m])) {
- deadbeef->pl_append_meta (it, map[m+1], t->value);
- break;
+ int m;
+ if (md) {
+ 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);
}
}
- if (!map[m]) {
- deadbeef->pl_append_meta (it, t->key, t->value);
+ }
+ 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