From ffea273a28179d2b5bbc24f967517bcf80940c63 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 11 Feb 2012 19:24:51 +0100 Subject: 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. --- src/decoder/ffmpeg_metadata.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/decoder/ffmpeg_metadata.c') diff --git a/src/decoder/ffmpeg_metadata.c b/src/decoder/ffmpeg_metadata.c index 5325c1cae..df700fc01 100644 --- a/src/decoder/ffmpeg_metadata.c +++ b/src/decoder/ffmpeg_metadata.c @@ -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 } -- cgit v1.2.3