summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-10 18:54:10 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-10 18:54:10 +0000
commit57a3542801f005eac35ea671d3c6356380323dc1 (patch)
tree1e702121ab7a926ba2718b3f2d39cb5dd204e387
parent13b723459b577f9b1977a84ffa82344505a59b6f (diff)
downloadmpv-57a3542801f005eac35ea671d3c6356380323dc1.tar.bz2
mpv-57a3542801f005eac35ea671d3c6356380323dc1.tar.xz
AVOptions support.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26723 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--Makefile3
-rw-r--r--av_opts.c27
-rw-r--r--av_opts.h5
3 files changed, 34 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5184664aa9..fd2c48ecef 100644
--- a/Makefile
+++ b/Makefile
@@ -261,7 +261,8 @@ SRCS_COMMON-$(LIBASS) += libass/ass.c \
libass/ass_utils.c \
libmpcodecs/vf_ass.c \
-SRCS_COMMON-$(LIBAVCODEC) += libaf/af_lavcresample.c \
+SRCS_COMMON-$(LIBAVCODEC) += av_opts.c \
+ libaf/af_lavcresample.c \
libmpcodecs/ad_ffmpeg.c \
libmpcodecs/vd_ffmpeg.c \
libmpcodecs/vf_lavc.c \
diff --git a/av_opts.c b/av_opts.c
new file mode 100644
index 0000000000..170bd075e8
--- /dev/null
+++ b/av_opts.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <string.h>
+#include "libavcodec/opt.h"
+
+int parse_avopts(void *v, char *str){
+ char *start;
+ start= str= strdup(str);
+
+ while(str && *str){
+ char *next_opt, *arg;
+
+ next_opt= strchr(str, ',');
+ if(next_opt) *next_opt++= 0;
+
+ arg = strchr(str, '=');
+ if(arg) *arg++= 0;
+
+ if(!av_set_string(v, str, arg)){
+ free(start);
+ return -1;
+ }
+ str= next_opt;
+ }
+
+ free(start);
+ return 0;
+} \ No newline at end of file
diff --git a/av_opts.h b/av_opts.h
new file mode 100644
index 0000000000..3fed5912b4
--- /dev/null
+++ b/av_opts.h
@@ -0,0 +1,5 @@
+
+/**
+ * Parses str and sets AVOptions in v accordingly.
+ */
+int parse_avopts(void *v, char *str); \ No newline at end of file