changeset 26691:e456af9908f8

AVOptions support.
author michael
date Sat, 10 May 2008 18:54:10 +0000
parents 8aaa8fadc36c
children 0e325c1957f1
files Makefile av_opts.c av_opts.h
diffstat 3 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat May 10 17:19:18 2008 +0000
+++ b/Makefile	Sat May 10 18:54:10 2008 +0000
@@ -261,7 +261,8 @@
                                         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 \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/av_opts.c	Sat May 10 18:54:10 2008 +0000
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/av_opts.h	Sat May 10 18:54:10 2008 +0000
@@ -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