* [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video
@ 2023-12-18 9:57 Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 02/20] fftools/ffmpeg_opt: drop HAS_ARG from auto{scale, rotate} Anton Khirnov
` (18 more replies)
0 siblings, 19 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Otherwise an unitialized stack value would be copied to FPSConvContext.
As it's then never used, it tends not to be a problem in practice,
however it is UB and some compilers warn about it.
---
fftools/ffmpeg_filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 9fc877b437..e219594a4a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -2017,9 +2017,9 @@ static int choose_out_timebase(OutputFilterPriv *ofp, AVFrame *frame)
if (!(tb.num > 0 && tb.den > 0))
tb = frame->time_base;
+ fps->framerate = fr;
finish:
ofp->tb_out = tb;
- fps->framerate = fr;
ofp->tb_out_locked = 1;
return 0;
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 02/20] fftools/ffmpeg_opt: drop HAS_ARG from auto{scale, rotate}
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 03/20] fftools/cmdutils: simplify handling of the HAS_ARG option flag Anton Khirnov
` (17 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
It causes those options to be parsed as either
* -autofoo 0/1 (with an argument)
* -noautofoo (without an argument)
This is unnecessary, confusing, and against the documentation; these are
also the only two bool options that take an argument.
This should not affect the users, as these options are on by default,
and are supposed to be used as -nofoo per the documentation.
---
fftools/ffmpeg_opt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 96d3c56fd7..295a393eba 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1741,11 +1741,9 @@ const OptionDef options[] = {
"select output format used with HW accelerated decoding", "format" },
{ "hwaccels", OPT_EXIT, { .func_arg = show_hwaccels },
"show available HW acceleration methods" },
- { "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) },
+ { "autorotate", OPT_BOOL | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) },
"automatically insert correct rotate filters" },
- { "autoscale", HAS_ARG | OPT_BOOL | OPT_SPEC |
- OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(autoscale) },
+ { "autoscale", OPT_BOOL | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(autoscale) },
"automatically insert a scale filter at the end of the filter graph" },
{ "fix_sub_duration_heartbeat", OPT_VIDEO | OPT_BOOL | OPT_EXPERT |
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fix_sub_duration_heartbeat) },
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 03/20] fftools/cmdutils: simplify handling of the HAS_ARG option flag
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 02/20] fftools/ffmpeg_opt: drop HAS_ARG from auto{scale, rotate} Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 04/20] fftools/ffmpeg_opt: move deprecated options to the end of the list Anton Khirnov
` (16 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
This option flag only carries nontrivial information for options that
call a function, in all other cases its presence can be inferred from
the option type (bool options do not have arguments, all other types do)
and is thus nothing but useless clutter.
Change the option parsing code to infer its value when it can, and drop
the flag from options where it's not needed.
---
fftools/cmdutils.c | 19 ++++--
fftools/ffmpeg_opt.c | 158 +++++++++++++++++++++----------------------
fftools/ffplay.c | 44 ++++++------
fftools/ffprobe.c | 12 ++--
4 files changed, 122 insertions(+), 111 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 86cd3bddb4..f5b3dc7346 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -223,6 +223,17 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
}
#endif /* HAVE_COMMANDLINETOARGVW */
+static int opt_has_arg(const OptionDef *o)
+{
+ if (o->flags & OPT_BOOL)
+ return 0;
+ if (o->flags &
+ (OPT_STRING | OPT_INT | OPT_FLOAT | OPT_INT64 |
+ OPT_SPEC | OPT_TIME | OPT_DOUBLE))
+ return 1;
+ return !!(o->flags & HAS_ARG);
+}
+
static int write_option(void *optctx, const OptionDef *po, const char *opt,
const char *arg)
{
@@ -331,7 +342,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR(EINVAL);
}
- if (po->flags & HAS_ARG && !arg) {
+ if (opt_has_arg(po) && !arg) {
av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'\n", opt);
return AVERROR(EINVAL);
}
@@ -340,7 +351,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
if (ret < 0)
return ret;
- return !!(po->flags & HAS_ARG);
+ return opt_has_arg(po);
}
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
@@ -432,7 +443,7 @@ int locate_option(int argc, char **argv, const OptionDef *options,
(po->name && !strcmp(optname, po->name)))
return i;
- if (!po->name || po->flags & HAS_ARG)
+ if (!po->name || opt_has_arg(po))
i++;
}
return 0;
@@ -770,7 +781,7 @@ do { \
if (po->flags & OPT_EXIT) {
/* optional argument, e.g. -h */
arg = argv[optindex++];
- } else if (po->flags & HAS_ARG) {
+ } else if (opt_has_arg(po)) {
GET_ARG(arg);
} else {
arg = "1";
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 295a393eba..aed20032a8 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1426,7 +1426,7 @@ static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
const OptionDef options[] = {
/* main options */
CMDUTILS_COMMON_OPTIONS
- { "f", HAS_ARG | OPT_STRING | OPT_OFFSET |
+ { "f", OPT_STRING | OPT_OFFSET |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(format) },
"force format", "fmt" },
{ "y", OPT_BOOL, { &file_overwrite },
@@ -1439,13 +1439,13 @@ const OptionDef options[] = {
"Copy unknown stream types" },
{ "recast_media", OPT_BOOL | OPT_EXPERT, { &recast_media },
"allow recasting stream type in order to force a decoder of different media type" },
- { "c", HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "c", OPT_STRING | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) },
"codec name", "codec" },
- { "codec", HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "codec", OPT_STRING | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) },
"codec name", "codec" },
- { "pre", HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "pre", OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(presets) },
"preset name", "preset" },
{ "map", HAS_ARG | OPT_EXPERT | OPT_PERFILE |
@@ -1456,47 +1456,47 @@ const OptionDef options[] = {
{ "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel },
"map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
#endif
- { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "map_metadata", OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(metadata_map) },
"set metadata information of outfile from infile",
"outfile[,metadata]:infile[,metadata]" },
- { "map_chapters", HAS_ARG | OPT_INT | OPT_EXPERT | OPT_OFFSET |
+ { "map_chapters", OPT_INT | OPT_EXPERT | OPT_OFFSET |
OPT_OUTPUT, { .off = OFFSET(chapters_input_file) },
"set chapters mapping", "input_file_index" },
- { "t", HAS_ARG | OPT_TIME | OPT_OFFSET |
+ { "t", OPT_TIME | OPT_OFFSET |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(recording_time) },
"record or transcode \"duration\" seconds of audio/video",
"duration" },
- { "to", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(stop_time) },
+ { "to", OPT_TIME | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(stop_time) },
"record or transcode stop time", "time_stop" },
- { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(limit_filesize) },
+ { "fs", OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(limit_filesize) },
"set the limit file size in bytes", "limit_size" },
- { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET |
+ { "ss", OPT_TIME | OPT_OFFSET |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) },
"set the start time offset", "time_off" },
- { "sseof", HAS_ARG | OPT_TIME | OPT_OFFSET |
+ { "sseof", OPT_TIME | OPT_OFFSET |
OPT_INPUT, { .off = OFFSET(start_time_eof) },
"set the start time offset relative to EOF", "time_off" },
- { "seek_timestamp", HAS_ARG | OPT_INT | OPT_OFFSET |
+ { "seek_timestamp", OPT_INT | OPT_OFFSET |
OPT_INPUT, { .off = OFFSET(seek_timestamp) },
"enable/disable seeking by timestamp with -ss" },
{ "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
OPT_INPUT, { .off = OFFSET(accurate_seek) },
"enable/disable accurate seeking with -ss" },
- { "isync", HAS_ARG | OPT_INT | OPT_OFFSET |
+ { "isync", OPT_INT | OPT_OFFSET |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_sync_ref) },
"Indicate the input index for sync reference", "sync ref" },
- { "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET |
+ { "itsoffset", OPT_TIME | OPT_OFFSET |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_ts_offset) },
"set the input ts offset", "time_off" },
- { "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC |
+ { "itsscale", OPT_DOUBLE | OPT_SPEC |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
"set the input ts scale", "scale" },
{ "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp },
"set the recording timestamp ('now' to set the current time)", "time" },
- { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
+ { "metadata", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
"add metadata", "string=string" },
- { "program", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(program) },
+ { "program", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(program) },
"add program with specified streams", "title=string:st=number..." },
{ "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
OPT_OUTPUT, { .func_arg = opt_data_frames },
@@ -1518,10 +1518,10 @@ const OptionDef options[] = {
{ "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
OPT_INPUT, { .off = OFFSET(rate_emu) },
"read input at native frame rate; equivalent to -readrate 1", "" },
- { "readrate", HAS_ARG | OPT_FLOAT | OPT_OFFSET |
+ { "readrate", OPT_FLOAT | OPT_OFFSET |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate) },
"read input at specified rate", "speed" },
- { "readrate_initial_burst", HAS_ARG | OPT_DOUBLE | OPT_OFFSET |
+ { "readrate_initial_burst", OPT_DOUBLE | OPT_OFFSET |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate_initial_burst) },
"The initial amount of input to burst read before imposing any readrate", "seconds" },
{ "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target },
@@ -1529,7 +1529,7 @@ const OptionDef options[] = {
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
{ "vsync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vsync },
"set video sync method globally; deprecated, use -fps_mode", "" },
- { "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
+ { "frame_drop_threshold", OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
"frame drop threshold", "" },
#if FFMPEG_OPT_ADRIFT_THRESHOLD
{ "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold },
@@ -1539,22 +1539,22 @@ const OptionDef options[] = {
"copy timestamps" },
{ "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero },
"shift input timestamps to start at 0 when using copyts" },
- { "copytb", HAS_ARG | OPT_INT | OPT_EXPERT, { ©_tb },
+ { "copytb", OPT_INT | OPT_EXPERT, { ©_tb },
"copy input stream time base when stream copying", "mode" },
{ "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
OPT_OUTPUT, { .off = OFFSET(shortest) },
"finish encoding within shortest input" },
- { "shortest_buf_duration", HAS_ARG | OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(shortest_buf_duration) },
+ { "shortest_buf_duration", OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(shortest_buf_duration) },
"maximum buffering duration (in seconds) for the -shortest option" },
{ "bitexact", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(bitexact) },
"bitexact mode" },
- { "apad", OPT_STRING | HAS_ARG | OPT_SPEC |
+ { "apad", OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(apad) },
"audio pad", "" },
- { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold },
+ { "dts_delta_threshold", OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold },
"timestamp discontinuity delta threshold", "threshold" },
- { "dts_error_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_error_threshold },
+ { "dts_error_threshold", OPT_FLOAT | OPT_EXPERT, { &dts_error_threshold },
"timestamp error delta threshold", "threshold" },
{ "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error },
"exit on error", "error" },
@@ -1563,14 +1563,14 @@ const OptionDef options[] = {
{ "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(copy_initial_nonkeyframes) },
"copy initial non-keyframes" },
- { "copypriorss", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_prior_start) },
+ { "copypriorss", OPT_INT | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_prior_start) },
"copy or discard frames before start time" },
- { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) },
+ { "frames", OPT_INT64 | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) },
"set the number of frames to output", "number" },
- { "tag", OPT_STRING | HAS_ARG | OPT_SPEC |
+ { "tag", OPT_STRING | OPT_SPEC |
OPT_EXPERT | OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(codec_tags) },
"force codec tag/fourcc", "fourcc/tag" },
- { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
+ { "q", OPT_EXPERT | OPT_DOUBLE |
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) },
"use fixed quality scale (VBR)", "q" },
{ "qscale", HAS_ARG | OPT_EXPERT | OPT_PERFILE |
@@ -1578,17 +1578,17 @@ const OptionDef options[] = {
"use fixed quality scale (VBR)", "q" },
{ "profile", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_profile },
"set profile", "profile" },
- { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
+ { "filter", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
"set stream filtergraph", "filter_graph" },
{ "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
- { "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
+ { "filter_script", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
"read stream filtergraph description from a file", "filename" },
- { "reinit_filter", HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) },
+ { "reinit_filter", OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) },
"reinit filtergraph on input parameter changes", "" },
{ "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
- { "filter_complex_threads", HAS_ARG | OPT_INT, { &filter_complex_nbthreads },
+ { "filter_complex_threads", OPT_INT, { &filter_complex_nbthreads },
"number of threads for -filter_complex" },
{ "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
@@ -1603,62 +1603,62 @@ const OptionDef options[] = {
{ "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
OPT_OUTPUT, { .func_arg = opt_attach },
"add an attachment to the output file", "filename" },
- { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "dump_attachment", OPT_STRING | OPT_SPEC |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) },
"extract an attachment into a file", "filename" },
- { "stream_loop", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_INPUT |
+ { "stream_loop", OPT_INT | OPT_EXPERT | OPT_INPUT |
OPT_OFFSET, { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" },
{ "debug_ts", OPT_BOOL | OPT_EXPERT, { &debug_ts },
"print timestamp debugging info" },
- { "max_error_rate", HAS_ARG | OPT_FLOAT, { &max_error_rate },
+ { "max_error_rate", OPT_FLOAT, { &max_error_rate },
"ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.", "maximum error rate" },
- { "discard", OPT_STRING | HAS_ARG | OPT_SPEC |
+ { "discard", OPT_STRING | OPT_SPEC |
OPT_INPUT, { .off = OFFSET(discard) },
"discard", "" },
- { "disposition", OPT_STRING | HAS_ARG | OPT_SPEC |
+ { "disposition", OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(disposition) },
"disposition", "" },
- { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
+ { "thread_queue_size", OPT_INT | OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(thread_queue_size) },
"set the maximum number of queued packets from the demuxer" },
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(find_stream_info) },
"read and decode the streams to fill missing information with heuristics" },
- { "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { "bits_per_raw_sample", OPT_INT | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(bits_per_raw_sample) },
"set the number of bits per raw sample", "number" },
- { "stats_enc_pre", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre) },
+ { "stats_enc_pre", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre) },
"write encoding stats before encoding" },
- { "stats_enc_post", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post) },
+ { "stats_enc_post", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post) },
"write encoding stats after encoding" },
- { "stats_mux_pre", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats) },
+ { "stats_mux_pre", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats) },
"write packets stats before muxing" },
- { "stats_enc_pre_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre_fmt) },
+ { "stats_enc_pre_fmt", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre_fmt) },
"format of the stats written with -stats_enc_pre" },
- { "stats_enc_post_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post_fmt) },
+ { "stats_enc_post_fmt", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post_fmt) },
"format of the stats written with -stats_enc_post" },
- { "stats_mux_pre_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats_fmt) },
+ { "stats_mux_pre_fmt", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats_fmt) },
"format of the stats written with -stats_mux_pre" },
/* video options */
{ "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },
"set the number of video frames to output", "number" },
- { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "r", OPT_VIDEO | OPT_STRING | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) },
"set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "fpsmax", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "fpsmax", OPT_VIDEO | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(max_frame_rates) },
"set max frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "s", OPT_VIDEO | HAS_ARG | OPT_SUBTITLE | OPT_STRING | OPT_SPEC |
+ { "s", OPT_VIDEO | OPT_SUBTITLE | OPT_STRING | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) },
"set frame size (WxH or abbreviation)", "size" },
- { "aspect", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC |
+ { "aspect", OPT_VIDEO | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(frame_aspect_ratios) },
"set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
- { "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
+ { "pix_fmt", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) },
"set pixel format", "format" },
- { "display_rotation", OPT_VIDEO | HAS_ARG | OPT_DOUBLE | OPT_SPEC |
+ { "display_rotation", OPT_VIDEO | OPT_DOUBLE | OPT_SPEC |
OPT_INPUT, { .off = OFFSET(display_rotations) },
"set pure counter-clockwise rotation in degrees for stream(s)",
"angle" },
@@ -1670,7 +1670,7 @@ const OptionDef options[] = {
"(overrides any display rotation if it is not set)"},
{ "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) },
"disable video" },
- { "rc_override", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
+ { "rc_override", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(rc_overrides) },
"rate control override for specific intervals", "override" },
{ "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT |
@@ -1678,9 +1678,9 @@ const OptionDef options[] = {
"force video codec ('copy' to copy stream)", "codec" },
{ "timecode", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_timecode },
"set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
- { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) },
+ { "pass", OPT_VIDEO | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) },
"select the pass number (1 to 3)", "n" },
- { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC |
+ { "passlogfile", OPT_VIDEO | OPT_STRING | OPT_EXPERT | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(passlogfiles) },
"select two pass log file name prefix", "prefix" },
#if FFMPEG_OPT_PSNR
@@ -1691,21 +1691,21 @@ const OptionDef options[] = {
"dump video coding statistics to file" },
{ "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file },
"dump video coding statistics to file", "file" },
- { "vstats_version", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &vstats_version },
+ { "vstats_version", OPT_VIDEO | OPT_INT | OPT_EXPERT , { &vstats_version },
"Version of the vstats format to use."},
{ "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_filters },
"set video filters", "filter_graph" },
- { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
+ { "intra_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(intra_matrices) },
"specify intra matrix coeffs", "matrix" },
- { "inter_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
+ { "inter_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(inter_matrices) },
"specify inter matrix coeffs", "matrix" },
- { "chroma_intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
+ { "chroma_intra_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) },
"specify intra matrix coeffs", "matrix" },
#if FFMPEG_OPT_TOP
- { "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC |
+ { "top", OPT_VIDEO | OPT_EXPERT | OPT_INT| OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
"deprecated, use the setfield video filter", "" },
#endif
@@ -1716,7 +1716,7 @@ const OptionDef options[] = {
{ "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist },
"deprecated, does nothing" },
#endif
- { "fps_mode", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT |
+ { "fps_mode", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) },
"set framerate mode for matching video streams; overrides vsync" },
{ "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC |
@@ -1725,18 +1725,18 @@ const OptionDef options[] = {
{ "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
OPT_OUTPUT, { .func_arg = opt_streamid },
"set the value of an outfile streamid", "streamIndex:value" },
- { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
+ { "force_key_frames", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(forced_key_frames) },
"force key frames at specified timestamps", "timestamps" },
{ "b", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate },
"video bitrate (please use -b:v)", "bitrate" },
- { "hwaccel", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
+ { "hwaccel", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccels) },
"use HW accelerated decoding", "hwaccel name" },
- { "hwaccel_device", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
+ { "hwaccel_device", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) },
"select a device for HW acceleration", "devicename" },
- { "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
+ { "hwaccel_output_format", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
"select output format used with HW accelerated decoding", "format" },
{ "hwaccels", OPT_EXIT, { .func_arg = show_hwaccels },
@@ -1756,10 +1756,10 @@ const OptionDef options[] = {
"set the number of audio frames to output", "number" },
{ "aq", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_qscale },
"set audio quality (codec-specific)", "quality", },
- { "ar", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC |
+ { "ar", OPT_AUDIO | OPT_INT | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_sample_rate) },
"set audio sampling rate (in Hz)", "rate" },
- { "ac", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC |
+ { "ac", OPT_AUDIO | OPT_INT | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_channels) },
"set number of audio channels", "channels" },
{ "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) },
@@ -1772,18 +1772,18 @@ const OptionDef options[] = {
{ "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
OPT_OUTPUT, { .func_arg = opt_old2new },
"force audio tag/fourcc", "fourcc/tag" },
- { "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
+ { "sample_fmt", OPT_AUDIO | OPT_EXPERT | OPT_SPEC |
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(sample_fmts) },
"set sample format", "format" },
- { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
+ { "channel_layout", OPT_AUDIO | OPT_EXPERT | OPT_SPEC |
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
- { "ch_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
+ { "ch_layout", OPT_AUDIO | OPT_EXPERT | OPT_SPEC |
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
{ "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters },
"set audio filters", "filter_graph" },
- { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
+ { "guess_layout_max", OPT_AUDIO | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
"set the maximum number of channels to try to guess the channel layout" },
/* subtitle options */
@@ -1795,26 +1795,26 @@ const OptionDef options[] = {
, "force subtitle tag/fourcc", "fourcc/tag" },
{ "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT, { .off = OFFSET(fix_sub_duration) },
"fix subtitles duration" },
- { "canvas_size", OPT_SUBTITLE | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) },
+ { "canvas_size", OPT_SUBTITLE | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) },
"set canvas size (WxH or abbreviation)", "size" },
/* muxer options */
- { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_max_delay) },
+ { "muxdelay", OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_max_delay) },
"set the maximum demux-decode delay", "seconds" },
- { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) },
+ { "muxpreload", OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) },
"set the initial demux-decode delay", "seconds" },
{ "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_sdp_file },
"specify a file in which to print sdp information", "file" },
- { "time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(time_bases) },
+ { "time_base", OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(time_bases) },
"set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)", "ratio" },
- { "enc_time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(enc_time_bases) },
+ { "enc_time_base", OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(enc_time_bases) },
"set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
"two special values are defined - "
"0 = use frame rate (video) or sample rate (audio),"
"-1 = match source time base", "ratio" },
- { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) },
+ { "bsf", OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) },
"A comma-separated list of bitstream filters", "bitstream_filters" },
{ "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new },
"deprecated", "audio bitstream_filters" },
@@ -1830,9 +1830,9 @@ const OptionDef options[] = {
{ "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
"set options from indicated preset file", "filename" },
- { "max_muxing_queue_size", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
+ { "max_muxing_queue_size", OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
"maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
- { "muxing_queue_data_threshold", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(muxing_queue_data_threshold) },
+ { "muxing_queue_data_threshold", OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(muxing_queue_data_threshold) },
"set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
/* data codec support */
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 873ee8cc74..3fd016ccaf 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3623,49 +3623,49 @@ static const OptionDef options[] = {
{ "an", OPT_BOOL, { &audio_disable }, "disable audio" },
{ "vn", OPT_BOOL, { &video_disable }, "disable video" },
{ "sn", OPT_BOOL, { &subtitle_disable }, "disable subtitling" },
- { "ast", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
- { "vst", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
- { "sst", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
- { "ss", HAS_ARG | OPT_TIME, { &start_time }, "seek to a given position in seconds", "pos" },
- { "t", HAS_ARG | OPT_TIME, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
- { "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
- { "seek_interval", OPT_FLOAT | HAS_ARG, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
+ { "ast", OPT_STRING | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
+ { "vst", OPT_STRING | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
+ { "sst", OPT_STRING | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
+ { "ss", OPT_TIME, { &start_time }, "seek to a given position in seconds", "pos" },
+ { "t", OPT_TIME, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
+ { "bytes", OPT_INT, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
+ { "seek_interval", OPT_FLOAT, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
{ "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
{ "noborder", OPT_BOOL, { &borderless }, "borderless window" },
{ "alwaysontop", OPT_BOOL, { &alwaysontop }, "window always on top" },
- { "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
+ { "volume", OPT_INT, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
{ "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
{ "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
{ "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
{ "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
- { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
- { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT, { &lowres }, "", "" },
+ { "drp", OPT_INT | OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
+ { "lowres", OPT_INT | OPT_EXPERT, { &lowres }, "", "" },
{ "sync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "autoexit", OPT_BOOL | OPT_EXPERT, { &autoexit }, "exit at the end", "" },
{ "exitonkeydown", OPT_BOOL | OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
{ "exitonmousedown", OPT_BOOL | OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
- { "loop", OPT_INT | HAS_ARG | OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
+ { "loop", OPT_INT | OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
{ "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
{ "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
- { "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" },
- { "left", OPT_INT | HAS_ARG | OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
- { "top", OPT_INT | HAS_ARG | OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
+ { "window_title", OPT_STRING, { &window_title }, "set window title", "window title" },
+ { "left", OPT_INT | OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
+ { "top", OPT_INT | OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
{ "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
- { "af", OPT_STRING | HAS_ARG, { &afilters }, "set audio filters", "filter_graph" },
- { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
+ { "af", OPT_STRING, { &afilters }, "set audio filters", "filter_graph" },
+ { "rdftspeed", OPT_INT | OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
{ "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
{ "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
- { "acodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
- { "scodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
- { "vcodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
+ { "acodec", OPT_STRING | OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
+ { "scodec", OPT_STRING | OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
+ { "vcodec", OPT_STRING | OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
{ "autorotate", OPT_BOOL, { &autorotate }, "automatically rotate video", "" },
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
- { "filter_threads", HAS_ARG | OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
+ { "filter_threads", OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
{ "enable_vulkan", OPT_BOOL, { &enable_vulkan }, "enable vulkan renderer" },
- { "vulkan_params", HAS_ARG | OPT_STRING | OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
- { "hwaccel", HAS_ARG | OPT_STRING | OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
+ { "vulkan_params", OPT_STRING | OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
+ { "hwaccel", OPT_STRING | OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
{ NULL, },
};
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 71f6cc3a74..9968603e76 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -4087,21 +4087,21 @@ static const OptionDef real_options[] = {
"use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
{ "pretty", 0, {.func_arg = opt_pretty},
"prettify the format of displayed values, make it more human readable" },
- { "output_format", OPT_STRING | HAS_ARG, { &output_format },
+ { "output_format", OPT_STRING, { &output_format },
"set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
- { "print_format", OPT_STRING | HAS_ARG, { &output_format }, "alias for -output_format (deprecated)" },
- { "of", OPT_STRING | HAS_ARG, { &output_format }, "alias for -output_format", "format" },
- { "select_streams", OPT_STRING | HAS_ARG, { &stream_specifier }, "select the specified streams", "stream_specifier" },
+ { "print_format", OPT_STRING, { &output_format }, "alias for -output_format (deprecated)" },
+ { "of", OPT_STRING, { &output_format }, "alias for -output_format", "format" },
+ { "select_streams", OPT_STRING, { &stream_specifier }, "select the specified streams", "stream_specifier" },
{ "sections", OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
{ "show_data", OPT_BOOL, { &do_show_data }, "show packets data" },
- { "show_data_hash", OPT_STRING | HAS_ARG, { &show_data_hash }, "show packets data hash" },
+ { "show_data_hash", OPT_STRING, { &show_data_hash }, "show packets data hash" },
{ "show_error", 0, { .func_arg = &opt_show_error }, "show probing error" },
{ "show_format", 0, { .func_arg = &opt_show_format }, "show format/container info" },
{ "show_frames", 0, { .func_arg = &opt_show_frames }, "show frames info" },
{ "show_entries", HAS_ARG, {.func_arg = opt_show_entries},
"show a set of specified entries", "entry_list" },
#if HAVE_THREADS
- { "show_log", OPT_INT|HAS_ARG, { &do_show_log }, "show log" },
+ { "show_log", OPT_INT, { &do_show_log }, "show log" },
#endif
{ "show_packets", 0, { .func_arg = &opt_show_packets }, "show packets info" },
{ "show_programs", 0, { .func_arg = &opt_show_programs }, "show programs info" },
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 04/20] fftools/ffmpeg_opt: move deprecated options to the end of the list
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 02/20] fftools/ffmpeg_opt: drop HAS_ARG from auto{scale, rotate} Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 03/20] fftools/cmdutils: simplify handling of the HAS_ARG option flag Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 05/20] fftools: split off option types from other flags Anton Khirnov
` (15 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
This way they don't clutter this already-cluttered code even further.
---
fftools/ffmpeg_opt.c | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index aed20032a8..b545c42818 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1452,10 +1452,6 @@ const OptionDef options[] = {
OPT_OUTPUT, { .func_arg = opt_map },
"set input stream mapping",
"[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
-#if FFMPEG_OPT_MAP_CHANNEL
- { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel },
- "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
-#endif
{ "map_metadata", OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(metadata_map) },
"set metadata information of outfile from infile",
@@ -1531,10 +1527,6 @@ const OptionDef options[] = {
"set video sync method globally; deprecated, use -fps_mode", "" },
{ "frame_drop_threshold", OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
"frame drop threshold", "" },
-#if FFMPEG_OPT_ADRIFT_THRESHOLD
- { "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold },
- "deprecated, does nothing", "threshold" },
-#endif
{ "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts },
"copy timestamps" },
{ "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero },
@@ -1683,10 +1675,6 @@ const OptionDef options[] = {
{ "passlogfile", OPT_VIDEO | OPT_STRING | OPT_EXPERT | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(passlogfiles) },
"select two pass log file name prefix", "prefix" },
-#if FFMPEG_OPT_PSNR
- { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr },
- "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
-#endif
{ "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats },
"dump video coding statistics to file" },
{ "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file },
@@ -1704,18 +1692,9 @@ const OptionDef options[] = {
{ "chroma_intra_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) },
"specify intra matrix coeffs", "matrix" },
-#if FFMPEG_OPT_TOP
- { "top", OPT_VIDEO | OPT_EXPERT | OPT_INT| OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
- "deprecated, use the setfield video filter", "" },
-#endif
{ "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new },
"force video tag/fourcc", "fourcc/tag" },
-#if FFMPEG_OPT_QPHIST
- { "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist },
- "deprecated, does nothing" },
-#endif
{ "fps_mode", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) },
"set framerate mode for matching video streams; overrides vsync" },
@@ -1856,5 +1835,28 @@ const OptionDef options[] = {
{ "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_hw_device },
"set hardware device used when filtering", "device" },
+ // deprecated options
+#if FFMPEG_OPT_MAP_CHANNEL
+ { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel },
+ "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
+#endif
+#if FFMPEG_OPT_ADRIFT_THRESHOLD
+ { "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold },
+ "deprecated, does nothing", "threshold" },
+#endif
+#if FFMPEG_OPT_PSNR
+ { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr },
+ "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
+#endif
+#if FFMPEG_OPT_TOP
+ { "top", OPT_VIDEO | OPT_EXPERT | OPT_INT| OPT_SPEC |
+ OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
+ "deprecated, use the setfield video filter", "" },
+#endif
+#if FFMPEG_OPT_QPHIST
+ { "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist },
+ "deprecated, does nothing" },
+#endif
+
{ NULL, },
};
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 05/20] fftools: split off option types from other flags
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (2 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 04/20] fftools/ffmpeg_opt: move deprecated options to the end of the list Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 06/20] fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG Anton Khirnov
` (14 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
These values are not actually flags, as only one of them can be
meaningfully set.
---
fftools/cmdutils.c | 51 ++--
fftools/cmdutils.h | 21 +-
fftools/ffmpeg_opt.c | 557 +++++++++++++++++++++++++------------------
fftools/ffplay.c | 102 ++++----
fftools/ffprobe.c | 76 +++---
fftools/opt_common.h | 62 ++---
6 files changed, 488 insertions(+), 381 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f5b3dc7346..8ff69cabf5 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -83,7 +83,7 @@ void init_dynload(void)
#endif
}
-int parse_number(const char *context, const char *numstr, int type,
+int parse_number(const char *context, const char *numstr, enum OptionType type,
double min, double max, double *dst)
{
char *tail;
@@ -93,9 +93,9 @@ int parse_number(const char *context, const char *numstr, int type,
error = "Expected number for %s but found: %s\n";
else if (d < min || d > max)
error = "The value for %s was %s which is not within %f - %f\n";
- else if (type == OPT_INT64 && (int64_t)d != d)
+ else if (type == OPT_TYPE_INT64 && (int64_t)d != d)
error = "Expected int64 for %s but found %s\n";
- else if (type == OPT_INT && (int)d != d)
+ else if (type == OPT_TYPE_INT && (int)d != d)
error = "Expected int for %s but found %s\n";
else {
*dst = d;
@@ -225,13 +225,11 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
static int opt_has_arg(const OptionDef *o)
{
- if (o->flags & OPT_BOOL)
+ if (o->type == OPT_TYPE_BOOL)
return 0;
- if (o->flags &
- (OPT_STRING | OPT_INT | OPT_FLOAT | OPT_INT64 |
- OPT_SPEC | OPT_TIME | OPT_DOUBLE))
- return 1;
- return !!(o->flags & HAS_ARG);
+ if (o->type == OPT_TYPE_FUNC)
+ return !!(o->flags & HAS_ARG);
+ return 1;
}
static int write_option(void *optctx, const OptionDef *po, const char *opt,
@@ -262,46 +260,50 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
dst = &(*so)[*dstcount - 1].u;
}
- if (po->flags & OPT_STRING) {
+ if (po->type == OPT_TYPE_STRING) {
char *str;
str = av_strdup(arg);
av_freep(dst);
if (!str)
return AVERROR(ENOMEM);
*(char **)dst = str;
- } else if (po->flags & OPT_BOOL || po->flags & OPT_INT) {
- ret = parse_number(opt, arg, OPT_INT64, INT_MIN, INT_MAX, &num);
+ } else if (po->type == OPT_TYPE_BOOL || po->type == OPT_TYPE_INT) {
+ ret = parse_number(opt, arg, OPT_TYPE_INT64, INT_MIN, INT_MAX, &num);
if (ret < 0)
return ret;
*(int *)dst = num;
- } else if (po->flags & OPT_INT64) {
- ret = parse_number(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX, &num);
+ } else if (po->type == OPT_TYPE_INT64) {
+ ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, INT64_MAX, &num);
if (ret < 0)
return ret;
*(int64_t *)dst = num;
- } else if (po->flags & OPT_TIME) {
+ } else if (po->type == OPT_TYPE_TIME) {
ret = av_parse_time(dst, arg, 1);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Invalid duration for option %s: %s\n",
opt, arg);
return ret;
}
- } else if (po->flags & OPT_FLOAT) {
- ret = parse_number(opt, arg, OPT_FLOAT, -INFINITY, INFINITY, &num);
+ } else if (po->type == OPT_TYPE_FLOAT) {
+ ret = parse_number(opt, arg, OPT_TYPE_FLOAT, -INFINITY, INFINITY, &num);
if (ret < 0)
return ret;
*(float *)dst = num;
- } else if (po->flags & OPT_DOUBLE) {
- ret = parse_number(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY, &num);
+ } else if (po->type == OPT_TYPE_DOUBLE) {
+ ret = parse_number(opt, arg, OPT_TYPE_DOUBLE, -INFINITY, INFINITY, &num);
if (ret < 0)
return ret;
*(double *)dst = num;
- } else if (po->u.func_arg) {
- int ret = po->u.func_arg(optctx, opt, arg);
+ } else {
+ int ret;
+
+ av_assert0(po->type == OPT_TYPE_FUNC && po->u.func_arg);
+
+ 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': %s\n",
@@ -320,6 +322,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
{
static const OptionDef opt_avoptions = {
.name = "AVOption passthrough",
+ .type = OPT_TYPE_FUNC,
.flags = HAS_ARG,
.u.func_arg = opt_default,
};
@@ -331,9 +334,9 @@ int parse_option(void *optctx, const char *opt, const char *arg,
if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
/* handle 'no' bool option */
po = find_option(options, opt + 2);
- if ((po->name && (po->flags & OPT_BOOL)))
+ if ((po->name && po->type == OPT_TYPE_BOOL))
arg = "0";
- } else if (po->flags & OPT_BOOL)
+ } else if (po->type == OPT_TYPE_BOOL)
arg = "1";
if (!po->name)
@@ -814,7 +817,7 @@ do { \
/* boolean -nofoo options */
if (opt[0] == 'n' && opt[1] == 'o' &&
(po = find_option(options, opt + 2)) &&
- po->name && po->flags & OPT_BOOL) {
+ po->name && po->type == OPT_TYPE_BOOL) {
ret = add_opt(octx, po, opt, "0");
if (ret < 0)
return ret;
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 85479f90e4..b9ef8b5c15 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -77,6 +77,17 @@ int opt_default(void *optctx, const char *opt, const char *arg);
*/
int opt_timelimit(void *optctx, const char *opt, const char *arg);
+enum OptionType {
+ OPT_TYPE_FUNC,
+ OPT_TYPE_BOOL,
+ OPT_TYPE_STRING,
+ OPT_TYPE_INT,
+ OPT_TYPE_INT64,
+ OPT_TYPE_FLOAT,
+ OPT_TYPE_DOUBLE,
+ OPT_TYPE_TIME,
+};
+
/**
* Parse a string and return its corresponding value as a double.
*
@@ -88,7 +99,7 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg);
* @param min the minimum valid accepted value
* @param max the maximum valid accepted value
*/
-int parse_number(const char *context, const char *numstr, int type,
+int parse_number(const char *context, const char *numstr, enum OptionType type,
double min, double max, double *dst);
typedef struct SpecifierOpt {
@@ -105,17 +116,13 @@ typedef struct SpecifierOpt {
typedef struct OptionDef {
const char *name;
+ enum OptionType type;
int flags;
#define HAS_ARG (1 << 0)
-#define OPT_BOOL (1 << 1)
#define OPT_EXPERT (1 << 2)
-#define OPT_STRING (1 << 3)
#define OPT_VIDEO (1 << 4)
#define OPT_AUDIO (1 << 5)
-#define OPT_INT (1 << 6)
-#define OPT_FLOAT (1 << 7)
#define OPT_SUBTITLE (1 << 8)
-#define OPT_INT64 (1 << 9)
#define OPT_EXIT (1 << 10)
#define OPT_DATA (1 << 11)
/* The option is per-file (currently ffmpeg-only).
@@ -127,8 +134,6 @@ typedef struct OptionDef {
Next element after the offset is an int containing element count in the
array. */
#define OPT_SPEC (1 << 14)
-#define OPT_TIME (1 << 15)
-#define OPT_DOUBLE (1 << 16)
#define OPT_INPUT (1 << 17)
#define OPT_OUTPUT (1 << 18)
union {
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index b545c42818..752d5980b7 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -105,7 +105,7 @@ static void uninit_options(OptionsContext *o)
const OptionDef *po = options;
int i;
- /* all OPT_SPEC and OPT_STRING can be freed in generic way */
+ /* all OPT_SPEC and OPT_TYPE_STRING can be freed in generic way */
while (po->name) {
void *dst = (uint8_t*)o + po->u.off;
@@ -114,12 +114,12 @@ static void uninit_options(OptionsContext *o)
int i, *count = (int*)(so + 1);
for (i = 0; i < *count; i++) {
av_freep(&(*so)[i].specifier);
- if (po->flags & OPT_STRING)
+ if (po->type == OPT_TYPE_STRING)
av_freep(&(*so)[i].u.str);
}
av_freep(so);
*count = 0;
- } else if (po->flags & OPT_OFFSET && po->flags & OPT_STRING)
+ } else if (po->flags & OPT_OFFSET && po->type == OPT_TYPE_STRING)
av_freep(dst);
po++;
}
@@ -204,7 +204,7 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
int ret;
double num;
- ret = parse_number("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR, &num);
+ ret = parse_number("vsync", arg, OPT_TYPE_INT, VSYNC_AUTO, VSYNC_VFR, &num);
if (ret < 0)
return ret;
@@ -1393,7 +1393,7 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg)
double lim;
struct rlimit rl;
- ret = parse_number(opt, arg, OPT_INT64, 0, INT_MAX, &lim);
+ ret = parse_number(opt, arg, OPT_TYPE_INT64, 0, INT_MAX, &lim);
if (ret < 0)
return ret;
@@ -1426,435 +1426,534 @@ static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
const OptionDef options[] = {
/* main options */
CMDUTILS_COMMON_OPTIONS
- { "f", OPT_STRING | OPT_OFFSET |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(format) },
+ { "f", OPT_TYPE_STRING, OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(format) },
"force format", "fmt" },
- { "y", OPT_BOOL, { &file_overwrite },
+ { "y", OPT_TYPE_BOOL, 0,
+ { &file_overwrite },
"overwrite output files" },
- { "n", OPT_BOOL, { &no_file_overwrite },
+ { "n", OPT_TYPE_BOOL, 0,
+ { &no_file_overwrite },
"never overwrite output files" },
- { "ignore_unknown", OPT_BOOL, { &ignore_unknown_streams },
+ { "ignore_unknown", OPT_TYPE_BOOL, 0,
+ { &ignore_unknown_streams },
"Ignore unknown stream types" },
- { "copy_unknown", OPT_BOOL | OPT_EXPERT, { ©_unknown_streams },
+ { "copy_unknown", OPT_TYPE_BOOL, OPT_EXPERT,
+ { ©_unknown_streams },
"Copy unknown stream types" },
- { "recast_media", OPT_BOOL | OPT_EXPERT, { &recast_media },
+ { "recast_media", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &recast_media },
"allow recasting stream type in order to force a decoder of different media type" },
- { "c", OPT_STRING | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) },
+ { "c", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(codec_names) },
"codec name", "codec" },
- { "codec", OPT_STRING | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) },
+ { "codec", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(codec_names) },
"codec name", "codec" },
- { "pre", OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(presets) },
+ { "pre", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(presets) },
"preset name", "preset" },
- { "map", HAS_ARG | OPT_EXPERT | OPT_PERFILE |
- OPT_OUTPUT, { .func_arg = opt_map },
+ { "map", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_map },
"set input stream mapping",
"[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
- { "map_metadata", OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(metadata_map) },
+ { "map_metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(metadata_map) },
"set metadata information of outfile from infile",
"outfile[,metadata]:infile[,metadata]" },
- { "map_chapters", OPT_INT | OPT_EXPERT | OPT_OFFSET |
- OPT_OUTPUT, { .off = OFFSET(chapters_input_file) },
+ { "map_chapters", OPT_TYPE_INT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
+ { .off = OFFSET(chapters_input_file) },
"set chapters mapping", "input_file_index" },
- { "t", OPT_TIME | OPT_OFFSET |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(recording_time) },
+ { "t", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(recording_time) },
"record or transcode \"duration\" seconds of audio/video",
"duration" },
- { "to", OPT_TIME | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(stop_time) },
+ { "to", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(stop_time) },
"record or transcode stop time", "time_stop" },
- { "fs", OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(limit_filesize) },
+ { "fs", OPT_TYPE_INT64, OPT_OFFSET | OPT_OUTPUT,
+ { .off = OFFSET(limit_filesize) },
"set the limit file size in bytes", "limit_size" },
- { "ss", OPT_TIME | OPT_OFFSET |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) },
+ { "ss", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(start_time) },
"set the start time offset", "time_off" },
- { "sseof", OPT_TIME | OPT_OFFSET |
- OPT_INPUT, { .off = OFFSET(start_time_eof) },
+ { "sseof", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT,
+ { .off = OFFSET(start_time_eof) },
"set the start time offset relative to EOF", "time_off" },
- { "seek_timestamp", OPT_INT | OPT_OFFSET |
- OPT_INPUT, { .off = OFFSET(seek_timestamp) },
+ { "seek_timestamp", OPT_TYPE_INT, OPT_OFFSET | OPT_INPUT,
+ { .off = OFFSET(seek_timestamp) },
"enable/disable seeking by timestamp with -ss" },
- { "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
- OPT_INPUT, { .off = OFFSET(accurate_seek) },
+ { "accurate_seek", OPT_TYPE_BOOL, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(accurate_seek) },
"enable/disable accurate seeking with -ss" },
- { "isync", OPT_INT | OPT_OFFSET |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_sync_ref) },
+ { "isync", OPT_TYPE_INT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(input_sync_ref) },
"Indicate the input index for sync reference", "sync ref" },
- { "itsoffset", OPT_TIME | OPT_OFFSET |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_ts_offset) },
+ { "itsoffset", OPT_TYPE_TIME, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(input_ts_offset) },
"set the input ts offset", "time_off" },
- { "itsscale", OPT_DOUBLE | OPT_SPEC |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
+ { "itsscale", OPT_TYPE_DOUBLE, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(ts_scale) },
"set the input ts scale", "scale" },
- { "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp },
+ { "timestamp", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_recording_timestamp },
"set the recording timestamp ('now' to set the current time)", "time" },
- { "metadata", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
+ { "metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(metadata) },
"add metadata", "string=string" },
- { "program", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(program) },
+ { "program", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(program) },
"add program with specified streams", "title=string:st=number..." },
- { "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
- OPT_OUTPUT, { .func_arg = opt_data_frames },
+ { "dframes", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
+ { .func_arg = opt_data_frames },
"set the number of data frames to output", "number" },
- { "benchmark", OPT_BOOL | OPT_EXPERT, { &do_benchmark },
+ { "benchmark", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &do_benchmark },
"add timings for benchmarking" },
- { "benchmark_all", OPT_BOOL | OPT_EXPERT, { &do_benchmark_all },
+ { "benchmark_all", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &do_benchmark_all },
"add timings for each task" },
- { "progress", HAS_ARG | OPT_EXPERT, { .func_arg = opt_progress },
+ { "progress", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_progress },
"write program-readable progress information", "url" },
- { "stdin", OPT_BOOL | OPT_EXPERT, { &stdin_interaction },
+ { "stdin", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &stdin_interaction },
"enable or disable interaction on standard input" },
- { "timelimit", HAS_ARG | OPT_EXPERT, { .func_arg = opt_timelimit },
+ { "timelimit", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_timelimit },
"set max runtime in seconds in CPU user time", "limit" },
- { "dump", OPT_BOOL | OPT_EXPERT, { &do_pkt_dump },
+ { "dump", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &do_pkt_dump },
"dump each input packet" },
- { "hex", OPT_BOOL | OPT_EXPERT, { &do_hex_dump },
+ { "hex", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &do_hex_dump },
"when dumping packets, also dump the payload" },
- { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
- OPT_INPUT, { .off = OFFSET(rate_emu) },
+ { "re", OPT_TYPE_BOOL, OPT_EXPERT | OPT_OFFSET | OPT_INPUT,
+ { .off = OFFSET(rate_emu) },
"read input at native frame rate; equivalent to -readrate 1", "" },
- { "readrate", OPT_FLOAT | OPT_OFFSET |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate) },
+ { "readrate", OPT_TYPE_FLOAT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(readrate) },
"read input at specified rate", "speed" },
- { "readrate_initial_burst", OPT_DOUBLE | OPT_OFFSET |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate_initial_burst) },
+ { "readrate_initial_burst", OPT_TYPE_DOUBLE, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(readrate_initial_burst) },
"The initial amount of input to burst read before imposing any readrate", "seconds" },
- { "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target },
+ { "target", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_target },
"specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
- { "vsync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vsync },
+ { "vsync", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_vsync },
"set video sync method globally; deprecated, use -fps_mode", "" },
- { "frame_drop_threshold", OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
+ { "frame_drop_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
+ { &frame_drop_threshold },
"frame drop threshold", "" },
- { "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts },
+ { "copyts", OPT_TYPE_BOOL, OPT_EXPERT,
+ { ©_ts },
"copy timestamps" },
- { "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero },
+ { "start_at_zero", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &start_at_zero },
"shift input timestamps to start at 0 when using copyts" },
- { "copytb", OPT_INT | OPT_EXPERT, { ©_tb },
+ { "copytb", OPT_TYPE_INT, OPT_EXPERT,
+ { ©_tb },
"copy input stream time base when stream copying", "mode" },
- { "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
- OPT_OUTPUT, { .off = OFFSET(shortest) },
+ { "shortest", OPT_TYPE_BOOL, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
+ { .off = OFFSET(shortest) },
"finish encoding within shortest input" },
- { "shortest_buf_duration", OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(shortest_buf_duration) },
+ { "shortest_buf_duration", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
+ { .off = OFFSET(shortest_buf_duration) },
"maximum buffering duration (in seconds) for the -shortest option" },
- { "bitexact", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
- OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(bitexact) },
+ { "bitexact", OPT_TYPE_BOOL, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT | OPT_INPUT,
+ { .off = OFFSET(bitexact) },
"bitexact mode" },
- { "apad", OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(apad) },
+ { "apad", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(apad) },
"audio pad", "" },
- { "dts_delta_threshold", OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold },
+ { "dts_delta_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
+ { &dts_delta_threshold },
"timestamp discontinuity delta threshold", "threshold" },
- { "dts_error_threshold", OPT_FLOAT | OPT_EXPERT, { &dts_error_threshold },
+ { "dts_error_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
+ { &dts_error_threshold },
"timestamp error delta threshold", "threshold" },
- { "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error },
+ { "xerror", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &exit_on_error },
"exit on error", "error" },
- { "abort_on", HAS_ARG | OPT_EXPERT, { .func_arg = opt_abort_on },
+ { "abort_on", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_abort_on },
"abort on the specified condition flags", "flags" },
- { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(copy_initial_nonkeyframes) },
+ { "copyinkf", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(copy_initial_nonkeyframes) },
"copy initial non-keyframes" },
- { "copypriorss", OPT_INT | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_prior_start) },
+ { "copypriorss", OPT_TYPE_INT, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(copy_prior_start) },
"copy or discard frames before start time" },
- { "frames", OPT_INT64 | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) },
+ { "frames", OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(max_frames) },
"set the number of frames to output", "number" },
- { "tag", OPT_STRING | OPT_SPEC |
- OPT_EXPERT | OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(codec_tags) },
+ { "tag", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT,
+ { .off = OFFSET(codec_tags) },
"force codec tag/fourcc", "fourcc/tag" },
- { "q", OPT_EXPERT | OPT_DOUBLE |
- OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) },
+ { "q", OPT_TYPE_DOUBLE, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(qscale) },
"use fixed quality scale (VBR)", "q" },
- { "qscale", HAS_ARG | OPT_EXPERT | OPT_PERFILE |
- OPT_OUTPUT, { .func_arg = opt_qscale },
+ { "qscale", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_qscale },
"use fixed quality scale (VBR)", "q" },
- { "profile", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_profile },
+ { "profile", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_profile },
"set profile", "profile" },
- { "filter", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
+ { "filter", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(filters) },
"set stream filtergraph", "filter_graph" },
- { "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads },
+ { "filter_threads", OPT_TYPE_FUNC, HAS_ARG,
+ { .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
- { "filter_script", OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
+ { "filter_script", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(filter_scripts) },
"read stream filtergraph description from a file", "filename" },
- { "reinit_filter", OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) },
+ { "reinit_filter", OPT_TYPE_INT, OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(reinit_filters) },
"reinit filtergraph on input parameter changes", "" },
- { "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
+ { "filter_complex", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
- { "filter_complex_threads", OPT_INT, { &filter_complex_nbthreads },
+ { "filter_complex_threads", OPT_TYPE_INT, 0,
+ { &filter_complex_nbthreads },
"number of threads for -filter_complex" },
- { "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
+ { "lavfi", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
- { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script },
+ { "filter_complex_script", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_filter_complex_script },
"read complex filtergraph description from a file", "filename" },
- { "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters },
+ { "auto_conversion_filters", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &auto_conversion_filters },
"enable automatic conversion filters globally" },
- { "stats", OPT_BOOL, { &print_stats },
+ { "stats", OPT_TYPE_BOOL, 0,
+ { &print_stats },
"print progress report during encoding", },
- { "stats_period", HAS_ARG | OPT_EXPERT, { .func_arg = opt_stats_period },
+ { "stats_period", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_stats_period },
"set the period at which ffmpeg updates stats and -progress output", "time" },
- { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
- OPT_OUTPUT, { .func_arg = opt_attach },
+ { "attach", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
+ { .func_arg = opt_attach },
"add an attachment to the output file", "filename" },
- { "dump_attachment", OPT_STRING | OPT_SPEC |
- OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) },
+ { "dump_attachment", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(dump_attachment) },
"extract an attachment into a file", "filename" },
- { "stream_loop", OPT_INT | OPT_EXPERT | OPT_INPUT |
- OPT_OFFSET, { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" },
- { "debug_ts", OPT_BOOL | OPT_EXPERT, { &debug_ts },
+ { "stream_loop", OPT_TYPE_INT, OPT_EXPERT | OPT_INPUT | OPT_OFFSET,
+ { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" },
+ { "debug_ts", OPT_TYPE_BOOL, OPT_EXPERT,
+ { &debug_ts },
"print timestamp debugging info" },
- { "max_error_rate", OPT_FLOAT, { &max_error_rate },
+ { "max_error_rate", OPT_TYPE_FLOAT, 0,
+ { &max_error_rate },
"ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.", "maximum error rate" },
- { "discard", OPT_STRING | OPT_SPEC |
- OPT_INPUT, { .off = OFFSET(discard) },
+ { "discard", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(discard) },
"discard", "" },
- { "disposition", OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(disposition) },
+ { "disposition", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(disposition) },
"disposition", "" },
- { "thread_queue_size", OPT_INT | OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
- { .off = OFFSET(thread_queue_size) },
+ { "thread_queue_size", OPT_TYPE_INT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(thread_queue_size) },
"set the maximum number of queued packets from the demuxer" },
- { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(find_stream_info) },
+ { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT | OPT_OFFSET,
+ { .off = OFFSET(find_stream_info) },
"read and decode the streams to fill missing information with heuristics" },
- { "bits_per_raw_sample", OPT_INT | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { "bits_per_raw_sample", OPT_TYPE_INT, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(bits_per_raw_sample) },
"set the number of bits per raw sample", "number" },
- { "stats_enc_pre", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre) },
+ { "stats_enc_pre", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(enc_stats_pre) },
"write encoding stats before encoding" },
- { "stats_enc_post", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post) },
+ { "stats_enc_post", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(enc_stats_post) },
"write encoding stats after encoding" },
- { "stats_mux_pre", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats) },
+ { "stats_mux_pre", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(mux_stats) },
"write packets stats before muxing" },
- { "stats_enc_pre_fmt", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre_fmt) },
+ { "stats_enc_pre_fmt", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(enc_stats_pre_fmt) },
"format of the stats written with -stats_enc_pre" },
- { "stats_enc_post_fmt", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post_fmt) },
+ { "stats_enc_post_fmt", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(enc_stats_post_fmt) },
"format of the stats written with -stats_enc_post" },
- { "stats_mux_pre_fmt", OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats_fmt) },
+ { "stats_mux_pre_fmt", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(mux_stats_fmt) },
"format of the stats written with -stats_mux_pre" },
/* video options */
- { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },
+ { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_video_frames },
"set the number of video frames to output", "number" },
- { "r", OPT_VIDEO | OPT_STRING | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) },
+ { "r", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(frame_rates) },
"set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "fpsmax", OPT_VIDEO | OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(max_frame_rates) },
+ { "fpsmax", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(max_frame_rates) },
"set max frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "s", OPT_VIDEO | OPT_SUBTITLE | OPT_STRING | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) },
+ { "s", OPT_TYPE_STRING, OPT_VIDEO | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(frame_sizes) },
"set frame size (WxH or abbreviation)", "size" },
- { "aspect", OPT_VIDEO | OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(frame_aspect_ratios) },
+ { "aspect", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(frame_aspect_ratios) },
"set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
- { "pix_fmt", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) },
+ { "pix_fmt", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(frame_pix_fmts) },
"set pixel format", "format" },
- { "display_rotation", OPT_VIDEO | OPT_DOUBLE | OPT_SPEC |
- OPT_INPUT, { .off = OFFSET(display_rotations) },
+ { "display_rotation", OPT_TYPE_DOUBLE, OPT_VIDEO | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(display_rotations) },
"set pure counter-clockwise rotation in degrees for stream(s)",
"angle" },
- { "display_hflip", OPT_VIDEO | OPT_BOOL | OPT_SPEC | OPT_INPUT, { .off = OFFSET(display_hflips) },
+ { "display_hflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(display_hflips) },
"set display horizontal flip for stream(s) "
"(overrides any display rotation if it is not set)"},
- { "display_vflip", OPT_VIDEO | OPT_BOOL | OPT_SPEC | OPT_INPUT, { .off = OFFSET(display_vflips) },
+ { "display_vflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(display_vflips) },
"set display vertical flip for stream(s) "
"(overrides any display rotation if it is not set)"},
- { "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) },
+ { "vn", OPT_TYPE_BOOL, OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(video_disable) },
"disable video" },
- { "rc_override", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(rc_overrides) },
+ { "rc_override", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(rc_overrides) },
"rate control override for specific intervals", "override" },
- { "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT |
- OPT_OUTPUT, { .func_arg = opt_video_codec },
+ { "vcodec", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { .func_arg = opt_video_codec },
"force video codec ('copy' to copy stream)", "codec" },
- { "timecode", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_timecode },
+ { "timecode", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_timecode },
"set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
- { "pass", OPT_VIDEO | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) },
+ { "pass", OPT_TYPE_INT, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(pass) },
"select the pass number (1 to 3)", "n" },
- { "passlogfile", OPT_VIDEO | OPT_STRING | OPT_EXPERT | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(passlogfiles) },
+ { "passlogfile", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(passlogfiles) },
"select two pass log file name prefix", "prefix" },
- { "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats },
+ { "vstats", OPT_TYPE_FUNC, OPT_VIDEO | OPT_EXPERT,
+ { .func_arg = opt_vstats },
"dump video coding statistics to file" },
- { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file },
+ { "vstats_file", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_vstats_file },
"dump video coding statistics to file", "file" },
- { "vstats_version", OPT_VIDEO | OPT_INT | OPT_EXPERT , { &vstats_version },
+ { "vstats_version", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT,
+ { &vstats_version },
"Version of the vstats format to use."},
- { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_filters },
+ { "vf", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_video_filters },
"set video filters", "filter_graph" },
- { "intra_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(intra_matrices) },
+ { "intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(intra_matrices) },
"specify intra matrix coeffs", "matrix" },
- { "inter_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(inter_matrices) },
+ { "inter_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(inter_matrices) },
"specify inter matrix coeffs", "matrix" },
- { "chroma_intra_matrix", OPT_VIDEO | OPT_EXPERT | OPT_STRING | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) },
+ { "chroma_intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(chroma_intra_matrices) },
"specify intra matrix coeffs", "matrix" },
- { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
- OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new },
+ { "vtag", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { .func_arg = opt_old2new },
"force video tag/fourcc", "fourcc/tag" },
- { "fps_mode", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
- OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) },
+ { "fps_mode", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(fps_mode) },
"set framerate mode for matching video streams; overrides vsync" },
- { "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC |
- OPT_OUTPUT, { .off = OFFSET(force_fps) },
+ { "force_fps", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(force_fps) },
"force the selected framerate, disable the best supported framerate selection" },
- { "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
- OPT_OUTPUT, { .func_arg = opt_streamid },
+ { "streamid", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_streamid },
"set the value of an outfile streamid", "streamIndex:value" },
- { "force_key_frames", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
- OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(forced_key_frames) },
+ { "force_key_frames", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(forced_key_frames) },
"force key frames at specified timestamps", "timestamps" },
- { "b", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate },
+ { "b", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_bitrate },
"video bitrate (please use -b:v)", "bitrate" },
- { "hwaccel", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
- OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccels) },
+ { "hwaccel", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(hwaccels) },
"use HW accelerated decoding", "hwaccel name" },
- { "hwaccel_device", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
- OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) },
+ { "hwaccel_device", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(hwaccel_devices) },
"select a device for HW acceleration", "devicename" },
- { "hwaccel_output_format", OPT_VIDEO | OPT_STRING | OPT_EXPERT |
- OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
+ { "hwaccel_output_format", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(hwaccel_output_formats) },
"select output format used with HW accelerated decoding", "format" },
- { "hwaccels", OPT_EXIT, { .func_arg = show_hwaccels },
+ { "hwaccels", OPT_TYPE_FUNC, OPT_EXIT,
+ { .func_arg = show_hwaccels },
"show available HW acceleration methods" },
- { "autorotate", OPT_BOOL | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) },
+ { "autorotate", OPT_TYPE_BOOL, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(autorotate) },
"automatically insert correct rotate filters" },
- { "autoscale", OPT_BOOL | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(autoscale) },
+ { "autoscale", OPT_TYPE_BOOL, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(autoscale) },
"automatically insert a scale filter at the end of the filter graph" },
- { "fix_sub_duration_heartbeat", OPT_VIDEO | OPT_BOOL | OPT_EXPERT |
- OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fix_sub_duration_heartbeat) },
+ { "fix_sub_duration_heartbeat", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(fix_sub_duration_heartbeat) },
"set this video output stream to be a heartbeat stream for "
"fix_sub_duration, according to which subtitles should be split at "
"random access points" },
/* audio options */
- { "aframes", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_frames },
+ { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_audio_frames },
"set the number of audio frames to output", "number" },
- { "aq", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_qscale },
+ { "aq", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_audio_qscale },
"set audio quality (codec-specific)", "quality", },
- { "ar", OPT_AUDIO | OPT_INT | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_sample_rate) },
+ { "ar", OPT_TYPE_INT, OPT_AUDIO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(audio_sample_rate) },
"set audio sampling rate (in Hz)", "rate" },
- { "ac", OPT_AUDIO | OPT_INT | OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_channels) },
+ { "ac", OPT_TYPE_INT, OPT_AUDIO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(audio_channels) },
"set number of audio channels", "channels" },
- { "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) },
+ { "an", OPT_TYPE_BOOL, OPT_AUDIO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(audio_disable) },
"disable audio" },
- { "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE |
- OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_audio_codec },
+ { "acodec", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { .func_arg = opt_audio_codec },
"force audio codec ('copy' to copy stream)", "codec" },
- { "ab", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate },
+ { "ab", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_bitrate },
"audio bitrate (please use -b:a)", "bitrate" },
- { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
- OPT_OUTPUT, { .func_arg = opt_old2new },
+ { "atag", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_old2new },
"force audio tag/fourcc", "fourcc/tag" },
- { "sample_fmt", OPT_AUDIO | OPT_EXPERT | OPT_SPEC |
- OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(sample_fmts) },
+ { "sample_fmt", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(sample_fmts) },
"set sample format", "format" },
- { "channel_layout", OPT_AUDIO | OPT_EXPERT | OPT_SPEC |
- OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
+ { "channel_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
- { "ch_layout", OPT_AUDIO | OPT_EXPERT | OPT_SPEC |
- OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
+ { "ch_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
- { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters },
+ { "af", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_audio_filters },
"set audio filters", "filter_graph" },
- { "guess_layout_max", OPT_AUDIO | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
+ { "guess_layout_max", OPT_TYPE_INT, OPT_AUDIO | OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+ { .off = OFFSET(guess_layout_max) },
"set the maximum number of channels to try to guess the channel layout" },
/* subtitle options */
- { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(subtitle_disable) },
+ { "sn", OPT_TYPE_BOOL, OPT_SUBTITLE | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(subtitle_disable) },
"disable subtitle" },
- { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_subtitle_codec },
+ { "scodec", OPT_TYPE_FUNC, OPT_SUBTITLE | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { .func_arg = opt_subtitle_codec },
"force subtitle codec ('copy' to copy stream)", "codec" },
- { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new }
+ { "stag", OPT_TYPE_FUNC, OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_old2new }
, "force subtitle tag/fourcc", "fourcc/tag" },
- { "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT, { .off = OFFSET(fix_sub_duration) },
+ { "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(fix_sub_duration) },
"fix subtitles duration" },
- { "canvas_size", OPT_SUBTITLE | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) },
+ { "canvas_size", OPT_TYPE_STRING, OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
+ { .off = OFFSET(canvas_sizes) },
"set canvas size (WxH or abbreviation)", "size" },
/* muxer options */
- { "muxdelay", OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_max_delay) },
+ { "muxdelay", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
+ { .off = OFFSET(mux_max_delay) },
"set the maximum demux-decode delay", "seconds" },
- { "muxpreload", OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) },
+ { "muxpreload", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
+ { .off = OFFSET(mux_preload) },
"set the initial demux-decode delay", "seconds" },
- { "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_sdp_file },
+ { "sdp_file", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_OUTPUT,
+ { .func_arg = opt_sdp_file },
"specify a file in which to print sdp information", "file" },
- { "time_base", OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(time_bases) },
+ { "time_base", OPT_TYPE_STRING, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(time_bases) },
"set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)", "ratio" },
- { "enc_time_base", OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(enc_time_bases) },
+ { "enc_time_base", OPT_TYPE_STRING, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ { .off = OFFSET(enc_time_bases) },
"set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
"two special values are defined - "
"0 = use frame rate (video) or sample rate (audio),"
"-1 = match source time base", "ratio" },
- { "bsf", OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) },
+ { "bsf", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(bitstream_filters) },
"A comma-separated list of bitstream filters", "bitstream_filters" },
- { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new },
+ { "absf", OPT_TYPE_FUNC, HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_old2new },
"deprecated", "audio bitstream_filters" },
- { "vbsf", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new },
+ { "vbsf", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_old2new },
"deprecated", "video bitstream_filters" },
- { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
+ { "apre", OPT_TYPE_FUNC, HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_preset },
"set the audio options to the indicated preset", "preset" },
- { "vpre", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
+ { "vpre", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_preset },
"set the video options to the indicated preset", "preset" },
- { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
+ { "spre", OPT_TYPE_FUNC, HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_preset },
"set the subtitle options to the indicated preset", "preset" },
- { "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
+ { "fpre", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_preset },
"set options from indicated preset file", "filename" },
- { "max_muxing_queue_size", OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
+ { "max_muxing_queue_size", OPT_TYPE_INT, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(max_muxing_queue_size) },
"maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
- { "muxing_queue_data_threshold", OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(muxing_queue_data_threshold) },
+ { "muxing_queue_data_threshold", OPT_TYPE_INT, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { .off = OFFSET(muxing_queue_data_threshold) },
"set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
/* data codec support */
- { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec },
+ { "dcodec", OPT_TYPE_FUNC, HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
+ { .func_arg = opt_data_codec },
"force data codec ('copy' to copy stream)", "codec" },
- { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(data_disable) },
- "disable data" },
+ { "dn", OPT_TYPE_BOOL, OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(data_disable) }, "disable data" },
#if CONFIG_VAAPI
- { "vaapi_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vaapi_device },
+ { "vaapi_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_vaapi_device },
"set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)", "device" },
#endif
#if CONFIG_QSV
- { "qsv_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_qsv_device },
+ { "qsv_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_qsv_device },
"set QSV hardware device (DirectX adapter index, DRM path or X11 display name)", "device"},
#endif
- { "init_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_init_hw_device },
+ { "init_hw_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_init_hw_device },
"initialise hardware device", "args" },
- { "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_hw_device },
+ { "filter_hw_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_filter_hw_device },
"set hardware device used when filtering", "device" },
// deprecated options
#if FFMPEG_OPT_MAP_CHANNEL
- { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel },
+ { "map_channel", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { .func_arg = opt_map_channel },
"map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
#endif
#if FFMPEG_OPT_ADRIFT_THRESHOLD
- { "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold },
+ { "adrift_threshold", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { .func_arg = opt_adrift_threshold },
"deprecated, does nothing", "threshold" },
#endif
#if FFMPEG_OPT_PSNR
- { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr },
+ { "psnr", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT,
+ { &do_psnr },
"calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
#endif
#if FFMPEG_OPT_TOP
- { "top", OPT_VIDEO | OPT_EXPERT | OPT_INT| OPT_SPEC |
- OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
+ { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { .off = OFFSET(top_field_first) },
"deprecated, use the setfield video filter", "" },
#endif
#if FFMPEG_OPT_QPHIST
- { "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist },
+ { "qphist", OPT_TYPE_FUNC, OPT_VIDEO | OPT_EXPERT,
+ { .func_arg = opt_qphist },
"deprecated, does nothing" },
#endif
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 3fd016ccaf..e01b2c03de 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3516,7 +3516,7 @@ static void event_loop(VideoState *cur_stream)
static int opt_width(void *optctx, const char *opt, const char *arg)
{
double num;
- int ret = parse_number(opt, arg, OPT_INT64, 1, INT_MAX, &num);
+ int ret = parse_number(opt, arg, OPT_TYPE_INT64, 1, INT_MAX, &num);
if (ret < 0)
return ret;
@@ -3527,7 +3527,7 @@ static int opt_width(void *optctx, const char *opt, const char *arg)
static int opt_height(void *optctx, const char *opt, const char *arg)
{
double num;
- int ret = parse_number(opt, arg, OPT_INT64, 1, INT_MAX, &num);
+ int ret = parse_number(opt, arg, OPT_TYPE_INT64, 1, INT_MAX, &num);
if (ret < 0)
return ret;
@@ -3568,7 +3568,7 @@ static int opt_show_mode(void *optctx, const char *opt, const char *arg)
if (show_mode == SHOW_MODE_NONE) {
double num;
- int ret = parse_number(opt, arg, OPT_INT, 0, SHOW_MODE_NB-1, &num);
+ int ret = parse_number(opt, arg, OPT_TYPE_INT, 0, SHOW_MODE_NB-1, &num);
if (ret < 0)
return ret;
show_mode = num;
@@ -3617,55 +3617,55 @@ static int dummy;
static const OptionDef options[] = {
CMDUTILS_COMMON_OPTIONS
- { "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
- { "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
- { "fs", OPT_BOOL, { &is_full_screen }, "force full screen" },
- { "an", OPT_BOOL, { &audio_disable }, "disable audio" },
- { "vn", OPT_BOOL, { &video_disable }, "disable video" },
- { "sn", OPT_BOOL, { &subtitle_disable }, "disable subtitling" },
- { "ast", OPT_STRING | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
- { "vst", OPT_STRING | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
- { "sst", OPT_STRING | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
- { "ss", OPT_TIME, { &start_time }, "seek to a given position in seconds", "pos" },
- { "t", OPT_TIME, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
- { "bytes", OPT_INT, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
- { "seek_interval", OPT_FLOAT, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
- { "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
- { "noborder", OPT_BOOL, { &borderless }, "borderless window" },
- { "alwaysontop", OPT_BOOL, { &alwaysontop }, "window always on top" },
- { "volume", OPT_INT, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
- { "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
- { "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
- { "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
- { "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
- { "drp", OPT_INT | OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
- { "lowres", OPT_INT | OPT_EXPERT, { &lowres }, "", "" },
- { "sync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
- { "autoexit", OPT_BOOL | OPT_EXPERT, { &autoexit }, "exit at the end", "" },
- { "exitonkeydown", OPT_BOOL | OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
- { "exitonmousedown", OPT_BOOL | OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
- { "loop", OPT_INT | OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
- { "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
- { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
- { "window_title", OPT_STRING, { &window_title }, "set window title", "window title" },
- { "left", OPT_INT | OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
- { "top", OPT_INT | OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
- { "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
- { "af", OPT_STRING, { &afilters }, "set audio filters", "filter_graph" },
- { "rdftspeed", OPT_INT | OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
- { "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
- { "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
- { "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
- { "acodec", OPT_STRING | OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
- { "scodec", OPT_STRING | OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
- { "vcodec", OPT_STRING | OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
- { "autorotate", OPT_BOOL, { &autorotate }, "automatically rotate video", "" },
- { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
+ { "x", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
+ { "y", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
+ { "fs", OPT_TYPE_BOOL, 0, { &is_full_screen }, "force full screen" },
+ { "an", OPT_TYPE_BOOL, 0, { &audio_disable }, "disable audio" },
+ { "vn", OPT_TYPE_BOOL, 0, { &video_disable }, "disable video" },
+ { "sn", OPT_TYPE_BOOL, 0, { &subtitle_disable }, "disable subtitling" },
+ { "ast", OPT_TYPE_STRING, OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
+ { "vst", OPT_TYPE_STRING, OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
+ { "sst", OPT_TYPE_STRING, OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
+ { "ss", OPT_TYPE_TIME, 0, { &start_time }, "seek to a given position in seconds", "pos" },
+ { "t", OPT_TYPE_TIME, 0, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
+ { "bytes", OPT_TYPE_INT, 0, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
+ { "seek_interval", OPT_TYPE_FLOAT, 0, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
+ { "nodisp", OPT_TYPE_BOOL, 0, { &display_disable }, "disable graphical display" },
+ { "noborder", OPT_TYPE_BOOL, 0, { &borderless }, "borderless window" },
+ { "alwaysontop", OPT_TYPE_BOOL, 0, { &alwaysontop }, "window always on top" },
+ { "volume", OPT_TYPE_INT, 0, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
+ { "f", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
+ { "stats", OPT_TYPE_BOOL, OPT_EXPERT, { &show_status }, "show status", "" },
+ { "fast", OPT_TYPE_BOOL, OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
+ { "genpts", OPT_TYPE_BOOL, OPT_EXPERT, { &genpts }, "generate pts", "" },
+ { "drp", OPT_TYPE_INT, OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
+ { "lowres", OPT_TYPE_INT, OPT_EXPERT, { &lowres }, "", "" },
+ { "sync", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
+ { "autoexit", OPT_TYPE_BOOL, OPT_EXPERT, { &autoexit }, "exit at the end", "" },
+ { "exitonkeydown", OPT_TYPE_BOOL, OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
+ { "exitonmousedown", OPT_TYPE_BOOL, OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
+ { "loop", OPT_TYPE_INT, OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
+ { "framedrop", OPT_TYPE_BOOL, OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
+ { "infbuf", OPT_TYPE_BOOL, OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
+ { "window_title", OPT_TYPE_STRING, 0, { &window_title }, "set window title", "window title" },
+ { "left", OPT_TYPE_INT, OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
+ { "top", OPT_TYPE_INT, OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
+ { "vf", OPT_TYPE_FUNC, OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
+ { "af", OPT_TYPE_STRING, 0, { &afilters }, "set audio filters", "filter_graph" },
+ { "rdftspeed", OPT_TYPE_INT, OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
+ { "showmode", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
+ { "i", OPT_TYPE_BOOL, 0, { &dummy}, "read specified file", "input_file"},
+ { "codec", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
+ { "acodec", OPT_TYPE_STRING, OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
+ { "scodec", OPT_TYPE_STRING, OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
+ { "vcodec", OPT_TYPE_STRING, OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
+ { "autorotate", OPT_TYPE_BOOL, 0, { &autorotate }, "automatically rotate video", "" },
+ { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
- { "filter_threads", OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
- { "enable_vulkan", OPT_BOOL, { &enable_vulkan }, "enable vulkan renderer" },
- { "vulkan_params", OPT_STRING | OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
- { "hwaccel", OPT_STRING | OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
+ { "filter_threads", OPT_TYPE_INT, OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
+ { "enable_vulkan", OPT_TYPE_BOOL, 0, { &enable_vulkan }, "enable vulkan renderer" },
+ { "vulkan_params", OPT_TYPE_STRING, OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
+ { "hwaccel", OPT_TYPE_STRING, OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
{ NULL, },
};
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 9968603e76..57e55e8a0b 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3716,7 +3716,7 @@ static int opt_show_optional_fields(void *optctx, const char *opt, const char *a
if (show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO && av_strcasecmp(arg, "auto")) {
double num;
- int ret = parse_number("show_optional_fields", arg, OPT_INT,
+ int ret = parse_number("show_optional_fields", arg, OPT_TYPE_INT,
SHOW_OPTIONAL_FIELDS_AUTO, SHOW_OPTIONAL_FIELDS_ALWAYS, &num);
if (ret < 0)
return ret;
@@ -4078,50 +4078,50 @@ DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
static const OptionDef real_options[] = {
CMDUTILS_COMMON_OPTIONS
- { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
- { "unit", OPT_BOOL, {&show_value_unit}, "show unit of the displayed values" },
- { "prefix", OPT_BOOL, {&use_value_prefix}, "use SI prefixes for the displayed values" },
- { "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix},
+ { "f", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
+ { "unit", OPT_TYPE_BOOL, 0, {&show_value_unit}, "show unit of the displayed values" },
+ { "prefix", OPT_TYPE_BOOL, 0, {&use_value_prefix}, "use SI prefixes for the displayed values" },
+ { "byte_binary_prefix", OPT_TYPE_BOOL, 0, {&use_byte_value_binary_prefix},
"use binary prefixes for byte units" },
- { "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format},
+ { "sexagesimal", OPT_TYPE_BOOL, 0, {&use_value_sexagesimal_format},
"use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
- { "pretty", 0, {.func_arg = opt_pretty},
+ { "pretty", OPT_TYPE_FUNC, 0, {.func_arg = opt_pretty},
"prettify the format of displayed values, make it more human readable" },
- { "output_format", OPT_STRING, { &output_format },
+ { "output_format", OPT_TYPE_STRING, 0, { &output_format },
"set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
- { "print_format", OPT_STRING, { &output_format }, "alias for -output_format (deprecated)" },
- { "of", OPT_STRING, { &output_format }, "alias for -output_format", "format" },
- { "select_streams", OPT_STRING, { &stream_specifier }, "select the specified streams", "stream_specifier" },
- { "sections", OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
- { "show_data", OPT_BOOL, { &do_show_data }, "show packets data" },
- { "show_data_hash", OPT_STRING, { &show_data_hash }, "show packets data hash" },
- { "show_error", 0, { .func_arg = &opt_show_error }, "show probing error" },
- { "show_format", 0, { .func_arg = &opt_show_format }, "show format/container info" },
- { "show_frames", 0, { .func_arg = &opt_show_frames }, "show frames info" },
- { "show_entries", HAS_ARG, {.func_arg = opt_show_entries},
+ { "print_format", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format (deprecated)" },
+ { "of", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format", "format" },
+ { "select_streams", OPT_TYPE_STRING, 0, { &stream_specifier }, "select the specified streams", "stream_specifier" },
+ { "sections", OPT_TYPE_FUNC, OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
+ { "show_data", OPT_TYPE_BOOL, 0, { &do_show_data }, "show packets data" },
+ { "show_data_hash", OPT_TYPE_STRING, 0, { &show_data_hash }, "show packets data hash" },
+ { "show_error", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_error }, "show probing error" },
+ { "show_format", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_format }, "show format/container info" },
+ { "show_frames", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_frames }, "show frames info" },
+ { "show_entries", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_show_entries},
"show a set of specified entries", "entry_list" },
#if HAVE_THREADS
- { "show_log", OPT_INT, { &do_show_log }, "show log" },
+ { "show_log", OPT_TYPE_INT, 0, { &do_show_log }, "show log" },
#endif
- { "show_packets", 0, { .func_arg = &opt_show_packets }, "show packets info" },
- { "show_programs", 0, { .func_arg = &opt_show_programs }, "show programs info" },
- { "show_streams", 0, { .func_arg = &opt_show_streams }, "show streams info" },
- { "show_chapters", 0, { .func_arg = &opt_show_chapters }, "show chapters info" },
- { "count_frames", OPT_BOOL, { &do_count_frames }, "count the number of frames per stream" },
- { "count_packets", OPT_BOOL, { &do_count_packets }, "count the number of packets per stream" },
- { "show_program_version", 0, { .func_arg = &opt_show_program_version }, "show ffprobe version" },
- { "show_library_versions", 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
- { "show_versions", 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
- { "show_pixel_formats", 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
- { "show_optional_fields", HAS_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
- { "show_private_data", OPT_BOOL, { &show_private_data }, "show private data" },
- { "private", OPT_BOOL, { &show_private_data }, "same as show_private_data" },
- { "bitexact", OPT_BOOL, {&do_bitexact}, "force bitexact output" },
- { "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
- { "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
- { "o", HAS_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
- { "print_filename", HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
- { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
+ { "show_packets", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_packets }, "show packets info" },
+ { "show_programs", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_programs }, "show programs info" },
+ { "show_streams", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_streams }, "show streams info" },
+ { "show_chapters", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_chapters }, "show chapters info" },
+ { "count_frames", OPT_TYPE_BOOL, 0, { &do_count_frames }, "count the number of frames per stream" },
+ { "count_packets", OPT_TYPE_BOOL, 0, { &do_count_packets }, "count the number of packets per stream" },
+ { "show_program_version", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_program_version }, "show ffprobe version" },
+ { "show_library_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
+ { "show_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
+ { "show_pixel_formats", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
+ { "show_optional_fields", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
+ { "show_private_data", OPT_TYPE_BOOL, 0, { &show_private_data }, "show private data" },
+ { "private", OPT_TYPE_BOOL, 0, { &show_private_data }, "same as show_private_data" },
+ { "bitexact", OPT_TYPE_BOOL, 0, {&do_bitexact}, "force bitexact output" },
+ { "read_intervals", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
+ { "i", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
+ { "o", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
+ { "print_filename", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
+ { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
{ NULL, },
};
diff --git a/fftools/opt_common.h b/fftools/opt_common.h
index ea1d16e769..08573eb7be 100644
--- a/fftools/opt_common.h
+++ b/fftools/opt_common.h
@@ -41,9 +41,9 @@ int show_sources(void *optctx, const char *opt, const char *arg);
#if CONFIG_AVDEVICE
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
- { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
+ { "sources" , OPT_TYPE_FUNC, OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
"list sources of the input device", "device" }, \
- { "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
+ { "sinks" , OPT_TYPE_FUNC, OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
"list sinks of the output device", "device" }, \
#else
@@ -197,35 +197,35 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg);
int opt_cpucount(void *optctx, const char *opt, const char *arg);
#define CMDUTILS_COMMON_OPTIONS \
- { "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
- { "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
- { "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
- { "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
- { "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
- { "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
- { "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
- { "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
- { "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
- { "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
- { "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
- { "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
- { "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
- { "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
- { "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
- { "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
- { "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
- { "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
- { "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
- { "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
- { "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
- { "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
- { "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
- { "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
- { "report", 0, { .func_arg = opt_report }, "generate a report" }, \
- { "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
- { "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
- { "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
- { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
+ { "L", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_license }, "show license" }, \
+ { "h", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
+ { "?", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
+ { "help", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
+ { "-help", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
+ { "version", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_version }, "show version" }, \
+ { "buildconf", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
+ { "formats", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
+ { "muxers", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
+ { "demuxers", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
+ { "devices", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
+ { "codecs", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
+ { "decoders", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
+ { "encoders", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
+ { "bsfs", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
+ { "protocols", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
+ { "filters", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
+ { "pix_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
+ { "layouts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
+ { "sample_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
+ { "dispositions", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
+ { "colors", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
+ { "loglevel", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
+ { "v", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
+ { "report", OPT_TYPE_FUNC, 0, { .func_arg = opt_report }, "generate a report" }, \
+ { "max_alloc", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
+ { "cpuflags", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
+ { "cpucount", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
+ { "hide_banner", OPT_TYPE_BOOL, OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
#endif /* FFTOOLS_OPT_COMMON_H */
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 06/20] fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (3 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 05/20] fftools: split off option types from other flags Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 07/20] fftools/cmdutils: renumber option flags sequentially Anton Khirnov
` (13 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
For consistent namespacing with other option flags. Also, document and
enforce that it can only be set for func-type options.
---
fftools/cmdutils.c | 8 +++-
fftools/cmdutils.h | 8 +++-
fftools/ffmpeg_opt.c | 92 ++++++++++++++++++++++----------------------
fftools/ffplay.c | 14 +++----
fftools/ffprobe.c | 14 +++----
fftools/opt_common.h | 14 +++----
6 files changed, 80 insertions(+), 70 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 8ff69cabf5..38f4f542d3 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -228,7 +228,7 @@ static int opt_has_arg(const OptionDef *o)
if (o->type == OPT_TYPE_BOOL)
return 0;
if (o->type == OPT_TYPE_FUNC)
- return !!(o->flags & HAS_ARG);
+ return !!(o->flags & OPT_FUNC_ARG);
return 1;
}
@@ -323,7 +323,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
static const OptionDef opt_avoptions = {
.name = "AVOption passthrough",
.type = OPT_TYPE_FUNC,
- .flags = HAS_ARG,
+ .flags = OPT_FUNC_ARG,
.u.func_arg = opt_default,
};
@@ -481,6 +481,10 @@ static void check_options(const OptionDef *po)
while (po->name) {
if (po->flags & OPT_PERFILE)
av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT));
+
+ // OPT_FUNC_ARG can only be ser for OPT_TYPE_FUNC
+ av_assert0((po->type == OPT_TYPE_FUNC) || !(po->flags & OPT_FUNC_ARG));
+
po++;
}
}
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index b9ef8b5c15..d0242dc6ab 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -118,7 +118,13 @@ typedef struct OptionDef {
const char *name;
enum OptionType type;
int flags;
-#define HAS_ARG (1 << 0)
+
+/* The OPT_TYPE_FUNC option takes an argument.
+ * Must not be used with other option types, as for those it holds:
+ * - OPT_TYPE_BOOL do not take an argument
+ * - all other types do
+ */
+#define OPT_FUNC_ARG (1 << 0)
#define OPT_EXPERT (1 << 2)
#define OPT_VIDEO (1 << 4)
#define OPT_AUDIO (1 << 5)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 752d5980b7..cf382759d8 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1453,7 +1453,7 @@ const OptionDef options[] = {
{ "pre", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(presets) },
"preset name", "preset" },
- { "map", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "map", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_map },
"set input stream mapping",
"[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
@@ -1495,7 +1495,7 @@ const OptionDef options[] = {
{ "itsscale", OPT_TYPE_DOUBLE, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
{ .off = OFFSET(ts_scale) },
"set the input ts scale", "scale" },
- { "timestamp", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "timestamp", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_recording_timestamp },
"set the recording timestamp ('now' to set the current time)", "time" },
{ "metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
@@ -1504,7 +1504,7 @@ const OptionDef options[] = {
{ "program", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(program) },
"add program with specified streams", "title=string:st=number..." },
- { "dframes", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
+ { "dframes", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
{ .func_arg = opt_data_frames },
"set the number of data frames to output", "number" },
{ "benchmark", OPT_TYPE_BOOL, OPT_EXPERT,
@@ -1513,13 +1513,13 @@ const OptionDef options[] = {
{ "benchmark_all", OPT_TYPE_BOOL, OPT_EXPERT,
{ &do_benchmark_all },
"add timings for each task" },
- { "progress", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "progress", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_progress },
"write program-readable progress information", "url" },
{ "stdin", OPT_TYPE_BOOL, OPT_EXPERT,
{ &stdin_interaction },
"enable or disable interaction on standard input" },
- { "timelimit", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "timelimit", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_timelimit },
"set max runtime in seconds in CPU user time", "limit" },
{ "dump", OPT_TYPE_BOOL, OPT_EXPERT,
@@ -1537,11 +1537,11 @@ const OptionDef options[] = {
{ "readrate_initial_burst", OPT_TYPE_DOUBLE, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
{ .off = OFFSET(readrate_initial_burst) },
"The initial amount of input to burst read before imposing any readrate", "seconds" },
- { "target", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "target", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_target },
"specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
- { "vsync", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "vsync", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_vsync },
"set video sync method globally; deprecated, use -fps_mode", "" },
{ "frame_drop_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
@@ -1577,7 +1577,7 @@ const OptionDef options[] = {
{ "xerror", OPT_TYPE_BOOL, OPT_EXPERT,
{ &exit_on_error },
"exit on error", "error" },
- { "abort_on", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "abort_on", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_abort_on },
"abort on the specified condition flags", "flags" },
{ "copyinkf", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
@@ -1595,16 +1595,16 @@ const OptionDef options[] = {
{ "q", OPT_TYPE_DOUBLE, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(qscale) },
"use fixed quality scale (VBR)", "q" },
- { "qscale", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "qscale", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_qscale },
"use fixed quality scale (VBR)", "q" },
- { "profile", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "profile", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_profile },
"set profile", "profile" },
{ "filter", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(filters) },
"set stream filtergraph", "filter_graph" },
- { "filter_threads", OPT_TYPE_FUNC, HAS_ARG,
+ { "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG,
{ .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
{ "filter_script", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
@@ -1613,16 +1613,16 @@ const OptionDef options[] = {
{ "reinit_filter", OPT_TYPE_INT, OPT_SPEC | OPT_INPUT,
{ .off = OFFSET(reinit_filters) },
"reinit filtergraph on input parameter changes", "" },
- { "filter_complex", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "filter_complex", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
{ "filter_complex_threads", OPT_TYPE_INT, 0,
{ &filter_complex_nbthreads },
"number of threads for -filter_complex" },
- { "lavfi", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "lavfi", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
- { "filter_complex_script", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "filter_complex_script", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_filter_complex_script },
"read complex filtergraph description from a file", "filename" },
{ "auto_conversion_filters", OPT_TYPE_BOOL, OPT_EXPERT,
@@ -1631,10 +1631,10 @@ const OptionDef options[] = {
{ "stats", OPT_TYPE_BOOL, 0,
{ &print_stats },
"print progress report during encoding", },
- { "stats_period", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "stats_period", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_stats_period },
"set the period at which ffmpeg updates stats and -progress output", "time" },
- { "attach", OPT_TYPE_FUNC, HAS_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
+ { "attach", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
{ .func_arg = opt_attach },
"add an attachment to the output file", "filename" },
{ "dump_attachment", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
@@ -1684,7 +1684,7 @@ const OptionDef options[] = {
"format of the stats written with -stats_mux_pre" },
/* video options */
- { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_video_frames },
"set the number of video frames to output", "number" },
{ "r", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
@@ -1720,10 +1720,10 @@ const OptionDef options[] = {
{ "rc_override", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(rc_overrides) },
"rate control override for specific intervals", "override" },
- { "vcodec", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "vcodec", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_video_codec },
"force video codec ('copy' to copy stream)", "codec" },
- { "timecode", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "timecode", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_timecode },
"set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
{ "pass", OPT_TYPE_INT, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
@@ -1735,13 +1735,13 @@ const OptionDef options[] = {
{ "vstats", OPT_TYPE_FUNC, OPT_VIDEO | OPT_EXPERT,
{ .func_arg = opt_vstats },
"dump video coding statistics to file" },
- { "vstats_file", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT,
+ { "vstats_file", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_vstats_file },
"dump video coding statistics to file", "file" },
{ "vstats_version", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT,
{ &vstats_version },
"Version of the vstats format to use."},
- { "vf", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "vf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_video_filters },
"set video filters", "filter_graph" },
{ "intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
@@ -1753,7 +1753,7 @@ const OptionDef options[] = {
{ "chroma_intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(chroma_intra_matrices) },
"specify intra matrix coeffs", "matrix" },
- { "vtag", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "vtag", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_old2new },
"force video tag/fourcc", "fourcc/tag" },
{ "fps_mode", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
@@ -1762,13 +1762,13 @@ const OptionDef options[] = {
{ "force_fps", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(force_fps) },
"force the selected framerate, disable the best supported framerate selection" },
- { "streamid", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "streamid", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_streamid },
"set the value of an outfile streamid", "streamIndex:value" },
{ "force_key_frames", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(forced_key_frames) },
"force key frames at specified timestamps", "timestamps" },
- { "b", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "b", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_bitrate },
"video bitrate (please use -b:v)", "bitrate" },
{ "hwaccel", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
@@ -1796,10 +1796,10 @@ const OptionDef options[] = {
"random access points" },
/* audio options */
- { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_audio_frames },
"set the number of audio frames to output", "number" },
- { "aq", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "aq", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_audio_qscale },
"set audio quality (codec-specific)", "quality", },
{ "ar", OPT_TYPE_INT, OPT_AUDIO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
@@ -1811,13 +1811,13 @@ const OptionDef options[] = {
{ "an", OPT_TYPE_BOOL, OPT_AUDIO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(audio_disable) },
"disable audio" },
- { "acodec", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "acodec", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_audio_codec },
"force audio codec ('copy' to copy stream)", "codec" },
- { "ab", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "ab", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_bitrate },
"audio bitrate (please use -b:a)", "bitrate" },
- { "atag", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "atag", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_old2new },
"force audio tag/fourcc", "fourcc/tag" },
{ "sample_fmt", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
@@ -1829,7 +1829,7 @@ const OptionDef options[] = {
{ "ch_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
- { "af", OPT_TYPE_FUNC, OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "af", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_audio_filters },
"set audio filters", "filter_graph" },
{ "guess_layout_max", OPT_TYPE_INT, OPT_AUDIO | OPT_SPEC | OPT_EXPERT | OPT_INPUT,
@@ -1840,10 +1840,10 @@ const OptionDef options[] = {
{ "sn", OPT_TYPE_BOOL, OPT_SUBTITLE | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(subtitle_disable) },
"disable subtitle" },
- { "scodec", OPT_TYPE_FUNC, OPT_SUBTITLE | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "scodec", OPT_TYPE_FUNC, OPT_SUBTITLE | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_subtitle_codec },
"force subtitle codec ('copy' to copy stream)", "codec" },
- { "stag", OPT_TYPE_FUNC, OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "stag", OPT_TYPE_FUNC, OPT_SUBTITLE | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_old2new }
, "force subtitle tag/fourcc", "fourcc/tag" },
{ "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
@@ -1860,7 +1860,7 @@ const OptionDef options[] = {
{ "muxpreload", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
{ .off = OFFSET(mux_preload) },
"set the initial demux-decode delay", "seconds" },
- { "sdp_file", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_OUTPUT,
+ { "sdp_file", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_OUTPUT,
{ .func_arg = opt_sdp_file },
"specify a file in which to print sdp information", "file" },
@@ -1877,23 +1877,23 @@ const OptionDef options[] = {
{ "bsf", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
{ .off = OFFSET(bitstream_filters) },
"A comma-separated list of bitstream filters", "bitstream_filters" },
- { "absf", OPT_TYPE_FUNC, HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "absf", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_old2new },
"deprecated", "audio bitstream_filters" },
- { "vbsf", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "vbsf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_old2new },
"deprecated", "video bitstream_filters" },
- { "apre", OPT_TYPE_FUNC, HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "apre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_preset },
"set the audio options to the indicated preset", "preset" },
- { "vpre", OPT_TYPE_FUNC, OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "vpre", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_preset },
"set the video options to the indicated preset", "preset" },
- { "spre", OPT_TYPE_FUNC, HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "spre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_preset },
"set the subtitle options to the indicated preset", "preset" },
- { "fpre", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "fpre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_preset },
"set options from indicated preset file", "filename" },
@@ -1905,39 +1905,39 @@ const OptionDef options[] = {
"set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
/* data codec support */
- { "dcodec", OPT_TYPE_FUNC, HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
+ { "dcodec", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_data_codec },
"force data codec ('copy' to copy stream)", "codec" },
{ "dn", OPT_TYPE_BOOL, OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(data_disable) }, "disable data" },
#if CONFIG_VAAPI
- { "vaapi_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "vaapi_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_vaapi_device },
"set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)", "device" },
#endif
#if CONFIG_QSV
- { "qsv_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "qsv_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_qsv_device },
"set QSV hardware device (DirectX adapter index, DRM path or X11 display name)", "device"},
#endif
- { "init_hw_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "init_hw_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_init_hw_device },
"initialise hardware device", "args" },
- { "filter_hw_device", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "filter_hw_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_filter_hw_device },
"set hardware device used when filtering", "device" },
// deprecated options
#if FFMPEG_OPT_MAP_CHANNEL
- { "map_channel", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "map_channel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_map_channel },
"map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
#endif
#if FFMPEG_OPT_ADRIFT_THRESHOLD
- { "adrift_threshold", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT,
+ { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_adrift_threshold },
"deprecated, does nothing", "threshold" },
#endif
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index e01b2c03de..ea5ff31393 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3617,8 +3617,8 @@ static int dummy;
static const OptionDef options[] = {
CMDUTILS_COMMON_OPTIONS
- { "x", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
- { "y", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
+ { "x", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
+ { "y", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
{ "fs", OPT_TYPE_BOOL, 0, { &is_full_screen }, "force full screen" },
{ "an", OPT_TYPE_BOOL, 0, { &audio_disable }, "disable audio" },
{ "vn", OPT_TYPE_BOOL, 0, { &video_disable }, "disable video" },
@@ -3634,13 +3634,13 @@ static const OptionDef options[] = {
{ "noborder", OPT_TYPE_BOOL, 0, { &borderless }, "borderless window" },
{ "alwaysontop", OPT_TYPE_BOOL, 0, { &alwaysontop }, "window always on top" },
{ "volume", OPT_TYPE_INT, 0, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
- { "f", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
+ { "f", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_format }, "force format", "fmt" },
{ "stats", OPT_TYPE_BOOL, OPT_EXPERT, { &show_status }, "show status", "" },
{ "fast", OPT_TYPE_BOOL, OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
{ "genpts", OPT_TYPE_BOOL, OPT_EXPERT, { &genpts }, "generate pts", "" },
{ "drp", OPT_TYPE_INT, OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
{ "lowres", OPT_TYPE_INT, OPT_EXPERT, { &lowres }, "", "" },
- { "sync", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
+ { "sync", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "autoexit", OPT_TYPE_BOOL, OPT_EXPERT, { &autoexit }, "exit at the end", "" },
{ "exitonkeydown", OPT_TYPE_BOOL, OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
{ "exitonmousedown", OPT_TYPE_BOOL, OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
@@ -3650,12 +3650,12 @@ static const OptionDef options[] = {
{ "window_title", OPT_TYPE_STRING, 0, { &window_title }, "set window title", "window title" },
{ "left", OPT_TYPE_INT, OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
{ "top", OPT_TYPE_INT, OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
- { "vf", OPT_TYPE_FUNC, OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
+ { "vf", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
{ "af", OPT_TYPE_STRING, 0, { &afilters }, "set audio filters", "filter_graph" },
{ "rdftspeed", OPT_TYPE_INT, OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
- { "showmode", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
+ { "showmode", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "i", OPT_TYPE_BOOL, 0, { &dummy}, "read specified file", "input_file"},
- { "codec", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
+ { "codec", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
{ "acodec", OPT_TYPE_STRING, OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
{ "scodec", OPT_TYPE_STRING, OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
{ "vcodec", OPT_TYPE_STRING, OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 57e55e8a0b..f00ba48620 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -4078,7 +4078,7 @@ DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
static const OptionDef real_options[] = {
CMDUTILS_COMMON_OPTIONS
- { "f", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
+ { "f", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_format}, "force format", "format" },
{ "unit", OPT_TYPE_BOOL, 0, {&show_value_unit}, "show unit of the displayed values" },
{ "prefix", OPT_TYPE_BOOL, 0, {&use_value_prefix}, "use SI prefixes for the displayed values" },
{ "byte_binary_prefix", OPT_TYPE_BOOL, 0, {&use_byte_value_binary_prefix},
@@ -4098,7 +4098,7 @@ static const OptionDef real_options[] = {
{ "show_error", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_error }, "show probing error" },
{ "show_format", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_format }, "show format/container info" },
{ "show_frames", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_frames }, "show frames info" },
- { "show_entries", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_show_entries},
+ { "show_entries", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_show_entries},
"show a set of specified entries", "entry_list" },
#if HAVE_THREADS
{ "show_log", OPT_TYPE_INT, 0, { &do_show_log }, "show log" },
@@ -4113,14 +4113,14 @@ static const OptionDef real_options[] = {
{ "show_library_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
{ "show_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
{ "show_pixel_formats", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
- { "show_optional_fields", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
+ { "show_optional_fields", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
{ "show_private_data", OPT_TYPE_BOOL, 0, { &show_private_data }, "show private data" },
{ "private", OPT_TYPE_BOOL, 0, { &show_private_data }, "same as show_private_data" },
{ "bitexact", OPT_TYPE_BOOL, 0, {&do_bitexact}, "force bitexact output" },
- { "read_intervals", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
- { "i", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
- { "o", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
- { "print_filename", OPT_TYPE_FUNC, HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
+ { "read_intervals", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
+ { "i", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
+ { "o", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
+ { "print_filename", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
{ "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
{ NULL, },
diff --git a/fftools/opt_common.h b/fftools/opt_common.h
index 08573eb7be..e82ada5581 100644
--- a/fftools/opt_common.h
+++ b/fftools/opt_common.h
@@ -41,9 +41,9 @@ int show_sources(void *optctx, const char *opt, const char *arg);
#if CONFIG_AVDEVICE
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
- { "sources" , OPT_TYPE_FUNC, OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
+ { "sources" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG, { .func_arg = show_sources }, \
"list sources of the input device", "device" }, \
- { "sinks" , OPT_TYPE_FUNC, OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
+ { "sinks" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG, { .func_arg = show_sinks }, \
"list sinks of the output device", "device" }, \
#else
@@ -219,12 +219,12 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg);
{ "sample_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "dispositions", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
{ "colors", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
- { "loglevel", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
- { "v", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
+ { "loglevel", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
+ { "v", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "report", OPT_TYPE_FUNC, 0, { .func_arg = opt_report }, "generate a report" }, \
- { "max_alloc", OPT_TYPE_FUNC, HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
- { "cpuflags", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
- { "cpucount", OPT_TYPE_FUNC, HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
+ { "max_alloc", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
+ { "cpuflags", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
+ { "cpucount", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
{ "hide_banner", OPT_TYPE_BOOL, OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 07/20] fftools/cmdutils: renumber option flags sequentially
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (4 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 06/20] fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 08/20] fftools/cmdutils: include OPT_PERFILE in OPT_OFFSET Anton Khirnov
` (12 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Also, document them.
---
fftools/cmdutils.h | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index d0242dc6ab..8e22560fc6 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -125,23 +125,31 @@ typedef struct OptionDef {
* - all other types do
*/
#define OPT_FUNC_ARG (1 << 0)
+/* Program will immediately exit after processing this option */
+#define OPT_EXIT (1 << 1)
+/* Option is intended for advanced users. Only affects
+ * help output.
+ */
#define OPT_EXPERT (1 << 2)
-#define OPT_VIDEO (1 << 4)
-#define OPT_AUDIO (1 << 5)
-#define OPT_SUBTITLE (1 << 8)
-#define OPT_EXIT (1 << 10)
-#define OPT_DATA (1 << 11)
-/* The option is per-file (currently ffmpeg-only).
- implied by OPT_OFFSET or OPT_SPEC */
-#define OPT_PERFILE (1 << 12)
+#define OPT_VIDEO (1 << 3)
+#define OPT_AUDIO (1 << 4)
+#define OPT_SUBTITLE (1 << 5)
+#define OPT_DATA (1 << 6)
+/* The option is per-file (currently ffmpeg-only). Implied by OPT_OFFSET or
+ * OPT_SPEC. At least one of OPT_INPUT or OPT_OUTPUT must be set when this flag
+ * is in use.
+ */
+#define OPT_PERFILE (1 << 7)
/* Option is specified as an offset in a passed optctx */
-#define OPT_OFFSET (1 << 13)
+#define OPT_OFFSET (1 << 8)
/* Option is to be stored in an array of SpecifierOpt. Implies OPT_OFFSET.
Next element after the offset is an int containing element count in the
array. */
-#define OPT_SPEC (1 << 14)
-#define OPT_INPUT (1 << 17)
-#define OPT_OUTPUT (1 << 18)
+#define OPT_SPEC (1 << 9)
+/* ffmpeg-only - specifies whether an OPT_PERFILE option applies to input,
+ * output, or both. */
+#define OPT_INPUT (1 << 10)
+#define OPT_OUTPUT (1 << 11)
union {
void *dst_ptr;
int (*func_arg)(void *, const char *, const char *);
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 08/20] fftools/cmdutils: include OPT_PERFILE in OPT_OFFSET
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (5 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 07/20] fftools/cmdutils: renumber option flags sequentially Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 09/20] fftools/cmdutils: check valid flags for OPT_TYPE_FUNC Anton Khirnov
` (11 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
And analogously OPT_OFFSET in OPT_SPEC. Previously the inclusion would
be implicit and required all code to remember this.
---
fftools/cmdutils.c | 6 +++---
fftools/cmdutils.h | 21 +++++++++++++--------
fftools/ffmpeg_opt.c | 14 ++++++--------
3 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 38f4f542d3..6ca2efef4a 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -237,13 +237,13 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
{
/* new-style options contain an offset into optctx, old-style address of
* a global var*/
- void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ?
+ void *dst = po->flags & OPT_FLAG_OFFSET ?
(uint8_t *)optctx + po->u.off : po->u.dst_ptr;
int *dstcount;
double num;
int ret;
- if (po->flags & OPT_SPEC) {
+ if (po->flags & OPT_FLAG_SPEC) {
SpecifierOpt **so = dst;
char *p = strchr(opt, ':');
char *str;
@@ -660,7 +660,7 @@ static int finish_group(OptionParseContext *octx, int group_idx,
static int add_opt(OptionParseContext *octx, const OptionDef *opt,
const char *key, const char *val)
{
- int global = !(opt->flags & (OPT_PERFILE | OPT_SPEC | OPT_OFFSET));
+ int global = !(opt->flags & OPT_PERFILE);
OptionGroup *g = global ? &octx->global_opts : &octx->cur_group;
int ret;
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 8e22560fc6..dc99573d80 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -135,17 +135,22 @@ typedef struct OptionDef {
#define OPT_AUDIO (1 << 4)
#define OPT_SUBTITLE (1 << 5)
#define OPT_DATA (1 << 6)
-/* The option is per-file (currently ffmpeg-only). Implied by OPT_OFFSET or
- * OPT_SPEC. At least one of OPT_INPUT or OPT_OUTPUT must be set when this flag
- * is in use.
+/* The option is per-file (currently ffmpeg-only). At least one of OPT_INPUT or
+ * OPT_OUTPUT must be set when this flag is in use.
*/
#define OPT_PERFILE (1 << 7)
-/* Option is specified as an offset in a passed optctx */
-#define OPT_OFFSET (1 << 8)
-/* Option is to be stored in an array of SpecifierOpt. Implies OPT_OFFSET.
+
+/* Option is specified as an offset in a passed optctx.
+ * Always use as OPT_OFFSET in option definitions. */
+#define OPT_FLAG_OFFSET (1 << 8)
+#define OPT_OFFSET (OPT_FLAG_OFFSET | OPT_PERFILE)
+
+/* Option is to be stored in an array of SpecifierOpt.
Next element after the offset is an int containing element count in the
- array. */
-#define OPT_SPEC (1 << 9)
+ array.
+ Always use as OPT_SPEC in option definitions. */
+#define OPT_FLAG_SPEC (1 << 9)
+#define OPT_SPEC (OPT_FLAG_SPEC | OPT_OFFSET)
/* ffmpeg-only - specifies whether an OPT_PERFILE option applies to input,
* output, or both. */
#define OPT_INPUT (1 << 10)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index cf382759d8..6f997a803a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -109,7 +109,7 @@ static void uninit_options(OptionsContext *o)
while (po->name) {
void *dst = (uint8_t*)o + po->u.off;
- if (po->flags & OPT_SPEC) {
+ if (po->flags & OPT_FLAG_SPEC) {
SpecifierOpt **so = dst;
int i, *count = (int*)(so + 1);
for (i = 0; i < *count; i++) {
@@ -119,7 +119,7 @@ static void uninit_options(OptionsContext *o)
}
av_freep(so);
*count = 0;
- } else if (po->flags & OPT_OFFSET && po->type == OPT_TYPE_STRING)
+ } else if (po->flags & OPT_FLAG_OFFSET && po->type == OPT_TYPE_STRING)
av_freep(dst);
po++;
}
@@ -1181,8 +1181,6 @@ static int opt_filter_complex_script(void *optctx, const char *opt, const char *
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_PERFILE;
int show_advanced = 0, show_avoptions = 0;
if (opt && *opt) {
@@ -1209,17 +1207,17 @@ void show_help_default(const char *opt, const char *arg)
show_help_options(options, "Global options (affect whole program "
"instead of just one file):",
- 0, per_file | OPT_EXIT | OPT_EXPERT, 0);
+ 0, OPT_PERFILE | OPT_EXIT | OPT_EXPERT, 0);
if (show_advanced)
show_help_options(options, "Advanced global options:", OPT_EXPERT,
- per_file | OPT_EXIT, 0);
+ OPT_PERFILE | OPT_EXIT, 0);
show_help_options(options, "Per-file main options:", 0,
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
- OPT_EXIT, per_file);
+ OPT_EXIT, OPT_PERFILE);
if (show_advanced)
show_help_options(options, "Advanced per-file options:",
- OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, per_file);
+ OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, OPT_PERFILE);
show_help_options(options, "Video options:",
OPT_VIDEO, OPT_EXPERT | OPT_AUDIO, 0);
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 09/20] fftools/cmdutils: check valid flags for OPT_TYPE_FUNC
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (6 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 08/20] fftools/cmdutils: include OPT_PERFILE in OPT_OFFSET Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 10/20] fftools/cmdutils: add a struct for a list of SpecifierOpt Anton Khirnov
` (10 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
SPEC and OFFSET do not make sense for functions.
---
fftools/cmdutils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 6ca2efef4a..a52c7c5ae4 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -482,6 +482,9 @@ static void check_options(const OptionDef *po)
if (po->flags & OPT_PERFILE)
av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT));
+ if (po->type == OPT_TYPE_FUNC)
+ av_assert0(!(po->flags & (OPT_FLAG_OFFSET | OPT_FLAG_SPEC)));
+
// OPT_FUNC_ARG can only be ser for OPT_TYPE_FUNC
av_assert0((po->type == OPT_TYPE_FUNC) || !(po->flags & OPT_FUNC_ARG));
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 10/20] fftools/cmdutils: add a struct for a list of SpecifierOpt
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (7 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 09/20] fftools/cmdutils: check valid flags for OPT_TYPE_FUNC Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 11/20] fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a function Anton Khirnov
` (9 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Significantly simplifies the code dealing with OPT_SPEC.
---
fftools/cmdutils.c | 10 +-
fftools/cmdutils.h | 9 +-
fftools/ffmpeg.h | 197 +++++++++++++-------------------------
fftools/ffmpeg_demux.c | 30 +++---
fftools/ffmpeg_mux_init.c | 32 +++----
fftools/ffmpeg_opt.c | 13 ++-
6 files changed, 115 insertions(+), 176 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index a52c7c5ae4..f53c4b7aec 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -239,25 +239,23 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
* a global var*/
void *dst = po->flags & OPT_FLAG_OFFSET ?
(uint8_t *)optctx + po->u.off : po->u.dst_ptr;
- int *dstcount;
double num;
int ret;
if (po->flags & OPT_FLAG_SPEC) {
- SpecifierOpt **so = dst;
+ SpecifierOptList *sol = dst;
char *p = strchr(opt, ':');
char *str;
- dstcount = (int *)(so + 1);
- ret = grow_array((void**)so, sizeof(**so), dstcount, *dstcount + 1);
+ ret = GROW_ARRAY(sol->opt, sol->nb_opt);
if (ret < 0)
return ret;
str = av_strdup(p ? p + 1 : "");
if (!str)
return AVERROR(ENOMEM);
- (*so)[*dstcount - 1].specifier = str;
- dst = &(*so)[*dstcount - 1].u;
+ sol->opt[sol->nb_opt - 1].specifier = str;
+ dst = &sol->opt[sol->nb_opt - 1].u;
}
if (po->type == OPT_TYPE_STRING) {
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index dc99573d80..8ef9a07e9e 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -114,6 +114,11 @@ typedef struct SpecifierOpt {
} u;
} SpecifierOpt;
+typedef struct SpecifierOptList {
+ SpecifierOpt *opt;
+ int nb_opt;
+} SpecifierOptList;
+
typedef struct OptionDef {
const char *name;
enum OptionType type;
@@ -145,9 +150,7 @@ typedef struct OptionDef {
#define OPT_FLAG_OFFSET (1 << 8)
#define OPT_OFFSET (OPT_FLAG_OFFSET | OPT_PERFILE)
-/* Option is to be stored in an array of SpecifierOpt.
- Next element after the offset is an int containing element count in the
- array.
+/* Option is to be stored in a SpecifierOptList.
Always use as OPT_SPEC in option definitions. */
#define OPT_FLAG_SPEC (1 << 9)
#define OPT_SPEC (OPT_FLAG_SPEC | OPT_OFFSET)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 33a29b316f..94f70f7efb 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -138,22 +138,14 @@ typedef struct OptionsContext {
int seek_timestamp;
const char *format;
- SpecifierOpt *codec_names;
- int nb_codec_names;
- SpecifierOpt *audio_ch_layouts;
- int nb_audio_ch_layouts;
- SpecifierOpt *audio_channels;
- int nb_audio_channels;
- SpecifierOpt *audio_sample_rate;
- int nb_audio_sample_rate;
- SpecifierOpt *frame_rates;
- int nb_frame_rates;
- SpecifierOpt *max_frame_rates;
- int nb_max_frame_rates;
- SpecifierOpt *frame_sizes;
- int nb_frame_sizes;
- SpecifierOpt *frame_pix_fmts;
- int nb_frame_pix_fmts;
+ SpecifierOptList codec_names;
+ SpecifierOptList audio_ch_layouts;
+ SpecifierOptList audio_channels;
+ SpecifierOptList audio_sample_rate;
+ SpecifierOptList frame_rates;
+ SpecifierOptList max_frame_rates;
+ SpecifierOptList frame_sizes;
+ SpecifierOptList frame_pix_fmts;
/* input options */
int64_t input_ts_offset;
@@ -166,18 +158,12 @@ typedef struct OptionsContext {
int input_sync_ref;
int find_stream_info;
- SpecifierOpt *ts_scale;
- int nb_ts_scale;
- SpecifierOpt *dump_attachment;
- int nb_dump_attachment;
- SpecifierOpt *hwaccels;
- int nb_hwaccels;
- SpecifierOpt *hwaccel_devices;
- int nb_hwaccel_devices;
- SpecifierOpt *hwaccel_output_formats;
- int nb_hwaccel_output_formats;
- SpecifierOpt *autorotate;
- int nb_autorotate;
+ SpecifierOptList ts_scale;
+ SpecifierOptList dump_attachment;
+ SpecifierOptList hwaccels;
+ SpecifierOptList hwaccel_devices;
+ SpecifierOptList hwaccel_output_formats;
+ SpecifierOptList autorotate;
/* output options */
StreamMap *stream_maps;
@@ -208,102 +194,55 @@ typedef struct OptionsContext {
// keys are stream indices
AVDictionary *streamid;
- SpecifierOpt *metadata;
- int nb_metadata;
- SpecifierOpt *max_frames;
- int nb_max_frames;
- SpecifierOpt *bitstream_filters;
- int nb_bitstream_filters;
- SpecifierOpt *codec_tags;
- int nb_codec_tags;
- SpecifierOpt *sample_fmts;
- int nb_sample_fmts;
- SpecifierOpt *qscale;
- int nb_qscale;
- SpecifierOpt *forced_key_frames;
- int nb_forced_key_frames;
- SpecifierOpt *fps_mode;
- int nb_fps_mode;
- SpecifierOpt *force_fps;
- int nb_force_fps;
- SpecifierOpt *frame_aspect_ratios;
- int nb_frame_aspect_ratios;
- SpecifierOpt *display_rotations;
- int nb_display_rotations;
- SpecifierOpt *display_hflips;
- int nb_display_hflips;
- SpecifierOpt *display_vflips;
- int nb_display_vflips;
- SpecifierOpt *rc_overrides;
- int nb_rc_overrides;
- SpecifierOpt *intra_matrices;
- int nb_intra_matrices;
- SpecifierOpt *inter_matrices;
- int nb_inter_matrices;
- SpecifierOpt *chroma_intra_matrices;
- int nb_chroma_intra_matrices;
+ SpecifierOptList metadata;
+ SpecifierOptList max_frames;
+ SpecifierOptList bitstream_filters;
+ SpecifierOptList codec_tags;
+ SpecifierOptList sample_fmts;
+ SpecifierOptList qscale;
+ SpecifierOptList forced_key_frames;
+ SpecifierOptList fps_mode;
+ SpecifierOptList force_fps;
+ SpecifierOptList frame_aspect_ratios;
+ SpecifierOptList display_rotations;
+ SpecifierOptList display_hflips;
+ SpecifierOptList display_vflips;
+ SpecifierOptList rc_overrides;
+ SpecifierOptList intra_matrices;
+ SpecifierOptList inter_matrices;
+ SpecifierOptList chroma_intra_matrices;
#if FFMPEG_OPT_TOP
- SpecifierOpt *top_field_first;
- int nb_top_field_first;
+ SpecifierOptList top_field_first;
#endif
- SpecifierOpt *metadata_map;
- int nb_metadata_map;
- SpecifierOpt *presets;
- int nb_presets;
- SpecifierOpt *copy_initial_nonkeyframes;
- int nb_copy_initial_nonkeyframes;
- SpecifierOpt *copy_prior_start;
- int nb_copy_prior_start;
- SpecifierOpt *filters;
- int nb_filters;
- SpecifierOpt *filter_scripts;
- int nb_filter_scripts;
- SpecifierOpt *reinit_filters;
- int nb_reinit_filters;
- SpecifierOpt *fix_sub_duration;
- int nb_fix_sub_duration;
- SpecifierOpt *fix_sub_duration_heartbeat;
- int nb_fix_sub_duration_heartbeat;
- SpecifierOpt *canvas_sizes;
- int nb_canvas_sizes;
- SpecifierOpt *pass;
- int nb_pass;
- SpecifierOpt *passlogfiles;
- int nb_passlogfiles;
- SpecifierOpt *max_muxing_queue_size;
- int nb_max_muxing_queue_size;
- SpecifierOpt *muxing_queue_data_threshold;
- int nb_muxing_queue_data_threshold;
- SpecifierOpt *guess_layout_max;
- int nb_guess_layout_max;
- SpecifierOpt *apad;
- int nb_apad;
- SpecifierOpt *discard;
- int nb_discard;
- SpecifierOpt *disposition;
- int nb_disposition;
- SpecifierOpt *program;
- int nb_program;
- SpecifierOpt *time_bases;
- int nb_time_bases;
- SpecifierOpt *enc_time_bases;
- int nb_enc_time_bases;
- SpecifierOpt *autoscale;
- int nb_autoscale;
- SpecifierOpt *bits_per_raw_sample;
- int nb_bits_per_raw_sample;
- SpecifierOpt *enc_stats_pre;
- int nb_enc_stats_pre;
- SpecifierOpt *enc_stats_post;
- int nb_enc_stats_post;
- SpecifierOpt *mux_stats;
- int nb_mux_stats;
- SpecifierOpt *enc_stats_pre_fmt;
- int nb_enc_stats_pre_fmt;
- SpecifierOpt *enc_stats_post_fmt;
- int nb_enc_stats_post_fmt;
- SpecifierOpt *mux_stats_fmt;
- int nb_mux_stats_fmt;
+ SpecifierOptList metadata_map;
+ SpecifierOptList presets;
+ SpecifierOptList copy_initial_nonkeyframes;
+ SpecifierOptList copy_prior_start;
+ SpecifierOptList filters;
+ SpecifierOptList filter_scripts;
+ SpecifierOptList reinit_filters;
+ SpecifierOptList fix_sub_duration;
+ SpecifierOptList fix_sub_duration_heartbeat;
+ SpecifierOptList canvas_sizes;
+ SpecifierOptList pass;
+ SpecifierOptList passlogfiles;
+ SpecifierOptList max_muxing_queue_size;
+ SpecifierOptList muxing_queue_data_threshold;
+ SpecifierOptList guess_layout_max;
+ SpecifierOptList apad;
+ SpecifierOptList discard;
+ SpecifierOptList disposition;
+ SpecifierOptList program;
+ SpecifierOptList time_bases;
+ SpecifierOptList enc_time_bases;
+ SpecifierOptList autoscale;
+ SpecifierOptList bits_per_raw_sample;
+ SpecifierOptList enc_stats_pre;
+ SpecifierOptList enc_stats_post;
+ SpecifierOptList mux_stats;
+ SpecifierOptList enc_stats_pre_fmt;
+ SpecifierOptList enc_stats_post_fmt;
+ SpecifierOptList mux_stats_fmt;
} OptionsContext;
typedef struct InputFilter {
@@ -850,11 +789,11 @@ void update_benchmark(const char *fmt, ...);
{\
int _ret, _matches = 0;\
SpecifierOpt *so;\
- for (int _i = 0; _i < o->nb_ ## name; _i++) {\
- char *spec = o->name[_i].specifier;\
+ for (int _i = 0; _i < o->name.nb_opt; _i++) {\
+ char *spec = o->name.opt[_i].specifier;\
if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
- outvar = o->name[_i].u.type;\
- so = &o->name[_i];\
+ outvar = o->name.opt[_i].u.type;\
+ so = &o->name.opt[_i];\
_matches++;\
} else if (_ret < 0)\
return _ret;\
@@ -866,10 +805,10 @@ void update_benchmark(const char *fmt, ...);
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
{\
int i;\
- for (i = 0; i < o->nb_ ## name; i++) {\
- char *spec = o->name[i].specifier;\
+ for (i = 0; i < o->name.nb_opt; i++) {\
+ char *spec = o->name.opt[i].specifier;\
if (!strcmp(spec, mediatype))\
- outvar = o->name[i].u.type;\
+ outvar = o->name.opt[i].u.type;\
}\
}
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index eca3de709c..6672113bca 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1389,28 +1389,28 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
ic = avformat_alloc_context();
if (!ic)
return AVERROR(ENOMEM);
- if (o->nb_audio_sample_rate) {
- av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0);
+ if (o->audio_sample_rate.nb_opt) {
+ av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate.opt[o->audio_sample_rate.nb_opt - 1].u.i, 0);
}
- if (o->nb_audio_channels) {
+ if (o->audio_channels.nb_opt) {
const AVClass *priv_class;
if (file_iformat && (priv_class = file_iformat->priv_class) &&
av_opt_find(&priv_class, "ch_layout", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ)) {
char buf[32];
- snprintf(buf, sizeof(buf), "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
+ snprintf(buf, sizeof(buf), "%dC", o->audio_channels.opt[o->audio_channels.nb_opt - 1].u.i);
av_dict_set(&o->g->format_opts, "ch_layout", buf, 0);
}
}
- if (o->nb_audio_ch_layouts) {
+ if (o->audio_ch_layouts.nb_opt) {
const AVClass *priv_class;
if (file_iformat && (priv_class = file_iformat->priv_class) &&
av_opt_find(&priv_class, "ch_layout", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ)) {
- av_dict_set(&o->g->format_opts, "ch_layout", o->audio_ch_layouts[o->nb_audio_ch_layouts - 1].u.str, 0);
+ av_dict_set(&o->g->format_opts, "ch_layout", o->audio_ch_layouts.opt[o->audio_ch_layouts.nb_opt - 1].u.str, 0);
}
}
- if (o->nb_frame_rates) {
+ if (o->frame_rates.nb_opt) {
const AVClass *priv_class;
/* set the format-level framerate option;
* this is important for video grabbers, e.g. x11 */
@@ -1418,14 +1418,14 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
av_opt_find(&priv_class, "framerate", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ)) {
av_dict_set(&o->g->format_opts, "framerate",
- o->frame_rates[o->nb_frame_rates - 1].u.str, 0);
+ o->frame_rates.opt[o->frame_rates.nb_opt - 1].u.str, 0);
}
}
- if (o->nb_frame_sizes) {
- av_dict_set(&o->g->format_opts, "video_size", o->frame_sizes[o->nb_frame_sizes - 1].u.str, 0);
+ if (o->frame_sizes.nb_opt) {
+ av_dict_set(&o->g->format_opts, "video_size", o->frame_sizes.opt[o->frame_sizes.nb_opt - 1].u.str, 0);
}
- if (o->nb_frame_pix_fmts)
- av_dict_set(&o->g->format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0);
+ if (o->frame_pix_fmts.nb_opt)
+ av_dict_set(&o->g->format_opts, "pixel_format", o->frame_pix_fmts.opt[o->frame_pix_fmts.nb_opt - 1].u.str, 0);
MATCH_PER_TYPE_OPT(codec_names, str, video_codec_name, ic, "v");
MATCH_PER_TYPE_OPT(codec_names, str, audio_codec_name, ic, "a");
@@ -1649,14 +1649,14 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
}
av_dict_free(&unused_opts);
- for (i = 0; i < o->nb_dump_attachment; i++) {
+ for (i = 0; i < o->dump_attachment.nb_opt; i++) {
int j;
for (j = 0; j < f->nb_streams; j++) {
InputStream *ist = f->streams[j];
- if (check_stream_specifier(ic, ist->st, o->dump_attachment[i].specifier) == 1) {
- ret = dump_attachment(ist, o->dump_attachment[i].u.str);
+ if (check_stream_specifier(ic, ist->st, o->dump_attachment.opt[i].specifier) == 1) {
+ ret = dump_attachment(ist, o->dump_attachment.opt[i].u.str);
if (ret < 0)
return ret;
}
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 52eca9f9d5..6e6e8b8b6a 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1362,8 +1362,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
ms->max_frames = INT64_MAX;
MATCH_PER_STREAM_OPT(max_frames, i64, ms->max_frames, oc, st);
- for (i = 0; i<o->nb_max_frames; i++) {
- char *p = o->max_frames[i].specifier;
+ for (i = 0; i < o->max_frames.nb_opt; i++) {
+ char *p = o->max_frames.opt[i].specifier;
if (!*p && type != AVMEDIA_TYPE_VIDEO) {
av_log(ost, AV_LOG_WARNING, "Applying unspecific -frames to non video streams, maybe you meant -vframes ?\n");
break;
@@ -2018,17 +2018,17 @@ static int of_add_programs(Muxer *mux, const OptionsContext *o)
{
AVFormatContext *oc = mux->fc;
/* process manually set programs */
- for (int i = 0; i < o->nb_program; i++) {
+ for (int i = 0; i < o->program.nb_opt; i++) {
AVDictionary *dict = NULL;
const AVDictionaryEntry *e;
AVProgram *program;
int ret, progid = i + 1;
- ret = av_dict_parse_string(&dict, o->program[i].u.str, "=", ":",
+ ret = av_dict_parse_string(&dict, o->program.opt[i].u.str, "=", ":",
AV_DICT_MULTIKEY);
if (ret < 0) {
av_log(mux, AV_LOG_ERROR, "Error parsing program specification %s\n",
- o->program[i].u.str);
+ o->program.opt[i].u.str);
return ret;
}
@@ -2116,21 +2116,21 @@ static int parse_meta_type(void *logctx, const char *arg,
static int of_add_metadata(OutputFile *of, AVFormatContext *oc,
const OptionsContext *o)
{
- for (int i = 0; i < o->nb_metadata; i++) {
+ for (int i = 0; i < o->metadata.nb_opt; i++) {
AVDictionary **m;
char type, *val;
const char *stream_spec;
int index = 0, ret = 0;
- val = strchr(o->metadata[i].u.str, '=');
+ val = strchr(o->metadata.opt[i].u.str, '=');
if (!val) {
av_log(of, AV_LOG_FATAL, "No '=' character in metadata string %s.\n",
- o->metadata[i].u.str);
+ o->metadata.opt[i].u.str);
return AVERROR(EINVAL);
}
*val++ = 0;
- ret = parse_meta_type(of, o->metadata[i].specifier, &type, &index, &stream_spec);
+ ret = parse_meta_type(of, o->metadata.opt[i].specifier, &type, &index, &stream_spec);
if (ret < 0)
return ret;
@@ -2139,7 +2139,7 @@ static int of_add_metadata(OutputFile *of, AVFormatContext *oc,
OutputStream *ost = of->streams[j];
if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {
#if FFMPEG_ROTATION_METADATA
- if (!strcmp(o->metadata[i].u.str, "rotate")) {
+ if (!strcmp(o->metadata.opt[i].u.str, "rotate")) {
char *tail;
double theta = av_strtod(val, &tail);
if (!*tail) {
@@ -2154,7 +2154,7 @@ static int of_add_metadata(OutputFile *of, AVFormatContext *oc,
"instead.");
} else {
#endif
- av_dict_set(&oc->streams[j]->metadata, o->metadata[i].u.str, *val ? val : NULL, 0);
+ av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
#if FFMPEG_ROTATION_METADATA
}
#endif
@@ -2181,10 +2181,10 @@ static int of_add_metadata(OutputFile *of, AVFormatContext *oc,
m = &oc->programs[index]->metadata;
break;
default:
- av_log(of, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier);
+ av_log(of, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata.opt[i].specifier);
return AVERROR(EINVAL);
}
- av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
+ av_dict_set(m, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
}
}
@@ -2332,9 +2332,9 @@ static int copy_meta(Muxer *mux, const OptionsContext *o)
int ret;
/* copy metadata */
- for (int i = 0; i < o->nb_metadata_map; i++) {
+ for (int i = 0; i < o->metadata_map.nb_opt; i++) {
char *p;
- int in_file_index = strtol(o->metadata_map[i].u.str, &p, 0);
+ int in_file_index = strtol(o->metadata_map.opt[i].u.str, &p, 0);
if (in_file_index >= nb_input_files) {
av_log(mux, AV_LOG_FATAL, "Invalid input file index %d while "
@@ -2343,7 +2343,7 @@ static int copy_meta(Muxer *mux, const OptionsContext *o)
}
ret = copy_metadata(mux,
in_file_index >= 0 ? input_files[in_file_index]->ctx : NULL,
- o->metadata_map[i].specifier, *p ? p + 1 : p,
+ o->metadata_map.opt[i].specifier, *p ? p + 1 : p,
&metadata_global_manual, &metadata_streams_manual,
&metadata_chapters_manual);
if (ret < 0)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 6f997a803a..653f62770e 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -110,15 +110,14 @@ static void uninit_options(OptionsContext *o)
void *dst = (uint8_t*)o + po->u.off;
if (po->flags & OPT_FLAG_SPEC) {
- SpecifierOpt **so = dst;
- int i, *count = (int*)(so + 1);
- for (i = 0; i < *count; i++) {
- av_freep(&(*so)[i].specifier);
+ SpecifierOptList *so = dst;
+ for (int i = 0; i < so->nb_opt; i++) {
+ av_freep(&so->opt[i].specifier);
if (po->type == OPT_TYPE_STRING)
- av_freep(&(*so)[i].u.str);
+ av_freep(&so->opt[i].u.str);
}
- av_freep(so);
- *count = 0;
+ av_freep(&so->opt);
+ so->nb_opt = 0;
} else if (po->flags & OPT_FLAG_OFFSET && po->type == OPT_TYPE_STRING)
av_freep(dst);
po++;
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 11/20] fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a function
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (8 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 10/20] fftools/cmdutils: add a struct for a list of SpecifierOpt Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 12/20] fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE() Anton Khirnov
` (8 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
There is no reason for it to be a macro anymore, this makes the code
using it cleaner and simpler.
---
fftools/cmdutils.c | 6 +++++-
fftools/cmdutils.h | 2 ++
fftools/ffmpeg.h | 11 ++---------
fftools/ffmpeg_demux.c | 16 ++++++++--------
fftools/ffmpeg_mux_init.c | 4 ++--
fftools/ffmpeg_opt.c | 17 ++++++++++++++---
6 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f53c4b7aec..26e5e6e986 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -239,14 +239,15 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
* a global var*/
void *dst = po->flags & OPT_FLAG_OFFSET ?
(uint8_t *)optctx + po->u.off : po->u.dst_ptr;
+ SpecifierOptList *sol = NULL;
double num;
int ret;
if (po->flags & OPT_FLAG_SPEC) {
- SpecifierOptList *sol = dst;
char *p = strchr(opt, ':');
char *str;
+ sol = dst;
ret = GROW_ARRAY(sol->opt, sol->nb_opt);
if (ret < 0)
return ret;
@@ -312,6 +313,9 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
if (po->flags & OPT_EXIT)
return AVERROR_EXIT;
+ if (sol)
+ sol->type = po->type;
+
return 0;
}
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 8ef9a07e9e..db91b788f8 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -117,6 +117,8 @@ typedef struct SpecifierOpt {
typedef struct SpecifierOptList {
SpecifierOpt *opt;
int nb_opt;
+
+ enum OptionType type;
} SpecifierOptList;
typedef struct OptionDef {
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 94f70f7efb..9905d16095 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -802,15 +802,8 @@ void update_benchmark(const char *fmt, ...);
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
}
-#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
-{\
- int i;\
- for (i = 0; i < o->name.nb_opt; i++) {\
- char *spec = o->name.opt[i].specifier;\
- if (!strcmp(spec, mediatype))\
- outvar = o->name.opt[i].u.type;\
- }\
-}
+const char *opt_match_per_type_str(const SpecifierOptList *sol,
+ char mediatype);
extern const char * const opt_name_codec_names[];
extern const char * const opt_name_codec_tags[];
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 6672113bca..5594286a79 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1334,10 +1334,10 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
int64_t timestamp;
AVDictionary *unused_opts = NULL;
const AVDictionaryEntry *e = NULL;
- char * video_codec_name = NULL;
- char * audio_codec_name = NULL;
- char *subtitle_codec_name = NULL;
- char * data_codec_name = NULL;
+ const char* video_codec_name = NULL;
+ const char* audio_codec_name = NULL;
+ const char* subtitle_codec_name = NULL;
+ const char* data_codec_name = NULL;
int scan_all_pmts_set = 0;
int64_t start_time = o->start_time;
@@ -1427,10 +1427,10 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
if (o->frame_pix_fmts.nb_opt)
av_dict_set(&o->g->format_opts, "pixel_format", o->frame_pix_fmts.opt[o->frame_pix_fmts.nb_opt - 1].u.str, 0);
- MATCH_PER_TYPE_OPT(codec_names, str, video_codec_name, ic, "v");
- MATCH_PER_TYPE_OPT(codec_names, str, audio_codec_name, ic, "a");
- MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, ic, "s");
- MATCH_PER_TYPE_OPT(codec_names, str, data_codec_name, ic, "d");
+ video_codec_name = opt_match_per_type_str(&o->codec_names, 'v');
+ audio_codec_name = opt_match_per_type_str(&o->codec_names, 'a');
+ subtitle_codec_name = opt_match_per_type_str(&o->codec_names, 's');
+ data_codec_name = opt_match_per_type_str(&o->codec_names, 'd');
if (video_codec_name)
ret = err_merge(ret, find_codec(NULL, video_codec_name , AVMEDIA_TYPE_VIDEO , 0,
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 6e6e8b8b6a..6dbee50d1c 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1611,10 +1611,10 @@ static int map_auto_audio(Muxer *mux, const OptionsContext *o)
static int map_auto_subtitle(Muxer *mux, const OptionsContext *o)
{
AVFormatContext *oc = mux->fc;
- char *subtitle_codec_name = NULL;
+ const char *subtitle_codec_name = NULL;
/* subtitles: pick first */
- MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
+ subtitle_codec_name = opt_match_per_type_str(&o->codec_names, 's');
if (!avcodec_find_encoder(oc->oformat->subtitle_codec) && !subtitle_codec_name)
return 0;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 653f62770e..567eff917e 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -182,6 +182,19 @@ AVDictionary *strip_specifiers(const AVDictionary *dict)
return ret;
}
+const char *opt_match_per_type_str(const SpecifierOptList *sol,
+ char mediatype)
+{
+ av_assert0(!sol->nb_opt || sol->type == OPT_TYPE_STRING);
+
+ for (int i = 0; i < sol->nb_opt; i++) {
+ const char *spec = sol->opt[i].specifier;
+ if (spec[0] == mediatype && !spec[1])
+ return sol->opt[i].u.str;
+ }
+ return NULL;
+}
+
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
{
if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR;
@@ -1019,9 +1032,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
const char *codec_name = NULL;
int ret = 0;
- tmp_line[0] = *opt;
- tmp_line[1] = 0;
- MATCH_PER_TYPE_OPT(codec_names, str, codec_name, NULL, tmp_line);
+ codec_name = opt_match_per_type_str(&o->codec_names, *opt);
if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
if(!strncmp(arg, "libx264-lossless", strlen("libx264-lossless"))){
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 12/20] fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE()
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (9 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 11/20] fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a function Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 13/20] fftools/ffmpeg_opt: update program description to match manpage Anton Khirnov
` (7 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Currently it requires every single OPT_SPEC option to be accompanied by
an array of alternate names for this option. The vast majority of
options have no alternate names, resulting in a large numbers of
unnecessary single-element arrays that merely contain the option name.
Extend the option parsing API to allow marking options as having
alternate names, or as being the canonical name for some existing
alternatives. Use this new information to avoid the need for
abovementioned unnecessary single-element arrays.
---
fftools/cmdutils.c | 13 +--
fftools/cmdutils.h | 21 ++++-
fftools/ffmpeg.h | 29 +++----
fftools/ffmpeg_demux.c | 14 ----
fftools/ffmpeg_mux_init.c | 41 ----------
fftools/ffmpeg_opt.c | 165 ++++++++++++++++++++++----------------
6 files changed, 139 insertions(+), 144 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 26e5e6e986..44228ea637 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -233,7 +233,7 @@ static int opt_has_arg(const OptionDef *o)
}
static int write_option(void *optctx, const OptionDef *po, const char *opt,
- const char *arg)
+ const char *arg, const OptionDef *defs)
{
/* new-style options contain an offset into optctx, old-style address of
* a global var*/
@@ -313,8 +313,11 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
if (po->flags & OPT_EXIT)
return AVERROR_EXIT;
- if (sol)
+ if (sol) {
sol->type = po->type;
+ sol->opt_canon = (po->flags & OPT_HAS_CANON) ?
+ find_option(defs, po->u1.name_canon) : po;
+ }
return 0;
}
@@ -352,7 +355,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
return AVERROR(EINVAL);
}
- ret = write_option(optctx, po, opt, arg);
+ ret = write_option(optctx, po, opt, arg, options);
if (ret < 0)
return ret;
@@ -395,7 +398,7 @@ int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
return 0;
}
-int parse_optgroup(void *optctx, OptionGroup *g)
+int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs)
{
int i, ret;
@@ -418,7 +421,7 @@ int parse_optgroup(void *optctx, OptionGroup *g)
av_log(NULL, AV_LOG_DEBUG, "Applying option %s (%s) with argument %s.\n",
o->key, o->opt->help, o->val);
- ret = write_option(optctx, o->opt, o->key, o->val);
+ ret = write_option(optctx, o->opt, o->key, o->val, defs);
if (ret < 0)
return ret;
}
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index db91b788f8..53227abb47 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -118,6 +118,8 @@ typedef struct SpecifierOptList {
SpecifierOpt *opt;
int nb_opt;
+ /* Canonical option definition that was parsed into this list. */
+ const struct OptionDef *opt_canon;
enum OptionType type;
} SpecifierOptList;
@@ -160,6 +162,14 @@ typedef struct OptionDef {
* output, or both. */
#define OPT_INPUT (1 << 10)
#define OPT_OUTPUT (1 << 11)
+
+/* This option is a "canonical" form, to which one or more alternatives
+ * exist. These alternatives are listed in u1.names_alt. */
+#define OPT_HAS_ALT (1 << 12)
+/* This option is an alternative form of some other option, whose
+ * name is stored in u1.name_canon */
+#define OPT_HAS_CANON (1 << 13)
+
union {
void *dst_ptr;
int (*func_arg)(void *, const char *, const char *);
@@ -167,6 +177,15 @@ typedef struct OptionDef {
} u;
const char *help;
const char *argname;
+
+ union {
+ /* Name of the canonical form of this option.
+ * Is valid when OPT_HAS_CANON is set. */
+ const char *name_canon;
+ /* A NULL-terminated list of alternate forms of this option.
+ * Is valid when OPT_HAS_ALT is set. */
+ const char * const *names_alt;
+ } u1;
} OptionDef;
/**
@@ -281,7 +300,7 @@ typedef struct OptionParseContext {
*
* @param optctx an app-specific options context. NULL for global options group
*/
-int parse_optgroup(void *optctx, OptionGroup *g);
+int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs);
/**
* Split the commandline into an intermediate form convenient for further
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 9905d16095..1a8254d422 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -775,43 +775,40 @@ void update_benchmark(const char *fmt, ...);
#define SPECIFIER_OPT_FMT_f "%f"
#define SPECIFIER_OPT_FMT_dbl "%lf"
-#define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
+#define WARN_MULTIPLE_OPT_USAGE(optname, type, idx, st)\
{\
char namestr[128] = "";\
+ const SpecifierOpt *so = &o->optname.opt[idx];\
const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
- for (int _i = 0; opt_name_##name[_i]; _i++)\
- av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\
+ snprintf(namestr, sizeof(namestr), "-%s", o->optname.opt_canon->name);\
+ if (o->optname.opt_canon->flags & OPT_HAS_ALT) {\
+ const char * const *names_alt = o->optname.opt_canon->u1.names_alt;\
+ for (int _i = 0; names_alt[_i]; _i++)\
+ av_strlcatf(namestr, sizeof(namestr), "/-%s", names_alt[_i]);\
+ }\
av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
- namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
+ namestr, st->index, o->optname.opt_canon->name, spec[0] ? ":" : "", spec, so->u.type);\
}
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
{\
- int _ret, _matches = 0;\
- SpecifierOpt *so;\
+ int _ret, _matches = 0, _match_idx;\
for (int _i = 0; _i < o->name.nb_opt; _i++) {\
char *spec = o->name.opt[_i].specifier;\
if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
outvar = o->name.opt[_i].u.type;\
- so = &o->name.opt[_i];\
+ _match_idx = _i;\
_matches++;\
} else if (_ret < 0)\
return _ret;\
}\
- if (_matches > 1)\
- WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
+ if (_matches > 1 && o->name.opt_canon)\
+ WARN_MULTIPLE_OPT_USAGE(name, type, _match_idx, st);\
}
const char *opt_match_per_type_str(const SpecifierOptList *sol,
char mediatype);
-extern const char * const opt_name_codec_names[];
-extern const char * const opt_name_codec_tags[];
-extern const char * const opt_name_frame_rates[];
-#if FFMPEG_OPT_TOP
-extern const char * const opt_name_top_field_first[];
-#endif
-
void *muxer_thread(void *arg);
void *decoder_thread(void *arg);
void *encoder_thread(void *arg);
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 5594286a79..6e6be149ff 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -38,20 +38,6 @@
#include "libavformat/avformat.h"
-static const char *const opt_name_discard[] = {"discard", NULL};
-static const char *const opt_name_reinit_filters[] = {"reinit_filter", NULL};
-static const char *const opt_name_fix_sub_duration[] = {"fix_sub_duration", NULL};
-static const char *const opt_name_canvas_sizes[] = {"canvas_size", NULL};
-static const char *const opt_name_guess_layout_max[] = {"guess_layout_max", NULL};
-static const char *const opt_name_ts_scale[] = {"itsscale", NULL};
-static const char *const opt_name_hwaccels[] = {"hwaccel", NULL};
-static const char *const opt_name_hwaccel_devices[] = {"hwaccel_device", NULL};
-static const char *const opt_name_hwaccel_output_formats[] = {"hwaccel_output_format", NULL};
-static const char *const opt_name_autorotate[] = {"autorotate", NULL};
-static const char *const opt_name_display_rotations[] = {"display_rotation", NULL};
-static const char *const opt_name_display_hflips[] = {"display_hflip", NULL};
-static const char *const opt_name_display_vflips[] = {"display_vflip", NULL};
-
typedef struct DemuxStream {
InputStream ist;
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 6dbee50d1c..5ab3f14a01 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -49,47 +49,6 @@
#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
-static const char *const opt_name_apad[] = {"apad", NULL};
-static const char *const opt_name_autoscale[] = {"autoscale", NULL};
-static const char *const opt_name_bits_per_raw_sample[] = {"bits_per_raw_sample", NULL};
-static const char *const opt_name_bitstream_filters[] = {"bsf", "absf", "vbsf", NULL};
-static const char *const opt_name_copy_initial_nonkeyframes[] = {"copyinkf", NULL};
-static const char *const opt_name_copy_prior_start[] = {"copypriorss", NULL};
-static const char *const opt_name_disposition[] = {"disposition", NULL};
-static const char *const opt_name_enc_time_bases[] = {"enc_time_base", NULL};
-static const char *const opt_name_enc_stats_pre[] = {"enc_stats_pre", NULL};
-static const char *const opt_name_enc_stats_post[] = {"enc_stats_post", NULL};
-static const char *const opt_name_mux_stats[] = {"mux_stats", NULL};
-static const char *const opt_name_enc_stats_pre_fmt[] = {"enc_stats_pre_fmt", NULL};
-static const char *const opt_name_enc_stats_post_fmt[] = {"enc_stats_post_fmt", NULL};
-static const char *const opt_name_mux_stats_fmt[] = {"mux_stats_fmt", NULL};
-static const char *const opt_name_filters[] = {"filter", "af", "vf", NULL};
-static const char *const opt_name_filter_scripts[] = {"filter_script", NULL};
-static const char *const opt_name_fix_sub_duration_heartbeat[] = {"fix_sub_duration_heartbeat", NULL};
-static const char *const opt_name_fps_mode[] = {"fps_mode", NULL};
-static const char *const opt_name_force_fps[] = {"force_fps", NULL};
-static const char *const opt_name_forced_key_frames[] = {"forced_key_frames", NULL};
-static const char *const opt_name_frame_aspect_ratios[] = {"aspect", NULL};
-static const char *const opt_name_intra_matrices[] = {"intra_matrix", NULL};
-static const char *const opt_name_inter_matrices[] = {"inter_matrix", NULL};
-static const char *const opt_name_chroma_intra_matrices[] = {"chroma_intra_matrix", NULL};
-static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL};
-static const char *const opt_name_max_frames[] = {"frames", "aframes", "vframes", "dframes", NULL};
-static const char *const opt_name_max_muxing_queue_size[] = {"max_muxing_queue_size", NULL};
-static const char *const opt_name_muxing_queue_data_threshold[] = {"muxing_queue_data_threshold", NULL};
-static const char *const opt_name_pass[] = {"pass", NULL};
-static const char *const opt_name_passlogfiles[] = {"passlogfile", NULL};
-static const char *const opt_name_presets[] = {"pre", "apre", "vpre", "spre", NULL};
-static const char *const opt_name_qscale[] = {"q", "qscale", NULL};
-static const char *const opt_name_rc_overrides[] = {"rc_override", NULL};
-static const char *const opt_name_time_bases[] = {"time_base", NULL};
-static const char *const opt_name_audio_channels[] = {"ac", NULL};
-static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", "ch_layout", NULL};
-static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
-static const char *const opt_name_frame_sizes[] = {"s", NULL};
-static const char *const opt_name_frame_pix_fmts[] = {"pix_fmt", NULL};
-static const char *const opt_name_sample_fmts[] = {"sample_fmt", NULL};
-
static int check_opt_bitexact(void *ctx, const AVDictionary *opts,
const char *opt_name, int flag)
{
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 567eff917e..8b2c30e2e6 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -54,13 +54,6 @@
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
-const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
-const char *const opt_name_frame_rates[] = {"r", NULL};
-const char *const opt_name_codec_tags[] = {"tag", "atag", "vtag", "stag", NULL};
-#if FFMPEG_OPT_TOP
-const char *const opt_name_top_field_first[] = {"top", NULL};
-#endif
-
HWDevice *filter_hw_device;
char *vstats_filename;
@@ -1289,7 +1282,7 @@ static int open_files(OptionGroupList *l, const char *inout, Scheduler *sch,
init_options(&o);
o.g = g;
- ret = parse_optgroup(&o, g);
+ ret = parse_optgroup(&o, g, options);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file "
"%s.\n", inout, g->arg);
@@ -1328,7 +1321,7 @@ int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
}
/* apply global options */
- ret = parse_optgroup(sch, &octx.global_opts);
+ ret = parse_optgroup(sch, &octx.global_opts, options);
if (ret < 0) {
errmsg = "parsing global options";
goto fail;
@@ -1430,6 +1423,15 @@ static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
}
#endif
+static const char *const alt_bsf[] = { "absf", "vbsf", NULL };
+static const char *const alt_channel_layout[] = { "ch_layout", NULL};
+static const char *const alt_codec[] = { "c", "acodec", "vcodec", "scodec", "dcodec", NULL };
+static const char *const alt_filter[] = { "af", "vf", NULL };
+static const char *const alt_frames[] = { "aframes", "vframes", "dframes", NULL };
+static const char *const alt_pre[] = { "apre", "vpre", "spre", NULL};
+static const char *const alt_qscale[] = { "q", NULL};
+static const char *const alt_tag[] = { "atag", "vtag", "stag", NULL };
+
#define OFFSET(x) offsetof(OptionsContext, x)
const OptionDef options[] = {
/* main options */
@@ -1452,15 +1454,18 @@ const OptionDef options[] = {
{ "recast_media", OPT_TYPE_BOOL, OPT_EXPERT,
{ &recast_media },
"allow recasting stream type in order to force a decoder of different media type" },
- { "c", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { "c", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .off = OFFSET(codec_names) },
- "codec name", "codec" },
- { "codec", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ "codec name", "codec",
+ .u1.name_canon = "codec", },
+ { "codec", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_HAS_ALT,
{ .off = OFFSET(codec_names) },
- "codec name", "codec" },
- { "pre", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ "codec name", "codec",
+ .u1.names_alt = alt_codec, },
+ { "pre", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_HAS_ALT,
{ .off = OFFSET(presets) },
- "preset name", "preset" },
+ "preset name", "preset",
+ .u1.names_alt = alt_pre, },
{ "map", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_map },
"set input stream mapping",
@@ -1512,9 +1517,10 @@ const OptionDef options[] = {
{ "program", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(program) },
"add program with specified streams", "title=string:st=number..." },
- { "dframes", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
+ { "dframes", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_data_frames },
- "set the number of data frames to output", "number" },
+ "set the number of data frames to output", "number",
+ .u1.name_canon = "frames" },
{ "benchmark", OPT_TYPE_BOOL, OPT_EXPERT,
{ &do_benchmark },
"add timings for benchmarking" },
@@ -1594,24 +1600,29 @@ const OptionDef options[] = {
{ "copypriorss", OPT_TYPE_INT, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(copy_prior_start) },
"copy or discard frames before start time" },
- { "frames", OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT,
+ { "frames", OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT | OPT_HAS_ALT,
{ .off = OFFSET(max_frames) },
- "set the number of frames to output", "number" },
- { "tag", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT,
+ "set the number of frames to output", "number",
+ .u1.names_alt = alt_frames, },
+ { "tag", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT | OPT_HAS_ALT,
{ .off = OFFSET(codec_tags) },
- "force codec tag/fourcc", "fourcc/tag" },
- { "q", OPT_TYPE_DOUBLE, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+ "force codec tag/fourcc", "fourcc/tag",
+ .u1.names_alt = alt_tag, },
+ { "q", OPT_TYPE_DOUBLE, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT | OPT_HAS_CANON,
{ .off = OFFSET(qscale) },
- "use fixed quality scale (VBR)", "q" },
- { "qscale", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ "use fixed quality scale (VBR)", "q",
+ .u1.name_canon = "qscale", },
+ { "qscale", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_ALT,
{ .func_arg = opt_qscale },
- "use fixed quality scale (VBR)", "q" },
+ "use fixed quality scale (VBR)", "q",
+ .u1.names_alt = alt_qscale, },
{ "profile", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_profile },
"set profile", "profile" },
- { "filter", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { "filter", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_HAS_ALT,
{ .off = OFFSET(filters) },
- "set stream filtergraph", "filter_graph" },
+ "set stream filtergraph", "filter_graph",
+ .u1.names_alt = alt_filter, },
{ "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG,
{ .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
@@ -1692,9 +1703,10 @@ const OptionDef options[] = {
"format of the stats written with -stats_mux_pre" },
/* video options */
- { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_video_frames },
- "set the number of video frames to output", "number" },
+ "set the number of video frames to output", "number",
+ .u1.name_canon = "frames", },
{ "r", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(frame_rates) },
"set frame rate (Hz value, fraction or abbreviation)", "rate" },
@@ -1728,9 +1740,10 @@ const OptionDef options[] = {
{ "rc_override", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(rc_overrides) },
"rate control override for specific intervals", "override" },
- { "vcodec", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "vcodec", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_video_codec },
- "force video codec ('copy' to copy stream)", "codec" },
+ "force video codec ('copy' to copy stream)", "codec",
+ .u1.name_canon = "codec", },
{ "timecode", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_timecode },
"set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
@@ -1749,9 +1762,10 @@ const OptionDef options[] = {
{ "vstats_version", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT,
{ &vstats_version },
"Version of the vstats format to use."},
- { "vf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "vf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_video_filters },
- "set video filters", "filter_graph" },
+ "set video filters", "filter_graph",
+ .u1.name_canon = "filter", },
{ "intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(intra_matrices) },
"specify intra matrix coeffs", "matrix" },
@@ -1761,9 +1775,10 @@ const OptionDef options[] = {
{ "chroma_intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(chroma_intra_matrices) },
"specify intra matrix coeffs", "matrix" },
- { "vtag", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "vtag", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_old2new },
- "force video tag/fourcc", "fourcc/tag" },
+ "force video tag/fourcc", "fourcc/tag",
+ .u1.name_canon = "tag", },
{ "fps_mode", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(fps_mode) },
"set framerate mode for matching video streams; overrides vsync" },
@@ -1804,9 +1819,10 @@ const OptionDef options[] = {
"random access points" },
/* audio options */
- { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_audio_frames },
- "set the number of audio frames to output", "number" },
+ "set the number of audio frames to output", "number",
+ .u1.name_canon = "frames", },
{ "aq", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_audio_qscale },
"set audio quality (codec-specific)", "quality", },
@@ -1819,27 +1835,32 @@ const OptionDef options[] = {
{ "an", OPT_TYPE_BOOL, OPT_AUDIO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(audio_disable) },
"disable audio" },
- { "acodec", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "acodec", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_audio_codec },
- "force audio codec ('copy' to copy stream)", "codec" },
+ "force audio codec ('copy' to copy stream)", "codec",
+ .u1.name_canon = "codec", },
{ "ab", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_bitrate },
"audio bitrate (please use -b:a)", "bitrate" },
- { "atag", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ { "atag", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_old2new },
- "force audio tag/fourcc", "fourcc/tag" },
+ "force audio tag/fourcc", "fourcc/tag",
+ .u1.name_canon = "tag", },
{ "sample_fmt", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(sample_fmts) },
"set sample format", "format" },
- { "channel_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ { "channel_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_HAS_ALT,
{ .off = OFFSET(audio_ch_layouts) },
- "set channel layout", "layout" },
- { "ch_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+ "set channel layout", "layout",
+ .u1.names_alt = alt_channel_layout, },
+ { "ch_layout", OPT_TYPE_STRING, OPT_AUDIO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .off = OFFSET(audio_ch_layouts) },
- "set channel layout", "layout" },
- { "af", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ "set channel layout", "layout",
+ .u1.name_canon = "channel_layout", },
+ { "af", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_audio_filters },
- "set audio filters", "filter_graph" },
+ "set audio filters", "filter_graph",
+ .u1.name_canon = "filter", },
{ "guess_layout_max", OPT_TYPE_INT, OPT_AUDIO | OPT_SPEC | OPT_EXPERT | OPT_INPUT,
{ .off = OFFSET(guess_layout_max) },
"set the maximum number of channels to try to guess the channel layout" },
@@ -1848,12 +1869,14 @@ const OptionDef options[] = {
{ "sn", OPT_TYPE_BOOL, OPT_SUBTITLE | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(subtitle_disable) },
"disable subtitle" },
- { "scodec", OPT_TYPE_FUNC, OPT_SUBTITLE | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+ { "scodec", OPT_TYPE_FUNC, OPT_SUBTITLE | OPT_FUNC_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_subtitle_codec },
- "force subtitle codec ('copy' to copy stream)", "codec" },
- { "stag", OPT_TYPE_FUNC, OPT_SUBTITLE | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
+ "force subtitle codec ('copy' to copy stream)", "codec",
+ .u1.name_canon = "codec", },
+ { "stag", OPT_TYPE_FUNC, OPT_SUBTITLE | OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_old2new }
- , "force subtitle tag/fourcc", "fourcc/tag" },
+ , "force subtitle tag/fourcc", "fourcc/tag",
+ .u1.name_canon = "tag" },
{ "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
{ .off = OFFSET(fix_sub_duration) },
"fix subtitles duration" },
@@ -1882,28 +1905,35 @@ const OptionDef options[] = {
"0 = use frame rate (video) or sample rate (audio),"
"-1 = match source time base", "ratio" },
- { "bsf", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+ { "bsf", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_HAS_ALT,
{ .off = OFFSET(bitstream_filters) },
- "A comma-separated list of bitstream filters", "bitstream_filters" },
- { "absf", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ "A comma-separated list of bitstream filters", "bitstream_filters",
+ .u1.names_alt = alt_bsf, },
+ { "absf", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_old2new },
- "deprecated", "audio bitstream_filters" },
- { "vbsf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ "deprecated", "audio bitstream_filters",
+ .u1.name_canon = "bsf", },
+ { "vbsf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_old2new },
- "deprecated", "video bitstream_filters" },
+ "deprecated", "video bitstream_filters",
+ .u1.name_canon = "bsf", },
- { "apre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ { "apre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_preset },
- "set the audio options to the indicated preset", "preset" },
- { "vpre", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ "set the audio options to the indicated preset", "preset",
+ .u1.name_canon = "pre", },
+ { "vpre", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_preset },
- "set the video options to the indicated preset", "preset" },
- { "spre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ "set the video options to the indicated preset", "preset",
+ .u1.name_canon = "pre", },
+ { "spre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_preset },
- "set the subtitle options to the indicated preset", "preset" },
- { "fpre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT,
+ "set the subtitle options to the indicated preset", "preset",
+ .u1.name_canon = "pre", },
+ { "fpre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_preset },
- "set options from indicated preset file", "filename" },
+ "set options from indicated preset file", "filename",
+ .u1.name_canon = "pre", },
{ "max_muxing_queue_size", OPT_TYPE_INT, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
{ .off = OFFSET(max_muxing_queue_size) },
@@ -1913,9 +1943,10 @@ const OptionDef options[] = {
"set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
/* data codec support */
- { "dcodec", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
+ { "dcodec", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_data_codec },
- "force data codec ('copy' to copy stream)", "codec" },
+ "force data codec ('copy' to copy stream)", "codec",
+ .u1.name_canon = "codec", },
{ "dn", OPT_TYPE_BOOL, OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(data_disable) }, "disable data" },
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 13/20] fftools/ffmpeg_opt: update program description to match manpage
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (10 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 12/20] fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE() Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 14/20] fftools/opt_common: mark some options as OPT_EXPERT Anton Khirnov
` (6 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Cf. 2244722f1f3
---
fftools/ffmpeg_opt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 8b2c30e2e6..eee12df893 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1254,7 +1254,7 @@ void show_help_default(const char *opt, const char *arg)
void show_usage(void)
{
- av_log(NULL, AV_LOG_INFO, "Hyper fast Audio and Video encoder\n");
+ av_log(NULL, AV_LOG_INFO, "Universal media converter\n");
av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
av_log(NULL, AV_LOG_INFO, "\n");
}
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 14/20] fftools/opt_common: mark some options as OPT_EXPERT
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (11 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 13/20] fftools/ffmpeg_opt: update program description to match manpage Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 15/20] fftools/ffmpeg_opt: mark more " Anton Khirnov
` (5 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
So they don't clutter the standard help output.
-loglevel is marked because there is no need to show two options (-v and
-loglevel) that do the same thing.
---
fftools/opt_common.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fftools/opt_common.h b/fftools/opt_common.h
index e82ada5581..36c591cc94 100644
--- a/fftools/opt_common.h
+++ b/fftools/opt_common.h
@@ -219,10 +219,10 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg);
{ "sample_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "dispositions", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
{ "colors", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
- { "loglevel", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
+ { "loglevel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "v", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
- { "report", OPT_TYPE_FUNC, 0, { .func_arg = opt_report }, "generate a report" }, \
- { "max_alloc", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
+ { "report", OPT_TYPE_FUNC, OPT_EXPERT, { .func_arg = opt_report }, "generate a report" }, \
+ { "max_alloc", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
{ "cpuflags", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
{ "cpucount", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
{ "hide_banner", OPT_TYPE_BOOL, OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 15/20] fftools/ffmpeg_opt: mark more options as OPT_EXPERT
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (12 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 14/20] fftools/opt_common: mark some options as OPT_EXPERT Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 16/20] fftools/ffmpeg_opt: refine printing type-specific options Anton Khirnov
` (4 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Reduces the basic help output to a reasonable size and stops confusing
users with options the vast majority will not need.
---
fftools/ffmpeg_opt.c | 56 ++++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index eee12df893..6656aa631c 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1445,7 +1445,7 @@ const OptionDef options[] = {
{ "n", OPT_TYPE_BOOL, 0,
{ &no_file_overwrite },
"never overwrite output files" },
- { "ignore_unknown", OPT_TYPE_BOOL, 0,
+ { "ignore_unknown", OPT_TYPE_BOOL, OPT_EXPERT,
{ &ignore_unknown_streams },
"Ignore unknown stream types" },
{ "copy_unknown", OPT_TYPE_BOOL, OPT_EXPERT,
@@ -1458,11 +1458,11 @@ const OptionDef options[] = {
{ .off = OFFSET(codec_names) },
"codec name", "codec",
.u1.name_canon = "codec", },
- { "codec", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_HAS_ALT,
+ { "codec", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
{ .off = OFFSET(codec_names) },
"codec name", "codec",
.u1.names_alt = alt_codec, },
- { "pre", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_HAS_ALT,
+ { "pre", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
{ .off = OFFSET(presets) },
"preset name", "preset",
.u1.names_alt = alt_pre, },
@@ -1470,7 +1470,7 @@ const OptionDef options[] = {
{ .func_arg = opt_map },
"set input stream mapping",
"[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
- { "map_metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { "map_metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
{ .off = OFFSET(metadata_map) },
"set metadata information of outfile from infile",
"outfile[,metadata]:infile[,metadata]" },
@@ -1484,16 +1484,16 @@ const OptionDef options[] = {
{ "to", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(stop_time) },
"record or transcode stop time", "time_stop" },
- { "fs", OPT_TYPE_INT64, OPT_OFFSET | OPT_OUTPUT,
+ { "fs", OPT_TYPE_INT64, OPT_OFFSET | OPT_OUTPUT | OPT_EXPERT,
{ .off = OFFSET(limit_filesize) },
"set the limit file size in bytes", "limit_size" },
{ "ss", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(start_time) },
"set the start time offset", "time_off" },
- { "sseof", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT,
+ { "sseof", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(start_time_eof) },
"set the start time offset relative to EOF", "time_off" },
- { "seek_timestamp", OPT_TYPE_INT, OPT_OFFSET | OPT_INPUT,
+ { "seek_timestamp", OPT_TYPE_INT, OPT_OFFSET | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(seek_timestamp) },
"enable/disable seeking by timestamp with -ss" },
{ "accurate_seek", OPT_TYPE_BOOL, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
@@ -1508,13 +1508,13 @@ const OptionDef options[] = {
{ "itsscale", OPT_TYPE_DOUBLE, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
{ .off = OFFSET(ts_scale) },
"set the input ts scale", "scale" },
- { "timestamp", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "timestamp", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
{ .func_arg = opt_recording_timestamp },
"set the recording timestamp ('now' to set the current time)", "time" },
{ "metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(metadata) },
"add metadata", "string=string" },
- { "program", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { "program", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
{ .off = OFFSET(program) },
"add program with specified streams", "title=string:st=number..." },
{ "dframes", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT | OPT_HAS_CANON,
@@ -1551,7 +1551,7 @@ const OptionDef options[] = {
{ "readrate_initial_burst", OPT_TYPE_DOUBLE, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
{ .off = OFFSET(readrate_initial_burst) },
"The initial amount of input to burst read before imposing any readrate", "seconds" },
- { "target", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "target", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
{ .func_arg = opt_target },
"specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
@@ -1579,7 +1579,7 @@ const OptionDef options[] = {
{ "bitexact", OPT_TYPE_BOOL, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT | OPT_INPUT,
{ .off = OFFSET(bitexact) },
"bitexact mode" },
- { "apad", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { "apad", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
{ .off = OFFSET(apad) },
"audio pad", "" },
{ "dts_delta_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
@@ -1600,7 +1600,7 @@ const OptionDef options[] = {
{ "copypriorss", OPT_TYPE_INT, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(copy_prior_start) },
"copy or discard frames before start time" },
- { "frames", OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT | OPT_HAS_ALT,
+ { "frames", OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
{ .off = OFFSET(max_frames) },
"set the number of frames to output", "number",
.u1.names_alt = alt_frames, },
@@ -1623,19 +1623,19 @@ const OptionDef options[] = {
{ .off = OFFSET(filters) },
"set stream filtergraph", "filter_graph",
.u1.names_alt = alt_filter, },
- { "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG,
+ { "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
- { "filter_script", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { "filter_script", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
{ .off = OFFSET(filter_scripts) },
"read stream filtergraph description from a file", "filename" },
- { "reinit_filter", OPT_TYPE_INT, OPT_SPEC | OPT_INPUT,
+ { "reinit_filter", OPT_TYPE_INT, OPT_SPEC | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(reinit_filters) },
"reinit filtergraph on input parameter changes", "" },
{ "filter_complex", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
- { "filter_complex_threads", OPT_TYPE_INT, 0,
+ { "filter_complex_threads", OPT_TYPE_INT, OPT_EXPERT,
{ &filter_complex_nbthreads },
"number of threads for -filter_complex" },
{ "lavfi", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
@@ -1664,13 +1664,13 @@ const OptionDef options[] = {
{ "debug_ts", OPT_TYPE_BOOL, OPT_EXPERT,
{ &debug_ts },
"print timestamp debugging info" },
- { "max_error_rate", OPT_TYPE_FLOAT, 0,
+ { "max_error_rate", OPT_TYPE_FLOAT, OPT_EXPERT,
{ &max_error_rate },
"ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.", "maximum error rate" },
- { "discard", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT,
+ { "discard", OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(discard) },
"discard", "" },
- { "disposition", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
+ { "disposition", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
{ .off = OFFSET(disposition) },
"disposition", "" },
{ "thread_queue_size", OPT_TYPE_INT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
@@ -1703,14 +1703,14 @@ const OptionDef options[] = {
"format of the stats written with -stats_mux_pre" },
/* video options */
- { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
+ { "vframes", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_CANON,
{ .func_arg = opt_video_frames },
"set the number of video frames to output", "number",
.u1.name_canon = "frames", },
{ "r", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(frame_rates) },
"set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "fpsmax", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
+ { "fpsmax", OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
{ .off = OFFSET(max_frame_rates) },
"set max frame rate (Hz value, fraction or abbreviation)", "rate" },
{ "s", OPT_TYPE_STRING, OPT_VIDEO | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
@@ -1722,15 +1722,15 @@ const OptionDef options[] = {
{ "pix_fmt", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(frame_pix_fmts) },
"set pixel format", "format" },
- { "display_rotation", OPT_TYPE_DOUBLE, OPT_VIDEO | OPT_SPEC | OPT_INPUT,
+ { "display_rotation", OPT_TYPE_DOUBLE, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(display_rotations) },
"set pure counter-clockwise rotation in degrees for stream(s)",
"angle" },
- { "display_hflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_SPEC | OPT_INPUT,
+ { "display_hflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(display_hflips) },
"set display horizontal flip for stream(s) "
"(overrides any display rotation if it is not set)"},
- { "display_vflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_SPEC | OPT_INPUT,
+ { "display_vflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(display_vflips) },
"set display vertical flip for stream(s) "
"(overrides any display rotation if it is not set)"},
@@ -1744,10 +1744,10 @@ const OptionDef options[] = {
{ .func_arg = opt_video_codec },
"force video codec ('copy' to copy stream)", "codec",
.u1.name_canon = "codec", },
- { "timecode", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT,
+ { "timecode", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_EXPERT,
{ .func_arg = opt_timecode },
"set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
- { "pass", OPT_TYPE_INT, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
+ { "pass", OPT_TYPE_INT, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
{ .off = OFFSET(pass) },
"select the pass number (1 to 3)", "n" },
{ "passlogfile", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
@@ -1819,7 +1819,7 @@ const OptionDef options[] = {
"random access points" },
/* audio options */
- { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
+ { "aframes", OPT_TYPE_FUNC, OPT_AUDIO | OPT_FUNC_ARG | OPT_PERFILE | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_CANON,
{ .func_arg = opt_audio_frames },
"set the number of audio frames to output", "number",
.u1.name_canon = "frames", },
@@ -1880,7 +1880,7 @@ const OptionDef options[] = {
{ "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
{ .off = OFFSET(fix_sub_duration) },
"fix subtitles duration" },
- { "canvas_size", OPT_TYPE_STRING, OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
+ { "canvas_size", OPT_TYPE_STRING, OPT_SUBTITLE | OPT_SPEC | OPT_INPUT | OPT_EXPERT,
{ .off = OFFSET(canvas_sizes) },
"set canvas size (WxH or abbreviation)", "size" },
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 16/20] fftools/ffmpeg_opt: refine printing type-specific options
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (13 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 15/20] fftools/ffmpeg_opt: mark more " Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 17/20] fftools/ffmpeg_opt: print a section for data-stream options Anton Khirnov
` (3 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
* filter subtitle/data options out of main, video and audio sections
* add filters that were missing entirely from the subtitle section
* add a missing section for advanced subtitle options
---
fftools/ffmpeg_opt.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 6656aa631c..c8fb9d03e4 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1216,25 +1216,29 @@ void show_help_default(const char *opt, const char *arg)
OPT_PERFILE | OPT_EXIT, 0);
show_help_options(options, "Per-file main options:", 0,
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
+ OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_DATA |
OPT_EXIT, OPT_PERFILE);
if (show_advanced)
show_help_options(options, "Advanced per-file options:",
OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, OPT_PERFILE);
show_help_options(options, "Video options:",
- OPT_VIDEO, OPT_EXPERT | OPT_AUDIO, 0);
+ OPT_VIDEO, OPT_EXPERT | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA, 0);
if (show_advanced)
show_help_options(options, "Advanced Video options:",
- OPT_EXPERT | OPT_VIDEO, OPT_AUDIO, 0);
+ OPT_EXPERT | OPT_VIDEO, OPT_AUDIO | OPT_SUBTITLE | OPT_DATA, 0);
show_help_options(options, "Audio options:",
- OPT_AUDIO, OPT_EXPERT | OPT_VIDEO, 0);
+ OPT_AUDIO, OPT_EXPERT | OPT_VIDEO | OPT_SUBTITLE | OPT_DATA, 0);
if (show_advanced)
show_help_options(options, "Advanced Audio options:",
- OPT_EXPERT | OPT_AUDIO, OPT_VIDEO, 0);
+ OPT_EXPERT | OPT_AUDIO, OPT_VIDEO | OPT_SUBTITLE | OPT_DATA, 0);
+
show_help_options(options, "Subtitle options:",
- OPT_SUBTITLE, 0, 0);
+ OPT_SUBTITLE, OPT_EXPERT | OPT_VIDEO | OPT_AUDIO | OPT_DATA, 0);
+ if (show_advanced)
+ show_help_options(options, "Advanced Subtitle options:",
+ OPT_EXPERT | OPT_SUBTITLE, OPT_VIDEO | OPT_AUDIO | OPT_DATA, 0);
printf("\n");
if (show_avoptions) {
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 17/20] fftools/ffmpeg_opt: print a section for data-stream options
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (14 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 16/20] fftools/ffmpeg_opt: refine printing type-specific options Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 18/20] fftools/ffmpeg_opt: fix -dn flags Anton Khirnov
` (2 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
Only show it with show_advanced (triggered by -h long), since data
streams themselves are an advanced topic.
---
fftools/ffmpeg_opt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index c8fb9d03e4..87357e8b64 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1239,6 +1239,10 @@ void show_help_default(const char *opt, const char *arg)
if (show_advanced)
show_help_options(options, "Advanced Subtitle options:",
OPT_EXPERT | OPT_SUBTITLE, OPT_VIDEO | OPT_AUDIO | OPT_DATA, 0);
+
+ if (show_advanced)
+ show_help_options(options, "Data stream options:",
+ OPT_DATA, OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE, 0);
printf("\n");
if (show_avoptions) {
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 18/20] fftools/ffmpeg_opt: fix -dn flags
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (15 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 17/20] fftools/ffmpeg_opt: print a section for data-stream options Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg: mark -vsync for future removal Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 20/20] fftools/ffmpeg: remove deprecated -[av]bsf Anton Khirnov
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
It's a data, not video option.
---
fftools/ffmpeg_opt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 87357e8b64..d6de997af8 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1955,7 +1955,7 @@ const OptionDef options[] = {
{ .func_arg = opt_data_codec },
"force data codec ('copy' to copy stream)", "codec",
.u1.name_canon = "codec", },
- { "dn", OPT_TYPE_BOOL, OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
+ { "dn", OPT_TYPE_BOOL, OPT_DATA | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(data_disable) }, "disable data" },
#if CONFIG_VAAPI
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg: mark -vsync for future removal
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (16 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 18/20] fftools/ffmpeg_opt: fix -dn flags Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 20/20] fftools/ffmpeg: remove deprecated -[av]bsf Anton Khirnov
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
It has already been deprecated over a year ago.
---
fftools/ffmpeg.h | 1 +
fftools/ffmpeg_mux_init.c | 4 ++++
fftools/ffmpeg_opt.c | 15 ++++++++++++---
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 1a8254d422..7d55e384d3 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -61,6 +61,7 @@
#define FFMPEG_OPT_TOP 1
#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
#define FFMPEG_OPT_VSYNC_DROP 1
+#define FFMPEG_OPT_VSYNC 1
#define FFMPEG_ERROR_RATE_EXCEEDED FFERRTAG('E', 'R', 'E', 'D')
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 5ab3f14a01..f5e92de8a9 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -755,7 +755,11 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o,
av_log(ost, AV_LOG_WARNING, "-top is deprecated, use the setfield filter instead\n");
#endif
+#if FFMPEG_OPT_VSYNC
ost->vsync_method = video_sync_method;
+#else
+ ost->vsync_method = VSYNC_AUTO;
+#endif
MATCH_PER_STREAM_OPT(fps_mode, str, fps_mode, oc, st);
if (fps_mode) {
ret = parse_and_set_vsync(fps_mode, &ost->vsync_method, ost->file->index, ost->index, 0);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index d6de997af8..2984c494cd 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -62,7 +62,9 @@ float audio_drift_threshold = 0.1;
float dts_delta_threshold = 10;
float dts_error_threshold = 3600*30;
+#if FFMPEG_OPT_VSYNC
enum VideoSyncMethod video_sync_method = VSYNC_AUTO;
+#endif
float frame_drop_threshold = 0;
int do_benchmark = 0;
int do_benchmark_all = 0;
@@ -205,6 +207,7 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
return AVERROR(EINVAL);
}
+#if FFMPEG_OPT_VSYNC
if (is_global && *vsync_var == VSYNC_AUTO) {
int ret;
double num;
@@ -217,6 +220,8 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
" use a string argument as described in the manual.\n");
}
+#endif
+
return 0;
}
@@ -1136,11 +1141,13 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
return parse_option(o, "filter:a", arg, options);
}
+#if FFMPEG_OPT_VSYNC
static int opt_vsync(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_WARNING, "-vsync is deprecated. Use -fps_mode\n");
return parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1);
}
+#endif
static int opt_timecode(void *optctx, const char *opt, const char *arg)
{
@@ -1563,9 +1570,6 @@ const OptionDef options[] = {
{ .func_arg = opt_target },
"specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
- { "vsync", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
- { .func_arg = opt_vsync },
- "set video sync method globally; deprecated, use -fps_mode", "" },
{ "frame_drop_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
{ &frame_drop_threshold },
"frame drop threshold", "" },
@@ -2003,6 +2007,11 @@ const OptionDef options[] = {
{ .func_arg = opt_qphist },
"deprecated, does nothing" },
#endif
+#if FFMPEG_OPT_VSYNC
+ { "vsync", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
+ { .func_arg = opt_vsync },
+ "set video sync method globally; deprecated, use -fps_mode", "" },
+#endif
{ NULL, },
};
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
* [FFmpeg-devel] [PATCH 20/20] fftools/ffmpeg: remove deprecated -[av]bsf
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
` (17 preceding siblings ...)
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg: mark -vsync for future removal Anton Khirnov
@ 2023-12-18 9:57 ` Anton Khirnov
18 siblings, 0 replies; 20+ messages in thread
From: Anton Khirnov @ 2023-12-18 9:57 UTC (permalink / raw)
To: ffmpeg-devel
They were marked as deprecated over 10 years ago.
---
doc/ffmpeg.texi | 4 ----
fftools/ffmpeg_opt.c | 13 ++-----------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 6ecd5f3cfe..bbe70a4f85 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1054,8 +1054,6 @@ Specify which version of the vstats format to use. Default is @code{2}. See the
@item -vtag @var{fourcc/tag} (@emph{output})
Force video tag/fourcc. This is an alias for @code{-tag:v}.
-@item -vbsf @var{bitstream_filter}
-Deprecated see -bsf
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
@@ -1424,8 +1422,6 @@ This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter optio
@table @option
@item -atag @var{fourcc/tag} (@emph{output})
Force audio tag/fourcc. This is an alias for @code{-tag:a}.
-@item -absf @var{bitstream_filter}
-Deprecated, see -bsf
@item -guess_layout_max @var{channels} (@emph{input,per-stream})
If some input channel layout is not known, try to guess only if it
corresponds to at most the specified number of channels. For example, 2
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 2984c494cd..b7d636f16f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1917,18 +1917,9 @@ const OptionDef options[] = {
"0 = use frame rate (video) or sample rate (audio),"
"-1 = match source time base", "ratio" },
- { "bsf", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_HAS_ALT,
+ { "bsf", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
{ .off = OFFSET(bitstream_filters) },
- "A comma-separated list of bitstream filters", "bitstream_filters",
- .u1.names_alt = alt_bsf, },
- { "absf", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
- { .func_arg = opt_old2new },
- "deprecated", "audio bitstream_filters",
- .u1.name_canon = "bsf", },
- { "vbsf", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
- { .func_arg = opt_old2new },
- "deprecated", "video bitstream_filters",
- .u1.name_canon = "bsf", },
+ "A comma-separated list of bitstream filters", "bitstream_filters", },
{ "apre", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT | OPT_HAS_CANON,
{ .func_arg = opt_preset },
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2023-12-18 10:00 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-18 9:57 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_filter: only set framerate for video Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 02/20] fftools/ffmpeg_opt: drop HAS_ARG from auto{scale, rotate} Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 03/20] fftools/cmdutils: simplify handling of the HAS_ARG option flag Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 04/20] fftools/ffmpeg_opt: move deprecated options to the end of the list Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 05/20] fftools: split off option types from other flags Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 06/20] fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 07/20] fftools/cmdutils: renumber option flags sequentially Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 08/20] fftools/cmdutils: include OPT_PERFILE in OPT_OFFSET Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 09/20] fftools/cmdutils: check valid flags for OPT_TYPE_FUNC Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 10/20] fftools/cmdutils: add a struct for a list of SpecifierOpt Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 11/20] fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a function Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 12/20] fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE() Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 13/20] fftools/ffmpeg_opt: update program description to match manpage Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 14/20] fftools/opt_common: mark some options as OPT_EXPERT Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 15/20] fftools/ffmpeg_opt: mark more " Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 16/20] fftools/ffmpeg_opt: refine printing type-specific options Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 17/20] fftools/ffmpeg_opt: print a section for data-stream options Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 18/20] fftools/ffmpeg_opt: fix -dn flags Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg: mark -vsync for future removal Anton Khirnov
2023-12-18 9:57 ` [FFmpeg-devel] [PATCH 20/20] fftools/ffmpeg: remove deprecated -[av]bsf Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git