diff options
author | Max Kellermann <max@duempel.org> | 2014-12-11 10:08:08 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-11 10:08:08 +0100 |
commit | ee4b7042cea781305283d0d8a19fb62eea1e0fc3 (patch) | |
tree | 97d36a592a75fc6a98450355afd9646b061154e9 | |
parent | 310ab7d41bb9f338489ba97d4e57f0e1f4f89ef0 (diff) | |
download | mpd-ee4b7042cea781305283d0d8a19fb62eea1e0fc3.tar.gz mpd-ee4b7042cea781305283d0d8a19fb62eea1e0fc3.tar.xz mpd-ee4b7042cea781305283d0d8a19fb62eea1e0fc3.zip |
decoder/ffpmeg: move code to FfmpegScanMetadata()
-rw-r--r-- | src/decoder/plugins/FfmpegDecoderPlugin.cxx | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 9010b7402..67c585b34 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -492,6 +492,23 @@ FfmpegParseMetaData(Decoder &decoder, } static void +FfmpegScanMetadata(const AVStream &stream, + const tag_handler &handler, void *handler_ctx) +{ + FfmpegScanDictionary(stream.metadata, &handler, handler_ctx); +} + +static void +FfmpegScanMetadata(const AVFormatContext &format_context, int audio_stream, + const tag_handler &handler, void *handler_ctx) +{ + FfmpegScanDictionary(format_context.metadata, &handler, handler_ctx); + if (audio_stream >= 0) + FfmpegScanMetadata(*format_context.streams[audio_stream], + handler, handler_ctx); +} + +static void ffmpeg_decode(Decoder &decoder, InputStream &input) { AVInputFormat *input_format = ffmpeg_probe(&decoder, input); @@ -690,11 +707,8 @@ ffmpeg_scan_stream(InputStream &is, tag_handler_invoke_duration(handler, handler_ctx, duration); } - FfmpegScanDictionary(f->metadata, handler, handler_ctx); int idx = ffmpeg_find_audio_stream(f); - if (idx >= 0) - FfmpegScanDictionary(f->streams[idx]->metadata, - handler, handler_ctx); + FfmpegScanMetadata(*f, idx, *handler, handler_ctx); avformat_close_input(&f); return true; |