summaryrefslogtreecommitdiffstats
path: root/common/av_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-30 01:15:42 +0200
committerwm4 <wm4@nowhere>2014-07-30 01:15:42 +0200
commit26d973ce827555619405bf62db24bf4ae12a4a90 (patch)
tree1b5f97301adca8ac102d6b530ebbc04d604dd47b /common/av_common.c
parentda780309d707ac995941c14d1f5bbc8f1a7239b8 (diff)
downloadmpv-26d973ce827555619405bf62db24bf4ae12a4a90.tar.bz2
mpv-26d973ce827555619405bf62db24bf4ae12a4a90.tar.xz
stream_lavf: allow setting AVOptions with --stream-lavf-o
This commit also creates a private option struct for stream_lavf.c, but since I'm lazy, I'm not moving any existing options to it.
Diffstat (limited to 'common/av_common.c')
-rw-r--r--common/av_common.c9
1 files changed, 9 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);
+}