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 +#include +#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