diff options
author | Max Kellermann <max@duempel.org> | 2014-12-10 09:35:28 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-10 09:35:28 +0100 |
commit | bcd97f5887b1f5b2eca9132d34c8d64913b8236b (patch) | |
tree | 4bc1b4c71df390e4809f27fc04caf58c4ecbf36a /src/decoder | |
parent | 0faf86c2b95bca16b3777f4e5775fb2c7e98cb88 (diff) | |
download | mpd-bcd97f5887b1f5b2eca9132d34c8d64913b8236b.tar.gz mpd-bcd97f5887b1f5b2eca9132d34c8d64913b8236b.tar.xz mpd-bcd97f5887b1f5b2eca9132d34c8d64913b8236b.zip |
decoder/ffmpeg: optimize ffmpeg_scan_dictionary()
Don't scan tag items if the handler doesn't implement the tag()
method.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/FfmpegMetaData.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/decoder/plugins/FfmpegMetaData.cxx b/src/decoder/plugins/FfmpegMetaData.cxx index c0d73c259..b2b8ff76c 100644 --- a/src/decoder/plugins/FfmpegMetaData.cxx +++ b/src/decoder/plugins/FfmpegMetaData.cxx @@ -62,14 +62,16 @@ void ffmpeg_scan_dictionary(AVDictionary *dict, const struct tag_handler *handler, void *handler_ctx) { - for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) - ffmpeg_copy_metadata(TagType(i), dict, tag_item_names[i], - handler, handler_ctx); + if (handler->tag != nullptr) { + for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) + ffmpeg_copy_metadata(TagType(i), dict, tag_item_names[i], + handler, handler_ctx); - for (const struct tag_table *i = ffmpeg_tags; - i->name != nullptr; ++i) - ffmpeg_copy_metadata(i->type, dict, i->name, - handler, handler_ctx); + for (const struct tag_table *i = ffmpeg_tags; + i->name != nullptr; ++i) + ffmpeg_copy_metadata(i->type, dict, i->name, + handler, handler_ctx); + } if (handler->pair != nullptr) ffmpeg_scan_pairs(dict, handler, handler_ctx); |