Commit 923c402f authored by Max Kellermann's avatar Max Kellermann

decoder/ffmpeg: optimize ffmpeg_scan_dictionary()

Don't scan tag items if the handler doesn't implement the tag() method.
parent 4fed0b99
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment