decoder/ffmpeg: optimize ffmpeg_scan_dictionary()
Don't scan tag items if the handler doesn't implement the tag() method.
This commit is contained in:
parent
4fed0b991c
commit
923c402f69
|
@ -62,14 +62,16 @@ void
|
||||||
ffmpeg_scan_dictionary(AVDictionary *dict,
|
ffmpeg_scan_dictionary(AVDictionary *dict,
|
||||||
const struct tag_handler *handler, void *handler_ctx)
|
const struct tag_handler *handler, void *handler_ctx)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
|
if (handler->tag != nullptr) {
|
||||||
ffmpeg_copy_metadata(TagType(i), dict, tag_item_names[i],
|
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
|
||||||
handler, handler_ctx);
|
ffmpeg_copy_metadata(TagType(i), dict, tag_item_names[i],
|
||||||
|
handler, handler_ctx);
|
||||||
|
|
||||||
for (const struct tag_table *i = ffmpeg_tags;
|
for (const struct tag_table *i = ffmpeg_tags;
|
||||||
i->name != nullptr; ++i)
|
i->name != nullptr; ++i)
|
||||||
ffmpeg_copy_metadata(i->type, dict, i->name,
|
ffmpeg_copy_metadata(i->type, dict, i->name,
|
||||||
handler, handler_ctx);
|
handler, handler_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
if (handler->pair != nullptr)
|
if (handler->pair != nullptr)
|
||||||
ffmpeg_scan_pairs(dict, handler, handler_ctx);
|
ffmpeg_scan_pairs(dict, handler, handler_ctx);
|
||||||
|
|
Loading…
Reference in New Issue