fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG

For consistent namespacing with other option flags. Also, document and
enforce that it can only be set for func-type options.
This commit is contained in:
Anton Khirnov 2023-12-17 10:45:45 +01:00
parent d2e479a429
commit 5b1b132072
6 changed files with 80 additions and 70 deletions

View File

@ -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++;
}
}

View File

@ -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)

View File

@ -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,
@ -1507,7 +1507,7 @@ const OptionDef options[] = {
{ "stream_group", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
{ .off = OFFSET(stream_groups) },
"add stream group with specified streams and group type-specific arguments", "id=number: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,
@ -1516,13 +1516,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,
@ -1540,11 +1540,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,
@ -1580,7 +1580,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,
@ -1598,16 +1598,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,
@ -1616,16 +1616,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,
@ -1634,10 +1634,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,
@ -1687,7 +1687,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,
@ -1723,10 +1723,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,
@ -1738,13 +1738,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,
@ -1756,7 +1756,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,
@ -1765,13 +1765,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,
@ -1799,10 +1799,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,
@ -1814,13 +1814,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,
@ -1832,7 +1832,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,
@ -1843,10 +1843,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,
@ -1863,7 +1863,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" },
@ -1880,23 +1880,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" },
@ -1908,39 +1908,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

View File

@ -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" },

View File

@ -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, },

View File

@ -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 \