diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/av_common.c | 9 | ||||
-rw-r--r-- | common/av_common.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/common/av_common.c b/common/av_common.c index d8d5c7e09d..d090ccfc50 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -19,6 +19,7 @@ #include <libavutil/common.h> #include <libavutil/log.h> +#include <libavutil/dict.h> #include <libavcodec/avcodec.h> #include "common/common.h" @@ -180,3 +181,11 @@ const char *mp_codec_from_av_codec_id(int codec_id) } return name; } + +// kv is in the format as by OPT_KEYVALUELIST(): kv[0]=key0, kv[1]=val0, ... +// Copy them to the dict. +void mp_set_avdict(AVDictionary **dict, char **kv) +{ + for (int n = 0; kv && kv[n * 2]; n++) + av_dict_set(dict, kv[n * 2 + 0], kv[n * 2 + 1], 0); +} diff --git a/common/av_common.h b/common/av_common.h index 2e55fe17a0..4afebe6662 100644 --- a/common/av_common.h +++ b/common/av_common.h @@ -26,6 +26,7 @@ struct mp_decoder_list; struct demux_packet; +struct AVDictionary; int mp_lavc_set_extradata(AVCodecContext *avctx, void *ptr, int size); void mp_copy_lav_codec_headers(AVCodecContext *avctx, AVCodecContext *st); @@ -36,5 +37,6 @@ void mp_set_avcodec_threads(AVCodecContext *avctx, int threads); void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type); int mp_codec_to_av_codec_id(const char *codec); const char *mp_codec_from_av_codec_id(int codec_id); +void mp_set_avdict(struct AVDictionary **dict, char **kv); #endif |