From c48da33c6325393125ad3fb0f116a43399202120 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 22 Apr 2008 20:17:30 +0000 Subject: [PATCH] Send context to some ffmpeg.c opt* function Patch by Stefano Sabatini ( stefano sabatini-lala poste it ) Originally committed as revision 12927 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 5b499b3146..0cc339c209 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2224,15 +2224,17 @@ static void opt_video_rc_override_string(const char *arg) video_rc_override_string = arg; } -static void opt_me_threshold(const char *arg) +static int opt_me_threshold(const char *opt, const char *arg) { - me_threshold = parse_number_or_die("me_threshold", arg, OPT_INT64, INT_MIN, INT_MAX); + me_threshold = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); + return 0; } -static void opt_verbose(const char *arg) +static int opt_verbose(const char *opt, const char *arg) { - verbose = parse_number_or_die("v", arg, OPT_INT64, AV_LOG_QUIET, AV_LOG_DEBUG); + verbose = parse_number_or_die(opt, arg, OPT_INT64, AV_LOG_QUIET, AV_LOG_DEBUG); av_log_set_level(verbose); + return 0; } static void opt_frame_rate(const char *arg) @@ -2508,14 +2510,16 @@ static void opt_thread_count(const char *arg) #endif } -static void opt_audio_rate(const char *arg) +static int opt_audio_rate(const char *opt, const char *arg) { - audio_sample_rate = parse_number_or_die("ar", arg, OPT_INT64, 0, INT_MAX); + audio_sample_rate = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); + return 0; } -static void opt_audio_channels(const char *arg) +static int opt_audio_channels(const char *opt, const char *arg) { - audio_channels = parse_number_or_die("ac", arg, OPT_INT64, 0, INT_MAX); + audio_channels = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); + return 0; } static void opt_video_channel(const char *arg) @@ -3799,7 +3803,7 @@ const OptionDef options[] = { { "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" }, { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" }, { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" }, - { "v", HAS_ARG, {(void*)opt_verbose}, "set the logging verbosity level", "number" }, + { "v", HAS_ARG | OPT_FUNC2, {(void*)opt_verbose}, "set the logging verbosity level", "number" }, { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" }, { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" }, @@ -3836,7 +3840,7 @@ const OptionDef options[] = { { "qdiff", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qdiff}, "max difference between the quantizer scale (VBR)", "q" }, { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" }, { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" }, - { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "threshold" }, + { "me_threshold", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "threshold" }, { "strict", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_strict}, "how strictly to follow the standards", "strictness" }, { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality}, "use same video quality as source (implies VBR)" }, @@ -3862,8 +3866,8 @@ const OptionDef options[] = { { "ab", OPT_FUNC2 | HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" }, { "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[CODEC_TYPE_AUDIO]}, "set the number of audio frames to record", "number" }, { "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", }, - { "ar", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" }, - { "ac", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" }, + { "ar", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" }, + { "ac", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" }, { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" }, { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" }, { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" },