You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	avtools: remove the distinction between func_arg and func2_arg.
func2_arg is the same as func_arg, except it has one additional parameter. Change all func_arg callbacks to take that parameter (and ignore it).
This commit is contained in:
		
							
								
								
									
										2
									
								
								avconv.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								avconv.c
									
									
									
									
									
								
							| @@ -2398,7 +2398,7 @@ static void parse_cpuflags(int argc, char **argv, const OptionDef *options) | ||||
| { | ||||
|     int idx = locate_option(argc, argv, options, "cpuflags"); | ||||
|     if (idx && argv[idx + 1]) | ||||
|         opt_cpuflags("cpuflags", argv[idx + 1]); | ||||
|         opt_cpuflags(NULL, "cpuflags", argv[idx + 1]); | ||||
| } | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
|   | ||||
							
								
								
									
										2
									
								
								avconv.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								avconv.h
									
									
									
									
									
								
							| @@ -352,7 +352,7 @@ extern const OptionDef options[]; | ||||
| void reset_options(OptionsContext *o); | ||||
| void show_usage(void); | ||||
|  | ||||
| int opt_cpuflags(const char *opt, const char *arg); | ||||
| int opt_cpuflags(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| void opt_output_file(void *optctx, const char *filename); | ||||
|  | ||||
|   | ||||
							
								
								
									
										104
									
								
								avconv_opt.c
									
									
									
									
									
								
							
							
						
						
									
										104
									
								
								avconv_opt.c
									
									
									
									
									
								
							| @@ -1555,19 +1555,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg) | ||||
