cmdutils: remove OPT_FUNC2

Make ff* tools only accept opt_* functions taking two arguments.

The distinction between functions with one and two arguments is quite
pointless. Simplify parse_options() code.
pull/2/head
Stefano Sabatini 14 years ago
parent 78046dadc3
commit eb8bc57240
  1. 10
      cmdutils.c
  2. 12
      cmdutils.h
  3. 2
      cmdutils_common_opts.h
  4. 215
      ffmpeg.c
  5. 35
      ffplay.c
  6. 7
      ffprobe.c

@ -273,15 +273,13 @@ unknown_opt:
*po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
} else if (po->flags & OPT_FLOAT) { } else if (po->flags & OPT_FLOAT) {
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY); *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
} else if (po->flags & OPT_FUNC2) {
if (po->u.func2_arg(opt, arg) < 0) {
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
exit(1);
}
} else if (po->flags & OPT_DUMMY) { } else if (po->flags & OPT_DUMMY) {
/* Do nothing for this option */ /* Do nothing for this option */
} else { } else {
po->u.func_arg(arg); if (po->u.func_arg(opt, arg) < 0) {
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
exit(1);
}
} }
if(po->flags & OPT_EXIT) if(po->flags & OPT_EXIT)
exit(0); exit(0);

@ -121,17 +121,15 @@ typedef struct {
#define OPT_INT 0x0080 #define OPT_INT 0x0080
#define OPT_FLOAT 0x0100 #define OPT_FLOAT 0x0100
#define OPT_SUBTITLE 0x0200 #define OPT_SUBTITLE 0x0200
#define OPT_FUNC2 0x0400 #define OPT_INT64 0x0400
#define OPT_INT64 0x0800 #define OPT_EXIT 0x0800
#define OPT_EXIT 0x1000 #define OPT_DATA 0x1000
#define OPT_DATA 0x2000 #define OPT_DUMMY 0x2000
#define OPT_DUMMY 0x4000
union { union {
void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
int *int_arg; int *int_arg;
char **str_arg; char **str_arg;
float *float_arg; float *float_arg;
int (*func2_arg)(const char *, const char *); int (*func_arg)(const char *, const char *);
int64_t *int64_arg; int64_t *int64_arg;
} u; } u;
const char *help; const char *help;

@ -10,4 +10,4 @@
{ "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" }, { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
{ "filters", OPT_EXIT, {(void*)show_filters }, "show available filters" }, { "filters", OPT_EXIT, {(void*)show_filters }, "show available filters" },
{ "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" }, { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
{ "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },

@ -2810,14 +2810,16 @@ static int transcode(AVFormatContext **output_files,
return ret; return ret;
} }
static void opt_format(const char *arg) static int opt_format(const char *opt, const char *arg)
{ {
last_asked_format = arg; last_asked_format = arg;
return 0;
} }
static void opt_video_rc_override_string(const char *arg) static int opt_video_rc_override_string(const char *opt, const char *arg)
{ {
video_rc_override_string = arg; video_rc_override_string = arg;
return 0;
} }
static int opt_me_threshold(const char *opt, const char *arg) static int opt_me_threshold(const char *opt, const char *arg)
@ -2859,12 +2861,13 @@ static int opt_frame_crop(const char *opt, const char *arg)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
static void opt_frame_size(const char *arg) static int opt_frame_size(const char *opt, const char *arg)
{ {
if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) { if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
fprintf(stderr, "Incorrect frame size\n"); fprintf(stderr, "Incorrect frame size\n");
ffmpeg_exit(1); return AVERROR(EINVAL);
} }
return 0;
} }
static int opt_pad(const char *opt, const char *arg) { static int opt_pad(const char *opt, const char *arg) {
@ -2872,21 +2875,22 @@ static int opt_pad(const char *opt, const char *arg) {
return -1; return -1;
} }
static void opt_frame_pix_fmt(const char *arg) static int opt_frame_pix_fmt(const char *opt, const char *arg)
{ {
if (strcmp(arg, "list")) { if (strcmp(arg, "list")) {
frame_pix_fmt = av_get_pix_fmt(arg); frame_pix_fmt = av_get_pix_fmt(arg);
if (frame_pix_fmt == PIX_FMT_NONE) { if (frame_pix_fmt == PIX_FMT_NONE) {
fprintf(stderr, "Unknown pixel format requested: %s\n", arg); fprintf(stderr, "Unknown pixel format requested: %s\n", arg);
ffmpeg_exit(1); return AVERROR(EINVAL);
} }
} else { } else {
show_pix_fmts(); show_pix_fmts();
ffmpeg_exit(0); ffmpeg_exit(0);
} }
return 0;
} }
static void opt_frame_aspect_ratio(const char *arg) static int opt_frame_aspect_ratio(const char *opt, const char *arg)
{ {
int x = 0, y = 0; int x = 0, y = 0;
double ar = 0; double ar = 0;
@ -2905,9 +2909,10 @@ static void opt_frame_aspect_ratio(const char *arg)
if (!ar) { if (!ar) {
fprintf(stderr, "Incorrect aspect ratio specification.\n"); fprintf(stderr, "Incorrect aspect ratio specification.\n");
ffmpeg_exit(1); return AVERROR(EINVAL);
} }
frame_aspect_ratio = ar; frame_aspect_ratio = ar;
return 0;
} }
static int opt_metadata(const char *opt, const char *arg) static int opt_metadata(const char *opt, const char *arg)
@ -2952,13 +2957,13 @@ static int opt_thread_count(const char *opt, const char *arg)
return 0; return 0;
} }
static void opt_audio_sample_fmt(const char *arg) static int opt_audio_sample_fmt(const char *opt, const char *arg)
{ {
if (strcmp(arg, "list")) { if (strcmp(arg, "list")) {
audio_sample_fmt = av_get_sample_fmt(arg); audio_sample_fmt = av_get_sample_fmt(arg);
if (audio_sample_fmt == AV_SAMPLE_FMT_NONE) { if (audio_sample_fmt == AV_SAMPLE_FMT_NONE) {
av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg); av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg);
ffmpeg_exit(1); return AVERROR(EINVAL);
} }
} else { } else {
int i; int i;
@ -2967,6 +2972,7 @@ static void opt_audio_sample_fmt(const char *arg)
printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i)); printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
ffmpeg_exit(0); ffmpeg_exit(0);
} }
return 0;
} }
static int opt_audio_rate(const char *opt, const char *arg) static int opt_audio_rate(const char *opt, const char *arg)
@ -2987,12 +2993,13 @@ static int opt_video_channel(const char *opt, const char *arg)
return 0; return 0;
} }
static void opt_video_standard(const char *arg) static int opt_video_standard(const char *opt, const char *arg)
{ {
video_standard = av_strdup(arg); video_standard = av_strdup(arg);
return 0;
} }
static void opt_codec(int *pstream_copy, char **pcodec_name, static int opt_codec(int *pstream_copy, char **pcodec_name,
int codec_type, const char *arg) int codec_type, const char *arg)
{ {
av_freep(pcodec_name); av_freep(pcodec_name);
@ -3001,26 +3008,27 @@ static void opt_codec(int *pstream_copy, char **pcodec_name,
} else { } else {
*pcodec_name = av_strdup(arg); *pcodec_name = av_strdup(arg);
} }
return 0;
} }
static void opt_audio_codec(const char *arg) static int opt_audio_codec(const char *opt, const char *arg)
{ {
opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg); return opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg);
} }
static void opt_video_codec(const char *arg) static int opt_video_codec(const char *opt, const char *arg)
{ {
opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg); return opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg);
} }
static void opt_subtitle_codec(const char *arg) static int opt_subtitle_codec(const char *opt, const char *arg)
{ {
opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg); return opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg);
} }
static void opt_data_codec(const char *arg) static int opt_data_codec(const char *opt, const char *arg)
{ {
opt_codec(&data_stream_copy, &data_codec_name, AVMEDIA_TYPE_DATA, arg); return opt_codec(&data_stream_copy, &data_codec_name, AVMEDIA_TYPE_DATA, arg);
} }
static int opt_codec_tag(const char *opt, const char *arg) static int opt_codec_tag(const char *opt, const char *arg)
@ -3041,7 +3049,7 @@ static int opt_codec_tag(const char *opt, const char *arg)
return 0; return 0;
} }
static void opt_map(const char *arg) static int opt_map(const char *opt, const char *arg)
{ {
AVStreamMap *m; AVStreamMap *m;
char *p; char *p;
@ -3064,6 +3072,7 @@ static void opt_map(const char *arg)
m->sync_file_index = m->file_index; m->sync_file_index = m->file_index;
m->sync_stream_index = m->stream_index; m->sync_stream_index = m->stream_index;
} }
return 0;
} }
static void parse_meta_type(char *arg, char *type, int *index, char **endptr) static void parse_meta_type(char *arg, char *type, int *index, char **endptr)
@ -3087,7 +3096,7 @@ static void parse_meta_type(char *arg, char *type, int *index, char **endptr)
*type = 'g'; *type = 'g';
} }
static void opt_map_metadata(const char *arg) static int opt_map_metadata(const char *opt, const char *arg)
{ {
AVMetaDataMap *m, *m1; AVMetaDataMap *m, *m1;
char *p; char *p;
@ -3111,16 +3120,18 @@ static void opt_map_metadata(const char *arg)
metadata_streams_autocopy = 0; metadata_streams_autocopy = 0;
if (m->type == 'c' || m1->type == 'c') if (m->type == 'c' || m1->type == 'c')
metadata_chapters_autocopy = 0; metadata_chapters_autocopy = 0;
return 0;
} }
static void opt_map_meta_data(const char *arg) static int opt_map_meta_data(const char *opt, const char *arg)
{ {
fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. " fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. "
"Use -map_metadata instead.\n"); "Use -map_metadata instead.\n");
opt_map_metadata(arg); return opt_map_metadata(opt, arg);
} }
static void opt_map_chapters(const char *arg) static int opt_map_chapters(const char *opt, const char *arg)
{ {
AVChapterMap *c; AVChapterMap *c;
char *p; char *p;
@ -3133,9 +3144,10 @@ static void opt_map_chapters(const char *arg)
p++; p++;
c->in_file = strtol(p, &p, 0); c->in_file = strtol(p, &p, 0);
return 0;
} }
static void opt_input_ts_scale(const char *arg) static int opt_input_ts_scale(const char *opt, const char *arg)
{ {
unsigned int stream; unsigned int stream;
double scale; double scale;
@ -3151,6 +3163,7 @@ static void opt_input_ts_scale(const char *arg)
input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
input_files_ts_scale[nb_input_files][stream]= scale; input_files_ts_scale[nb_input_files][stream]= scale;
return 0;
} }
static int opt_recording_time(const char *opt, const char *arg) static int opt_recording_time(const char *opt, const char *arg)
@ -3211,7 +3224,7 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder, i
return codec->id; return codec->id;
} }
static void opt_input_file(const char *filename) static int opt_input_file(const char *opt, const char *filename)
{ {
AVFormatContext *ic; AVFormatContext *ic;
AVFormatParameters params, *ap = &params; AVFormatParameters params, *ap = &params;
@ -3433,6 +3446,7 @@ static void opt_input_file(const char *filename)
av_freep(&subtitle_codec_name); av_freep(&subtitle_codec_name);
uninit_opts(); uninit_opts();
init_opts(); init_opts();
return 0;
} }
static void check_inputs(int *has_video_ptr, static void check_inputs(int *has_video_ptr,
@ -4101,7 +4115,7 @@ static void show_help(void)
av_opt_show2(sws_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); av_opt_show2(sws_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
} }
static void opt_target(const char *arg) static int opt_target(const char *opt, const char *arg)
{ {
enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN; enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"}; static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"};
@ -4158,13 +4172,12 @@ static void opt_target(const char *arg)
} }
if(!strcmp(arg, "vcd")) { if(!strcmp(arg, "vcd")) {
opt_video_codec("vcodec", "mpeg1video");
opt_audio_codec("vcodec", "mp2");
opt_format("f", "vcd");
opt_video_codec("mpeg1video"); opt_frame_size("s", norm == PAL ? "352x288" : "352x240");
opt_audio_codec("mp2"); opt_frame_rate("r", frame_rates[norm]);
opt_format("vcd");
opt_frame_size(norm == PAL ? "352x288" : "352x240");
opt_frame_rate(NULL, frame_rates[norm]);
opt_default("g", norm == PAL ? "15" : "18"); opt_default("g", norm == PAL ? "15" : "18");
opt_default("b", "1150000"); opt_default("b", "1150000");
@ -4187,12 +4200,12 @@ static void opt_target(const char *arg)
mux_preload= (36000+3*1200) / 90000.0; //0.44 mux_preload= (36000+3*1200) / 90000.0; //0.44
} else if(!strcmp(arg, "svcd")) { } else if(!strcmp(arg, "svcd")) {
opt_video_codec("mpeg2video"); opt_video_codec("vcodec", "mpeg2video");
opt_audio_codec("mp2"); opt_audio_codec("acodec", "mp2");
opt_format("svcd"); opt_format("f", "svcd");
opt_frame_size(norm == PAL ? "480x576" : "480x480"); opt_frame_size("s", norm == PAL ? "480x576" : "480x480");
opt_frame_rate(NULL, frame_rates[norm]); opt_frame_rate("r", frame_rates[norm]);
opt_default("g", norm == PAL ? "15" : "18"); opt_default("g", norm == PAL ? "15" : "18");
opt_default("b", "2040000"); opt_default("b", "2040000");
@ -4209,12 +4222,12 @@ static void opt_target(const char *arg)
} else if(!strcmp(arg, "dvd")) { } else if(!strcmp(arg, "dvd")) {
opt_video_codec("mpeg2video"); opt_video_codec("vcodec", "mpeg2video");
opt_audio_codec("ac3"); opt_audio_codec("vcodec", "ac3");
opt_format("dvd"); opt_format("f", "dvd");
opt_frame_size(norm == PAL ? "720x576" : "720x480"); opt_frame_size("vcodec", norm == PAL ? "720x576" : "720x480");
opt_frame_rate(NULL, frame_rates[norm]); opt_frame_rate("r", frame_rates[norm]);
opt_default("g", norm == PAL ? "15" : "18"); opt_default("g", norm == PAL ? "15" : "18");
opt_default("b", "6000000"); opt_default("b", "6000000");
@ -4230,29 +4243,31 @@ static void opt_target(const char *arg)
} else if(!strncmp(arg, "dv", 2)) { } else if(!strncmp(arg, "dv", 2)) {
opt_format("dv"); opt_format("f", "dv");
opt_frame_size(norm == PAL ? "720x576" : "720x480"); opt_frame_size("s", norm == PAL ? "720x576" : "720x480");
opt_frame_pix_fmt(!strncmp(arg, "dv50", 4) ? "yuv422p" : opt_frame_pix_fmt("pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
(norm == PAL ? "yuv420p" : "yuv411p")); norm == PAL ? "yuv420p" : "yuv411p");
opt_frame_rate(NULL, frame_rates[norm]); opt_frame_rate("r", frame_rates[norm]);
audio_sample_rate = 48000; audio_sample_rate = 48000;
audio_channels = 2; audio_channels = 2;
} else { } else {
fprintf(stderr, "Unknown target: %s\n", arg); fprintf(stderr, "Unknown target: %s\n", arg);
ffmpeg_exit(1); return AVERROR(EINVAL);
} }
return 0;
} }
static void opt_vstats_file (const char *arg) static int opt_vstats_file(const char *opt, const char *arg)
{ {
av_free (vstats_filename); av_free (vstats_filename);
vstats_filename=av_strdup (arg); vstats_filename=av_strdup (arg);
return 0;
} }
static void opt_vstats (void) static int opt_vstats(const char *opt, const char *arg)
{ {
char filename[40]; char filename[40];
time_t today2 = time(NULL); time_t today2 = time(NULL);
@ -4260,7 +4275,7 @@ static void opt_vstats (void)
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
today->tm_sec); today->tm_sec);
opt_vstats_file(filename); return opt_vstats_file(opt, filename);
} }
static int opt_bsf(const char *opt, const char *arg) static int opt_bsf(const char *opt, const char *arg)
@ -4307,13 +4322,13 @@ static int opt_preset(const char *opt, const char *arg)
ffmpeg_exit(1); ffmpeg_exit(1);
} }
if(!strcmp(tmp, "acodec")){ if(!strcmp(tmp, "acodec")){
opt_audio_codec(tmp2); opt_audio_codec(tmp, tmp2);
}else if(!strcmp(tmp, "vcodec")){ }else if(!strcmp(tmp, "vcodec")){
opt_video_codec(tmp2); opt_video_codec(tmp, tmp2);
}else if(!strcmp(tmp, "scodec")){ }else if(!strcmp(tmp, "scodec")){
opt_subtitle_codec(tmp2); opt_subtitle_codec(tmp, tmp2);
}else if(!strcmp(tmp, "dcodec")){ }else if(!strcmp(tmp, "dcodec")){
opt_data_codec(tmp2); opt_data_codec(tmp, tmp2);
}else if(opt_default(tmp, tmp2) < 0){ }else if(opt_default(tmp, tmp2) < 0){
fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
ffmpeg_exit(1); ffmpeg_exit(1);
@ -4347,17 +4362,17 @@ static const OptionDef options[] = {
{ "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile", { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile",
"outfile[,metadata]:infile[,metadata]" }, "outfile[,metadata]:infile[,metadata]" },
{ "map_chapters", HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters}, "set chapters mapping", "outfile:infile" }, { "map_chapters", HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters}, "set chapters mapping", "outfile:infile" },
{ "t", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" }, { "t", HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" },
{ "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, // { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, //
{ "ss", OPT_FUNC2 | HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" }, { "ss", HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" },
{ "itsoffset", OPT_FUNC2 | HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" }, { "itsoffset", HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" },
{ "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" }, { "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" },
{ "timestamp", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_timestamp}, "set the recording timestamp ('now' to set the current time)", "time" }, { "timestamp", HAS_ARG, {(void*)opt_recording_timestamp}, "set the recording timestamp ('now' to set the current time)", "time" },
{ "metadata", OPT_FUNC2 | HAS_ARG, {(void*)opt_metadata}, "add metadata", "string=string" }, { "metadata", HAS_ARG, {(void*)opt_metadata}, "add metadata", "string=string" },
{ "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[AVMEDIA_TYPE_DATA]}, "set the number of data frames to record", "number" }, { "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[AVMEDIA_TYPE_DATA]}, "set the number of data frames to record", "number" },
{ "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark}, { "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark},
"add timings for benchmarking" }, "add timings for benchmarking" },
{ "timelimit", OPT_FUNC2 | HAS_ARG, {(void*)opt_timelimit}, "set max runtime in seconds", "limit" }, { "timelimit", HAS_ARG, {(void*)opt_timelimit}, "set max runtime in seconds", "limit" },
{ "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump}, { "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump},
"dump each input packet" }, "dump each input packet" },
{ "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump}, { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
@ -4365,9 +4380,9 @@ static const OptionDef options[] = {
{ "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" }, { "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_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)", "" }, { "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 | OPT_FUNC2, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" }, { "v", HAS_ARG, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" },
{ "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
{ "threads", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" }, { "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", "" }, { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
{ "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" }, { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
{ "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" }, { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
@ -4380,33 +4395,33 @@ static const OptionDef options[] = {
{ "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" }, { "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" },
/* video options */ /* video options */
{ "b", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" }, { "b", HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
{ "vb", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" }, { "vb", HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
{ "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" }, { "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
{ "r", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" }, { "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" }, { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
{ "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" }, { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" }, { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
{ "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&frame_bits_per_raw_sample}, "set the number of bits per raw sample", "number" }, { "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&frame_bits_per_raw_sample}, "set the number of bits per raw sample", "number" },
{ "croptop", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
{ "cropbottom", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
{ "cropleft", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
{ "cropright", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
{ "padtop", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, { "padtop", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
{ "padbottom", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, { "padbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
{ "padleft", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, { "padleft", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
{ "padright", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, { "padright", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
{ "padcolor", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "color" }, { "padcolor", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "color" },
{ "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"}, { "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
{ "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" }, { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
{ "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" }, { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
{ "qscale", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" }, { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video 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" }, { "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" }, { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
{ "me_threshold", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "threshold" }, { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "threshold" },
{ "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality}, { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},
"use same quantizer as source (implies VBR)" }, "use same quantizer as source (implies VBR)" },
{ "pass", HAS_ARG | OPT_FUNC2 | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" }, { "pass", HAS_ARG | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },
{ "passlogfile", HAS_ARG | OPT_VIDEO, {(void*)&opt_passlogfile}, "select two pass log file name prefix", "prefix" }, { "passlogfile", HAS_ARG | OPT_VIDEO, {(void*)&opt_passlogfile}, "select two pass log file name prefix", "prefix" },
{ "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace}, { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
"deinterlace pictures" }, "deinterlace pictures" },
@ -4418,39 +4433,39 @@ static const OptionDef options[] = {
#endif #endif
{ "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" }, { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
{ "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" }, { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
{ "top", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" }, { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
{ "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" }, { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
{ "vtag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" }, { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" },
{ "newvideo", OPT_VIDEO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new video stream to the current output stream" }, { "newvideo", OPT_VIDEO, {(void*)opt_new_stream}, "add a new video stream to the current output stream" },
{ "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language}, "set the ISO 639 language code (3 letters) of the current video stream" , "code" }, { "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language}, "set the ISO 639 language code (3 letters) of the current video stream" , "code" },
{ "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" }, { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
{ "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" }, { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" },
{ "streamid", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" }, { "streamid", HAS_ARG | OPT_EXPERT, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" },
{ "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" }, { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" },
/* audio options */ /* audio options */
{ "ab", OPT_FUNC2 | HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" }, { "ab", HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
{ "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_TYPE_AUDIO]}, "set the number of audio frames to record", "number" }, { "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_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", }, { "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
{ "ar", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" }, { "ar", HAS_ARG | 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" }, { "ac", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" },
{ "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" }, { "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" }, { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" },
{ "atag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_codec_tag}, "force audio tag/fourcc", "fourcc/tag" }, { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_codec_tag}, "force audio tag/fourcc", "fourcc/tag" },
{ "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, // { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, //
{ "newaudio", OPT_AUDIO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new audio stream to the current output stream" }, { "newaudio", OPT_AUDIO, {(void*)opt_new_stream}, "add a new audio stream to the current output stream" },
{ "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language}, "set the ISO 639 language code (3 letters) of the current audio stream" , "code" }, { "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language}, "set the ISO 639 language code (3 letters) of the current audio stream" , "code" },
{ "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all the sample formats supported", "format" }, { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all the sample formats supported", "format" },
/* subtitle options */ /* subtitle options */
{ "sn", OPT_BOOL | OPT_SUBTITLE, {(void*)&subtitle_disable}, "disable subtitle" }, { "sn", OPT_BOOL | OPT_SUBTITLE, {(void*)&subtitle_disable}, "disable subtitle" },
{ "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" }, { "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" },
{ "newsubtitle", OPT_SUBTITLE | OPT_FUNC2, {(void*)opt_new_stream}, "add a new subtitle stream to the current output stream" }, { "newsubtitle", OPT_SUBTITLE, {(void*)opt_new_stream}, "add a new subtitle stream to the current output stream" },
{ "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void *)&subtitle_language}, "set the ISO 639 language code (3 letters) of the current subtitle stream" , "code" }, { "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void *)&subtitle_language}, "set the ISO 639 language code (3 letters) of the current subtitle stream" , "code" },
{ "stag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" }, { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" },
/* grab options */ /* grab options */
{ "vc", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" }, { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" },
{ "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_standard}, "set television standard (NTSC, PAL (SECAM))", "standard" }, { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_standard}, "set television standard (NTSC, PAL (SECAM))", "standard" },
{ "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" }, { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" },
@ -4458,18 +4473,18 @@ static const OptionDef options[] = {
{ "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_max_delay}, "set the maximum demux-decode delay", "seconds" }, { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_max_delay}, "set the maximum demux-decode delay", "seconds" },
{ "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_preload}, "set the initial demux-decode delay", "seconds" }, { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_preload}, "set the initial demux-decode delay", "seconds" },
{ "absf", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" }, { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
{ "vbsf", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" }, { "vbsf", HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
{ "sbsf", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" }, { "sbsf", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
{ "apre", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_preset}, "set the audio options to the indicated preset", "preset" }, { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_preset}, "set the audio options to the indicated preset", "preset" },
{ "vpre", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "set the video options to the indicated preset", "preset" }, { "vpre", HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "set the video options to the indicated preset", "preset" },
{ "spre", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "set the subtitle options to the indicated preset", "preset" }, { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "set the subtitle options to the indicated preset", "preset" },
{ "fpre", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_preset}, "set options from indicated preset file", "filename" }, { "fpre", HAS_ARG | OPT_EXPERT, {(void*)opt_preset}, "set options from indicated preset file", "filename" },
/* data codec support */ /* data codec support */
{ "dcodec", HAS_ARG | OPT_DATA, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" }, { "dcodec", HAS_ARG | OPT_DATA, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" },
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
{ NULL, }, { NULL, },
}; };

@ -2817,16 +2817,17 @@ static void event_loop(void)
} }
} }
static void opt_frame_size(const char *arg) static int opt_frame_size(const char *opt, const char *arg)
{ {
if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) { if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
fprintf(stderr, "Incorrect frame size\n"); fprintf(stderr, "Incorrect frame size\n");
exit(1); return AVERROR(EINVAL);
} }
if ((frame_width % 2) != 0 || (frame_height % 2) != 0) { if ((frame_width % 2) != 0 || (frame_height % 2) != 0) {
fprintf(stderr, "Frame size must be a multiple of 2\n"); fprintf(stderr, "Frame size must be a multiple of 2\n");
exit(1); return AVERROR(EINVAL);
} }
return 0;
} }
static int opt_width(const char *opt, const char *arg) static int opt_width(const char *opt, const char *arg)
@ -2841,18 +2842,20 @@ static int opt_height(const char *opt, const char *arg)
return 0; return 0;
} }
static void opt_format(const char *arg) static int opt_format(const char *opt, const char *arg)
{ {
file_iformat = av_find_input_format(arg); file_iformat = av_find_input_format(arg);
if (!file_iformat) { if (!file_iformat) {
fprintf(stderr, "Unknown input format: %s\n", arg); fprintf(stderr, "Unknown input format: %s\n", arg);
exit(1); return AVERROR(EINVAL);
} }
return 0;
} }
static void opt_frame_pix_fmt(const char *arg) static int opt_frame_pix_fmt(const char *opt, const char *arg)
{ {
frame_pix_fmt = av_get_pix_fmt(arg); frame_pix_fmt = av_get_pix_fmt(arg);
return 0;
} }
static int opt_sync(const char *opt, const char *arg) static int opt_sync(const char *opt, const char *arg)
@ -2915,8 +2918,8 @@ static int opt_show_mode(const char *opt, const char *arg)
static const OptionDef options[] = { static const OptionDef options[] = {
#include "cmdutils_common_opts.h" #include "cmdutils_common_opts.h"
{ "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" }, { "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" },
{ "y", HAS_ARG | OPT_FUNC2, {(void*)opt_height}, "force displayed height", "height" }, { "y", HAS_ARG, {(void*)opt_height}, "force displayed height", "height" },
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" }, { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
{ "fs", OPT_BOOL, {(void*)&is_full_screen}, "force full screen" }, { "fs", OPT_BOOL, {(void*)&is_full_screen}, "force full screen" },
{ "an", OPT_BOOL, {(void*)&audio_disable}, "disable audio" }, { "an", OPT_BOOL, {(void*)&audio_disable}, "disable audio" },
@ -2924,16 +2927,16 @@ static const OptionDef options[] = {
{ "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_AUDIO]}, "select desired audio stream", "stream_number" }, { "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_AUDIO]}, "select desired audio stream", "stream_number" },
{ "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_VIDEO]}, "select desired video stream", "stream_number" }, { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_VIDEO]}, "select desired video stream", "stream_number" },
{ "sst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_SUBTITLE]}, "select desired subtitle stream", "stream_number" }, { "sst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_SUBTITLE]}, "select desired subtitle stream", "stream_number" },
{ "ss", HAS_ARG | OPT_FUNC2, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" }, { "ss", HAS_ARG, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
{ "t", HAS_ARG | OPT_FUNC2, {(void*)&opt_duration}, "play \"duration\" seconds of audio/video", "duration" }, { "t", HAS_ARG, {(void*)&opt_duration}, "play \"duration\" seconds of audio/video", "duration" },
{ "bytes", OPT_INT | HAS_ARG, {(void*)&seek_by_bytes}, "seek by bytes 0=off 1=on -1=auto", "val" }, { "bytes", OPT_INT | HAS_ARG, {(void*)&seek_by_bytes}, "seek by bytes 0=off 1=on -1=auto", "val" },
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" }, { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" }, { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" }, { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
{ "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" }, { "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
{ "debug", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" }, { "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
{ "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" }, { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },
{ "vismv", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" }, { "vismv", HAS_ARG | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" },
{ "fast", OPT_BOOL | OPT_EXPERT, {(void*)&fast}, "non spec compliant optimizations", "" }, { "fast", OPT_BOOL | OPT_EXPERT, {(void*)&fast}, "non spec compliant optimizations", "" },
{ "genpts", OPT_BOOL | OPT_EXPERT, {(void*)&genpts}, "generate pts", "" }, { "genpts", OPT_BOOL | OPT_EXPERT, {(void*)&genpts}, "generate pts", "" },
{ "drp", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&decoder_reorder_pts}, "let decoder reorder pts 0=off 1=on -1=auto", ""}, { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&decoder_reorder_pts}, "let decoder reorder pts 0=off 1=on -1=auto", ""},
@ -2944,8 +2947,8 @@ static const OptionDef options[] = {
{ "idct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&idct}, "set idct algo", "algo" }, { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&idct}, "set idct algo", "algo" },
{ "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_recognition}, "set error detection threshold (0-4)", "threshold" }, { "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_recognition}, "set error detection threshold (0-4)", "threshold" },
{ "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options", "bit_mask" }, { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options", "bit_mask" },
{ "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" }, { "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" }, { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
{ "autoexit", OPT_BOOL | OPT_EXPERT, {(void*)&autoexit}, "exit at the end", "" }, { "autoexit", OPT_BOOL | OPT_EXPERT, {(void*)&autoexit}, "exit at the end", "" },
{ "exitonkeydown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_keydown}, "exit on key down", "" }, { "exitonkeydown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_keydown}, "exit on key down", "" },
{ "exitonmousedown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_mousedown}, "exit on mouse down", "" }, { "exitonmousedown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_mousedown}, "exit on mouse down", "" },
@ -2956,8 +2959,8 @@ static const OptionDef options[] = {
{ "vf", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" }, { "vf", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
#endif #endif
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" }, { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
{ "showmode", HAS_ARG | OPT_FUNC2, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" }, { "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
{ "i", OPT_DUMMY, {NULL}, "ffmpeg compatibility dummy option", ""}, { "i", OPT_DUMMY, {NULL}, "ffmpeg compatibility dummy option", ""},
{ NULL, }, { NULL, },
}; };

@ -329,13 +329,14 @@ static void show_usage(void)
printf("\n"); printf("\n");
} }
static void opt_format(const char *arg) static int opt_format(const char *opt, const char *arg)
{ {
iformat = av_find_input_format(arg); iformat = av_find_input_format(arg);
if (!iformat) { if (!iformat) {
fprintf(stderr, "Unknown input format: %s\n", arg); fprintf(stderr, "Unknown input format: %s\n", arg);
exit(1); return AVERROR(EINVAL);
} }
return 0;
} }
static void opt_input_file(const char *arg) static void opt_input_file(const char *arg)
@ -382,7 +383,7 @@ static const OptionDef options[] = {
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
{ NULL, }, { NULL, },
}; };

Loading…
Cancel
Save