tag_handler: handle arbitrary name/value pairs

The new method pair() receives an arbitrary name/value pair.  Support
for this is being added to a few decoder plugins.
This commit is contained in:
Max Kellermann
2012-02-11 19:24:51 +01:00
parent 1783aac438
commit ffea273a28
9 changed files with 114 additions and 9 deletions
+20
View File
@@ -50,6 +50,21 @@ ffmpeg_copy_metadata(enum tag_type type,
type, mt->value);
}
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,5,0)
static void
ffmpeg_scan_pairs(AVDictionary *dict,
const struct tag_handler *handler, void *handler_ctx)
{
AVDictionaryEntry *i = NULL;
while ((i = av_dict_get(dict, "", i, AV_DICT_IGNORE_SUFFIX)) != NULL)
tag_handler_invoke_pair(handler, handler_ctx,
i->key, i->value);
}
#endif
void
ffmpeg_scan_dictionary(AVDictionary *dict,
const struct tag_handler *handler, void *handler_ctx)
@@ -62,4 +77,9 @@ ffmpeg_scan_dictionary(AVDictionary *dict,
i->name != NULL; ++i)
ffmpeg_copy_metadata(i->type, dict, i->name,
handler, handler_ctx);
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,5,0)
if (handler->pair != NULL)
ffmpeg_scan_pairs(dict, handler, handler_ctx);
#endif
}