From 4da80edc3fa5bbaf7d5eb74eef0e918e5a3dd5cb Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Mon, 22 Mar 2010 18:22:39 +0100 Subject: [PATCH] Pick up metadata from the selected stream(s) in addition to the file itself OGG has per-stream metadata; recent versions of ffmpeg report metadata per-stream in this case. --- src/filescanner_ffmpeg.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/filescanner_ffmpeg.c b/src/filescanner_ffmpeg.c index 4c845946..fb90e1c5 100644 --- a/src/filescanner_ffmpeg.c +++ b/src/filescanner_ffmpeg.c @@ -402,14 +402,40 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi) mdcount = 0; - if (ctx->metadata == NULL) + if ((!ctx->metadata) && (!ctx->streams[audio_stream]->metadata) + && ((video_stream != -1) && (!ctx->streams[video_stream]->metadata))) { DPRINTF(E_WARN, L_SCAN, "ffmpeg reports no metadata\n"); goto skip_extract; } - mdcount += extract_metadata(mfi, ctx->metadata); + if (ctx->metadata) + { + ret = extract_metadata(mfi, ctx->metadata); + + DPRINTF(E_DBG, L_SCAN, "Picked up %d tags from file metadata\n", ret); + + mdcount += ret; + } + + if (ctx->streams[audio_stream]->metadata) + { + ret = extract_metadata(mfi, ctx->streams[audio_stream]->metadata); + + DPRINTF(E_DBG, L_SCAN, "Picked up %d tags from audio stream metadata\n", ret); + + mdcount += ret; + } + + if ((video_stream != -1) && (ctx->streams[video_stream]->metadata)) + { + ret = extract_metadata(mfi, ctx->streams[video_stream]->metadata); + + DPRINTF(E_DBG, L_SCAN, "Picked up %d tags from video stream metadata\n", ret); + + mdcount += ret; + } /* fix up TV metadata */ if (mfi->media_kind == 10)