|  | ||||
|         parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options); | ||||
|         parse_option(o, "r", frame_rates[norm], options); | ||||
|         opt_default("g", norm == PAL ? "15" : "18"); | ||||
|         opt_default(NULL, "g", norm == PAL ? "15" : "18"); | ||||
|  | ||||
|         opt_default("b", "1150000"); | ||||
|         opt_default("maxrate", "1150000"); | ||||
|         opt_default("minrate", "1150000"); | ||||
|         opt_default("bufsize", "327680"); // 40*1024*8; | ||||
|         opt_default(NULL, "b", "1150000"); | ||||
|         opt_default(NULL, "maxrate", "1150000"); | ||||
|         opt_default(NULL, "minrate", "1150000"); | ||||
|         opt_default(NULL, "bufsize", "327680"); // 40*1024*8; | ||||
|  | ||||
|         opt_default("b:a", "224000"); | ||||
|         opt_default(NULL, "b:a", "224000"); | ||||
|         parse_option(o, "ar", "44100", options); | ||||
|         parse_option(o, "ac", "2", options); | ||||
|  | ||||
|         opt_default("packetsize", "2324"); | ||||
|         opt_default("muxrate", "1411200"); // 2352 * 75 * 8; | ||||
|         opt_default(NULL, "packetsize", "2324"); | ||||
|         opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8; | ||||
|  | ||||
|         /* We have to offset the PTS, so that it is consistent with the SCR. | ||||
|            SCR starts at 36000, but the first two packs contain only padding | ||||
| @@ -1583,19 +1583,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg) | ||||
|  | ||||
|         parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options); | ||||
|         parse_option(o, "r", frame_rates[norm], options); | ||||
|         opt_default("g", norm == PAL ? "15" : "18"); | ||||
|         opt_default(NULL, "g", norm == PAL ? "15" : "18"); | ||||
|  | ||||
|         opt_default("b", "2040000"); | ||||
|         opt_default("maxrate", "2516000"); | ||||
|         opt_default("minrate", "0"); // 1145000; | ||||
|         opt_default("bufsize", "1835008"); // 224*1024*8; | ||||
|         opt_default("flags", "+scan_offset"); | ||||
|         opt_default(NULL, "b", "2040000"); | ||||
|         opt_default(NULL, "maxrate", "2516000"); | ||||
|         opt_default(NULL, "minrate", "0"); // 1145000; | ||||
|         opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; | ||||
|         opt_default(NULL, "flags", "+scan_offset"); | ||||
|  | ||||
|  | ||||
|         opt_default("b:a", "224000"); | ||||
|         opt_default(NULL, "b:a", "224000"); | ||||
|         parse_option(o, "ar", "44100", options); | ||||
|  | ||||
|         opt_default("packetsize", "2324"); | ||||
|         opt_default(NULL, "packetsize", "2324"); | ||||
|  | ||||
|     } else if (!strcmp(arg, "dvd")) { | ||||
|  | ||||
| @@ -1605,17 +1605,17 @@ static int opt_target(void *optctx, const char *opt, const char *arg) | ||||
|  | ||||
|         parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options); | ||||
|         parse_option(o, "r", frame_rates[norm], options); | ||||
|         opt_default("g", norm == PAL ? "15" : "18"); | ||||
|         opt_default(NULL, "g", norm == PAL ? "15" : "18"); | ||||
|  | ||||
|         opt_default("b", "6000000"); | ||||
|         opt_default("maxrate", "9000000"); | ||||
|         opt_default("minrate", "0"); // 1500000; | ||||
|         opt_default("bufsize", "1835008"); // 224*1024*8; | ||||
|         opt_default(NULL, "b", "6000000"); | ||||
|         opt_default(NULL, "maxrate", "9000000"); | ||||
|         opt_default(NULL, "minrate", "0"); // 1500000; | ||||
|         opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; | ||||
|  | ||||
|         opt_default("packetsize", "2048");  // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. | ||||
|         opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 | ||||
|         opt_default(NULL, "packetsize", "2048");  // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. | ||||
|         opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 | ||||
|  | ||||
|         opt_default("b:a", "448000"); | ||||
|         opt_default(NULL, "b:a", "448000"); | ||||
|         parse_option(o, "ar", "48000", options); | ||||
|  | ||||
|     } else if (!strncmp(arg, "dv", 2)) { | ||||
| @@ -1637,14 +1637,14 @@ static int opt_target(void *optctx, const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int opt_vstats_file(const char *opt, const char *arg) | ||||
| static int opt_vstats_file(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     av_free (vstats_filename); | ||||
|     vstats_filename = av_strdup (arg); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int opt_vstats(const char *opt, const char *arg) | ||||
| static int opt_vstats(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     char filename[40]; | ||||
|     time_t today2 = time(NULL); | ||||
| @@ -1652,7 +1652,7 @@ static int opt_vstats(const char *opt, const char *arg) | ||||
|  | ||||
|     snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, | ||||
|              today->tm_sec); | ||||
|     return opt_vstats_file(opt, filename); | ||||
|     return opt_vstats_file(NULL, opt, filename); | ||||
| } | ||||
|  | ||||
| static int opt_video_frames(void *optctx, const char *opt, const char *arg) | ||||
| @@ -1703,7 +1703,7 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg) | ||||
|     return parse_option(o, "filter:a", arg, options); | ||||
| } | ||||
|  | ||||
| static int opt_vsync(const char *opt, const char *arg) | ||||
| static int opt_vsync(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     if      (!av_strcasecmp(arg, "cfr"))         video_sync_method = VSYNC_CFR; | ||||
|     else if (!av_strcasecmp(arg, "vfr"))         video_sync_method = VSYNC_VFR; | ||||
| @@ -1714,14 +1714,14 @@ static int opt_vsync(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int opt_deinterlace(const char *opt, const char *arg) | ||||
| static int opt_deinterlace(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt); | ||||
|     do_deinterlace = 1; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int opt_cpuflags(const char *opt, const char *arg) | ||||
| int opt_cpuflags(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     int flags = av_parse_cpu_flags(arg); | ||||
|  | ||||
| @@ -1747,7 +1747,7 @@ static int opt_channel_layout(void *optctx, const char *opt, const char *arg) | ||||
|         return AVERROR(EINVAL); | ||||
|     } | ||||
|     snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout); | ||||
|     ret = opt_default(opt, layout_str); | ||||
|     ret = opt_default(NULL, opt, layout_str); | ||||
|     if (ret < 0) | ||||
|         return ret; | ||||
|  | ||||
| @@ -1774,7 +1774,7 @@ static int opt_audio_qscale(void *optctx, const char *opt, const char *arg) | ||||
|     return parse_option(o, "q:a", arg, options); | ||||
| } | ||||
|  | ||||
| static int opt_filter_complex(const char *opt, const char *arg) | ||||
| static int opt_filter_complex(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     filtergraphs = grow_array(filtergraphs, sizeof(*filtergraphs), | ||||
|                               &nb_filtergraphs, nb_filtergraphs + 1); | ||||
| @@ -1788,7 +1788,7 @@ static int opt_filter_complex(const char *opt, const char *arg) | ||||
| void show_help_default(const char *opt, const char *arg) | ||||
| { | ||||
|     /* per-file options have at least one of those set */ | ||||
|     const int per_file = OPT_SPEC | OPT_OFFSET | OPT_FUNC2; | ||||
|     const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE; | ||||
|     int show_advanced = 0, show_avoptions = 0; | ||||
|  | ||||
|     if (opt) { | ||||
| @@ -1863,7 +1863,7 @@ const OptionDef options[] = { | ||||
| #include "cmdutils_common_opts.h" | ||||
|     { "f",              HAS_ARG | OPT_STRING | OPT_OFFSET,           { .off       = OFFSET(format) }, | ||||
|         "force format", "fmt" }, | ||||
|     { "i",              HAS_ARG | OPT_FUNC2,                         { .func2_arg = opt_input_file }, | ||||
|     { "i",              HAS_ARG | OPT_PERFILE,                       { .func_arg = opt_input_file }, | ||||
|         "input file name", "filename" }, | ||||
|     { "y",              OPT_BOOL,                                    {              &file_overwrite }, | ||||
|         "overwrite output files" }, | ||||
| @@ -1873,7 +1873,7 @@ const OptionDef options[] = { | ||||
|         "codec name", "codec" }, | ||||
|     { "pre",            HAS_ARG | OPT_STRING | OPT_SPEC,             { .off       = OFFSET(presets) }, | ||||
|         "preset name", "preset" }, | ||||
|     { "map",            HAS_ARG | OPT_EXPERT | OPT_FUNC2,            { .func2_arg = opt_map }, | ||||
|     { "map",            HAS_ARG | OPT_EXPERT | OPT_PERFILE,          { .func_arg = opt_map }, | ||||
|         "set input stream mapping", | ||||
|         "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" }, | ||||
|     { "map_metadata",   HAS_ARG | OPT_STRING | OPT_SPEC,             { .off       = OFFSET(metadata_map) }, | ||||
| @@ -1894,7 +1894,7 @@ const OptionDef options[] = { | ||||
|         "set the input ts scale", "scale" }, | ||||
|     { "metadata",       HAS_ARG | OPT_STRING | OPT_SPEC,             { .off = OFFSET(metadata) }, | ||||
|         "add metadata", "string=string" }, | ||||
|     { "dframes",        HAS_ARG | OPT_FUNC2 | OPT_EXPERT,            { .func2_arg = opt_data_frames }, | ||||
|     { "dframes",        HAS_ARG | OPT_PERFILE | OPT_EXPERT,          { .func_arg = opt_data_frames }, | ||||
|         "set the number of data frames to record", "number" }, | ||||
|     { "benchmark",      OPT_BOOL | OPT_EXPERT,                       { &do_benchmark }, | ||||
|         "add timings for benchmarking" }, | ||||
| @@ -1906,7 +1906,7 @@ const OptionDef options[] = { | ||||
|         "when dumping packets, also dump the payload" }, | ||||
|     { "re",             OPT_BOOL | OPT_EXPERT | OPT_OFFSET,          { .off = OFFSET(rate_emu) }, | ||||
|         "read input at native frame rate", "" }, | ||||
|     { "target",         HAS_ARG | OPT_FUNC2,                         { .func2_arg = opt_target }, | ||||
|     { "target",         HAS_ARG | OPT_PERFILE,                       { .func_arg = opt_target }, | ||||
|         "specify target file type (\"vcd\", \"svcd\", \"dvd\"," | ||||
|         " \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, | ||||
|     { "vsync",          HAS_ARG | OPT_EXPERT,                        { opt_vsync }, | ||||
| @@ -1941,7 +1941,7 @@ const OptionDef options[] = { | ||||
|         "create a complex filtergraph", "graph_description" }, | ||||
|     { "stats",          OPT_BOOL,                                    { &print_stats }, | ||||
|         "print progress report during encoding", }, | ||||
|     { "attach",         HAS_ARG | OPT_FUNC2 | OPT_EXPERT,            { .func2_arg = opt_attach }, | ||||
|     { "attach",         HAS_ARG | OPT_PERFILE | OPT_EXPERT,          { .func_arg = opt_attach }, | ||||
|         "add an attachment to the output file", "filename" }, | ||||
|     { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |OPT_EXPERT,{ .off = OFFSET(dump_attachment) }, | ||||
|         "extract an attachment into a file", "filename" }, | ||||
| @@ -1949,7 +1949,7 @@ const OptionDef options[] = { | ||||
|         "set CPU flags mask", "mask" }, | ||||
|  | ||||
|     /* video options */ | ||||
|     { "vframes",      OPT_VIDEO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_video_frames }, | ||||
|     { "vframes",      OPT_VIDEO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_video_frames }, | ||||
|         "set the number of video frames to record", "number" }, | ||||
|     { "r",            OPT_VIDEO | HAS_ARG  | OPT_STRING | OPT_SPEC,              { .off = OFFSET(frame_rates) }, | ||||
|         "set frame rate (Hz value, fraction or abbreviation)", "rate" }, | ||||
| @@ -1965,7 +1965,7 @@ const OptionDef options[] = { | ||||
|         "discard threshold", "n" }, | ||||
|     { "rc_override",  OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC, { .off = OFFSET(rc_overrides) }, | ||||
|         "rate control override for specific intervals", "override" }, | ||||
|     { "vcodec",       OPT_VIDEO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_video_codec }, | ||||
|     { "vcodec",       OPT_VIDEO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_video_codec }, | ||||
|         "force video codec ('copy' to copy stream)", "codec" }, | ||||
|     { "same_quant",   OPT_VIDEO | OPT_BOOL | OPT_EXPERT,                         { &same_quant }, | ||||
|         "use same quantizer as source (implies VBR)" }, | ||||
| @@ -1979,7 +1979,7 @@ const OptionDef options[] = { | ||||
|         "dump video coding statistics to file" }, | ||||
|     { "vstats_file",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,                         { opt_vstats_file }, | ||||
|         "dump video coding statistics to file", "file" }, | ||||
|     { "vf",           OPT_VIDEO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_video_filters }, | ||||
|     { "vf",           OPT_VIDEO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_video_filters }, | ||||
|         "video filters", "filter list" }, | ||||
|     { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC, { .off = OFFSET(intra_matrices) }, | ||||
|         "specify intra matrix coeffs", "matrix" }, | ||||
| @@ -1989,21 +1989,21 @@ const OptionDef options[] = { | ||||
|         "top=1/bottom=0/auto=-1 field first", "" }, | ||||
|     { "dc",           OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT ,               { &intra_dc_precision }, | ||||
|         "intra_dc_precision", "precision" }, | ||||
|     { "vtag",         OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_FUNC2,             { .func2_arg = opt_video_tag }, | ||||
|     { "vtag",         OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_PERFILE,           { .func_arg = opt_video_tag }, | ||||
|         "force video tag/fourcc", "fourcc/tag" }, | ||||
|     { "qphist",       OPT_VIDEO | OPT_BOOL | OPT_EXPERT ,                        { &qp_hist }, | ||||
|         "show QP histogram" }, | ||||
|     { "force_fps",    OPT_VIDEO | OPT_BOOL | OPT_EXPERT  | OPT_SPEC,             { .off = OFFSET(force_fps) }, | ||||
|         "force the selected framerate, disable the best supported framerate selection" }, | ||||
|     { "streamid",     OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_FUNC2,              { .func2_arg = opt_streamid }, | ||||
|     { "streamid",     OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE,            { .func_arg = opt_streamid }, | ||||
|         "set the value of an outfile streamid", "streamIndex:value" }, | ||||
|     { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT  | OPT_SPEC, | ||||
|         { .off = OFFSET(forced_key_frames) }, "force key frames at specified timestamps", "timestamps" }, | ||||
|  | ||||
|     /* audio options */ | ||||
|     { "aframes",        OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_frames }, | ||||
|     { "aframes",        OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_frames }, | ||||
|         "set the number of audio frames to record", "number" }, | ||||
|     { "aq",             OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_qscale }, | ||||
|     { "aq",             OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_qscale }, | ||||
|         "set audio quality (codec-specific)", "quality", }, | ||||
|     { "ar",             OPT_AUDIO | HAS_ARG  | OPT_INT | OPT_SPEC,                 { .off = OFFSET(audio_sample_rate) }, | ||||
|         "set audio sampling rate (in Hz)", "rate" }, | ||||
| @@ -2011,25 +2011,25 @@ const OptionDef options[] = { | ||||
|         "set number of audio channels", "channels" }, | ||||
|     { "an",             OPT_AUDIO | OPT_BOOL | OPT_OFFSET,                         { .off = OFFSET(audio_disable) }, | ||||
|         "disable audio" }, | ||||
|     { "acodec",         OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_codec }, | ||||
|     { "acodec",         OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_codec }, | ||||
|         "force audio codec ('copy' to copy stream)", "codec" }, | ||||
|     { "atag",           OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_FUNC2,             { .func2_arg = opt_audio_tag }, | ||||
|     { "atag",           OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE,           { .func_arg = opt_audio_tag }, | ||||
|         "force audio tag/fourcc", "fourcc/tag" }, | ||||
|     { "vol",            OPT_AUDIO | HAS_ARG  | OPT_INT,                            { &audio_volume }, | ||||
|         "change audio volume (256=normal)" , "volume" }, | ||||
|     { "sample_fmt",     OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_SPEC | OPT_STRING, { .off = OFFSET(sample_fmts) }, | ||||
|         "set sample format", "format" }, | ||||
|     { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_FUNC2,             { .func2_arg = opt_channel_layout }, | ||||
|     { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE,           { .func_arg = opt_channel_layout }, | ||||
|         "set channel layout", "layout" }, | ||||
|     { "af",             OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_filters }, | ||||
|     { "af",             OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_filters }, | ||||
|         "audio filters", "filter list" }, | ||||
|  | ||||
|     /* subtitle options */ | ||||
|     { "sn",     OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) }, | ||||
|         "disable subtitle" }, | ||||
|     { "scodec", OPT_SUBTITLE | HAS_ARG  | OPT_FUNC2,  { .func2_arg = opt_subtitle_codec }, | ||||
|     { "scodec", OPT_SUBTITLE | HAS_ARG  | OPT_PERFILE, { .func_arg = opt_subtitle_codec }, | ||||
|         "force subtitle codec ('copy' to copy stream)", "codec" }, | ||||
|     { "stag",   OPT_SUBTITLE | HAS_ARG  | OPT_EXPERT  | OPT_FUNC2, { .func2_arg = opt_subtitle_tag } | ||||
|     { "stag",   OPT_SUBTITLE | HAS_ARG  | OPT_EXPERT  | OPT_PERFILE, { .func_arg = opt_subtitle_tag } | ||||
|         , "force subtitle tag/fourcc", "fourcc/tag" }, | ||||
|  | ||||
|     /* grab options */ | ||||
| @@ -2045,7 +2045,7 @@ const OptionDef options[] = { | ||||
|         "A comma-separated list of bitstream filters", "bitstream_filters" }, | ||||
|  | ||||
|     /* data codec support */ | ||||
|     { "dcodec", HAS_ARG | OPT_DATA | OPT_FUNC2 | OPT_EXPERT, { .func2_arg = opt_data_codec }, | ||||
|     { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_data_codec }, | ||||
|         "force data codec ('copy' to copy stream)", "codec" }, | ||||
|  | ||||
|     { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { .func_arg = opt_default }, | ||||
|   | ||||
| @@ -794,7 +794,7 @@ static void show_usage(void) | ||||
|     printf("\n"); | ||||
| } | ||||
|  | ||||
| static int opt_format(const char *opt, const char *arg) | ||||
| static int opt_format(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     iformat = av_find_input_format(arg); | ||||
|     if (!iformat) { | ||||
| @@ -804,7 +804,7 @@ static int opt_format(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int opt_output_format(const char *opt, const char *arg) | ||||
| static int opt_output_format(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|  | ||||
|     if (!strcmp(arg, "json")) { | ||||
| @@ -838,7 +838,7 @@ static int opt_output_format(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int opt_show_format_entry(const char *opt, const char *arg) | ||||
| static int opt_show_format_entry(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     do_show_format = 1; | ||||
|     nb_fmt_entries_to_show++; | ||||
| @@ -877,7 +877,7 @@ void show_help_default(const char *opt, const char *arg) | ||||
|     show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); | ||||
| } | ||||
|  | ||||
| static int opt_pretty(const char *opt, const char *arg) | ||||
| static int opt_pretty(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     show_value_unit              = 1; | ||||
|     use_value_prefix             = 1; | ||||
|   | ||||
							
								
								
									
										35
									
								
								cmdutils.c
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								cmdutils.c
									
									
									
									
									
								
							| @@ -286,8 +286,7 @@ int parse_option(void *optctx, const char *opt, const char *arg, | ||||
|     } else if (po->flags & OPT_DOUBLE) { | ||||
|         *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY); | ||||
|     } else if (po->u.func_arg) { | ||||
|         int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg) | ||||
|                                         : po->u.func_arg(opt, arg); | ||||
|         int ret = po->u.func_arg(optctx, opt, arg); | ||||
|         if (ret < 0) { | ||||
|             av_log(NULL, AV_LOG_ERROR, | ||||
|                    "Failed to set value '%s' for option '%s'\n", arg, opt); | ||||
| @@ -362,11 +361,11 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) | ||||
|     if (!idx) | ||||
|         idx = locate_option(argc, argv, options, "v"); | ||||
|     if (idx && argv[idx + 1]) | ||||
|         opt_loglevel("loglevel", argv[idx + 1]); | ||||
|         opt_loglevel(NULL, "loglevel", argv[idx + 1]); | ||||
| } | ||||
|  | ||||
| #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 | ||||
| int opt_default(const char *opt, const char *arg) | ||||
| int opt_default(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     const AVOption *o; | ||||
|     char opt_stripped[128]; | ||||
| @@ -401,7 +400,7 @@ int opt_default(const char *opt, const char *arg) | ||||
|     return AVERROR_OPTION_NOT_FOUND; | ||||
| } | ||||
|  | ||||
| int opt_loglevel(const char *opt, const char *arg) | ||||
| int opt_loglevel(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     const struct { const char *name; int level; } log_levels[] = { | ||||
|         { "quiet"  , AV_LOG_QUIET   }, | ||||
| @@ -436,7 +435,7 @@ int opt_loglevel(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int opt_timelimit(const char *opt, const char *arg) | ||||
| int opt_timelimit(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
| #if HAVE_SETRLIMIT | ||||
|     int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); | ||||
| @@ -516,7 +515,7 @@ void show_banner(void) | ||||
|     print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE); | ||||
| } | ||||
|  | ||||
| int show_version(const char *opt, const char *arg) | ||||
| int show_version(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     av_log_set_callback(log_callback_help); | ||||
|     printf("%s " LIBAV_VERSION "\n", program_name); | ||||
| @@ -525,7 +524,7 @@ int show_version(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_license(const char *opt, const char *arg) | ||||
| int show_license(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     printf( | ||||
| #if CONFIG_NONFREE | ||||
| @@ -596,7 +595,7 @@ int show_license(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_formats(const char *opt, const char *arg) | ||||
| int show_formats(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     AVInputFormat *ifmt  = NULL; | ||||
|     AVOutputFormat *ofmt = NULL; | ||||
| @@ -736,7 +735,7 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder) | ||||
|     printf(")"); | ||||
| } | ||||
|  | ||||
| int show_codecs(const char *opt, const char *arg) | ||||
| int show_codecs(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     const AVCodecDescriptor *desc = NULL; | ||||
|  | ||||
| @@ -815,19 +814,19 @@ static void print_codecs(int encoder) | ||||
|     } | ||||
| } | ||||
|  | ||||
| int show_decoders(const char *opt, const char *arg) | ||||
| int show_decoders(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     print_codecs(0); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_encoders(const char *opt, const char *arg) | ||||
| int show_encoders(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     print_codecs(1); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_bsfs(const char *opt, const char *arg) | ||||
| int show_bsfs(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     AVBitStreamFilter *bsf = NULL; | ||||
|  | ||||
| @@ -838,7 +837,7 @@ int show_bsfs(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_protocols(const char *opt, const char *arg) | ||||
| int show_protocols(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     void *opaque = NULL; | ||||
|     const char *name; | ||||
| @@ -853,7 +852,7 @@ int show_protocols(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_filters(const char *opt, const char *arg) | ||||
| int show_filters(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     AVFilter av_unused(**filter) = NULL; | ||||
|  | ||||
| @@ -865,7 +864,7 @@ int show_filters(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_pix_fmts(const char *opt, const char *arg) | ||||
| int show_pix_fmts(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     enum PixelFormat pix_fmt; | ||||
|  | ||||
| @@ -898,7 +897,7 @@ int show_pix_fmts(const char *opt, const char *arg) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| int show_sample_fmts(const char *opt, const char *arg) | ||||
| int show_sample_fmts(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     int i; | ||||
|     char fmt_str[128]; | ||||
| @@ -993,7 +992,7 @@ static void show_help_muxer(const char *name) | ||||
|         show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM); | ||||
| } | ||||
|  | ||||
| int show_help(const char *opt, const char *arg) | ||||
| int show_help(void *optctx, const char *opt, const char *arg) | ||||
| { | ||||
|     char *topic, *par; | ||||
|     av_log_set_callback(log_callback_help); | ||||
|   | ||||
							
								
								
									
										36
									
								
								cmdutils.h
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								cmdutils.h
									
									
									
									
									
								
							| @@ -65,17 +65,17 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl); | ||||
|  * Fallback for options that are not explicitly handled, these will be | ||||
|  * parsed through AVOptions. | ||||
|  */ | ||||
| int opt_default(const char *opt, const char *arg); | ||||
| int opt_default(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Set the libav* libraries log level. | ||||
|  */ | ||||
| int opt_loglevel(const char *opt, const char *arg); | ||||
| int opt_loglevel(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Limit the execution time. | ||||
|  */ | ||||
| int opt_timelimit(const char *opt, const char *arg); | ||||
| int opt_timelimit(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Parse a string and return its corresponding value as a double. | ||||
| @@ -136,7 +136,8 @@ typedef struct { | ||||
| #define OPT_INT64  0x0400 | ||||
| #define OPT_EXIT   0x0800 | ||||
| #define OPT_DATA   0x1000 | ||||
| #define OPT_FUNC2  0x2000 | ||||
| #define OPT_PERFILE  0x2000     /* the option is per-file (currently avconv-only). | ||||
|                                    implied by OPT_OFFSET or OPT_SPEC */ | ||||
| #define OPT_OFFSET 0x4000       /* option is specified as an offset in a passed optctx */ | ||||
| #define OPT_SPEC   0x8000       /* option is to be stored in an array of SpecifierOpt. | ||||
|                                    Implies OPT_OFFSET. Next element after the offset is | ||||
| @@ -145,8 +146,7 @@ typedef struct { | ||||
| #define OPT_DOUBLE 0x20000 | ||||
|      union { | ||||
|         void *dst_ptr; | ||||
|         int (*func_arg)(const char *, const char *); | ||||
|         int (*func2_arg)(void *, const char *, const char *); | ||||
|         int (*func_arg)(void *, const char *, const char *); | ||||
|         size_t off; | ||||
|     } u; | ||||
|     const char *help; | ||||
| @@ -180,7 +180,7 @@ void show_help_default(const char *opt, const char *arg); | ||||
| /** | ||||
|  * Generic -h handler common to all avtools. | ||||
|  */ | ||||
| int show_help(const char *opt, const char *arg); | ||||
| int show_help(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Parse the command line arguments. | ||||
| @@ -277,67 +277,67 @@ void show_banner(void); | ||||
|  * depends on the current versions of the repository and of the libav* | ||||
|  * libraries. | ||||
|  */ | ||||
| int show_version(const char *opt, const char *arg); | ||||
| int show_version(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print the license of the program to stdout. The license depends on | ||||
|  * the license of the libraries compiled into the program. | ||||
|  */ | ||||
| int show_license(const char *opt, const char *arg); | ||||
| int show_license(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the formats supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_formats(const char *opt, const char *arg); | ||||
| int show_formats(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the codecs supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_codecs(const char *opt, const char *arg); | ||||
| int show_codecs(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the decoders supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_decoders(const char *opt, const char *arg); | ||||
| int show_decoders(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the encoders supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_encoders(const char *opt, const char *arg); | ||||
| int show_encoders(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the filters supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_filters(const char *opt, const char *arg); | ||||
| int show_filters(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the bit stream filters supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_bsfs(const char *opt, const char *arg); | ||||
| int show_bsfs(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the protocols supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_protocols(const char *opt, const char *arg); | ||||
| int show_protocols(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the pixel formats supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_pix_fmts(const char *opt, const char *arg); | ||||
| int show_pix_fmts(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Print a listing containing all the sample formats supported by the | ||||
|  * program. | ||||
|  */ | ||||
| int show_sample_fmts(const char *opt, const char *arg); | ||||
| int show_sample_fmts(void *optctx, const char *opt, const char *arg); | ||||
|  | ||||
| /** | ||||
|  * Return a positive value if a line read from standard input | ||||
|   | ||||
		Reference in New Issue
	
	Block a user