From 85663ef3020fe95f65c96de73201adac909cd07c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 28 Sep 2008 19:35:22 +0000 Subject: Move opt_default() and set_context_opts() to cmdutils so it can be used from the other tools as well. Originally committed as revision 15450 to svn://svn.ffmpeg.org/ffmpeg/trunk --- cmdutils.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'cmdutils.c') diff --git a/cmdutils.c b/cmdutils.c index 505f55b282..8a01a0a37a 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -31,6 +31,7 @@ #include "libswscale/swscale.h" #include "libpostproc/postprocess.h" #include "libavutil/avstring.h" +#include "libavcodec/opt.h" #include "cmdutils.h" #include "version.h" #ifdef CONFIG_NETWORK @@ -39,6 +40,11 @@ #undef exit +const char **opt_names; +static int opt_name_count; +AVCodecContext *avctx_opts[CODEC_TYPE_NB]; +AVFormatContext *avformat_opts; +struct SwsContext *sws_opts; double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max) { @@ -160,6 +166,55 @@ unknown_opt: } } +int opt_default(const char *opt, const char *arg){ + int type; + const AVOption *o= NULL; + int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0}; + + for(type=0; typename; + + if(avctx_opts[0]->debug || avformat_opts->debug) + av_log_set_level(AV_LOG_DEBUG); + return 0; +} + +void set_context_opts(void *ctx, void *opts_ctx, int flags) +{ + int i; + for(i=0; iflags & flags) == flags)) + av_set_string2(ctx, opt_names[i], str, 1); + } +} + void print_error(const char *filename, int err) { switch(err) { -- cgit v1.2.3