[FFmpeg-devel] [PATCH 2/8] fftools/cmdutils: add a flag for per-stream options

Anton Khirnov anton at khirnov.net
Wed Jan 17 14:40:29 EET 2024


Not all OPT_SPEC options are per-stream, this will allow identifying
those that are, which will be useful in following commits.
---
 fftools/cmdutils.h   |  13 +++--
 fftools/ffmpeg_opt.c | 118 +++++++++++++++++++++----------------------
 2 files changed, 68 insertions(+), 63 deletions(-)

diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 8fa5ad4fc7..0c3b475876 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -158,17 +158,22 @@ typedef struct OptionDef {
    Always use as OPT_SPEC in option definitions. */
 #define OPT_FLAG_SPEC   (1 << 9)
 #define OPT_SPEC        (OPT_FLAG_SPEC | OPT_OFFSET)
+
+/* Option applies per-stream (implies OPT_SPEC). */
+#define OPT_FLAG_PERSTREAM  (1 << 10)
+#define OPT_PERSTREAM   (OPT_FLAG_PERSTREAM | OPT_SPEC)
+
 /* ffmpeg-only - specifies whether an OPT_PERFILE option applies to input,
  * output, or both. */
-#define OPT_INPUT       (1 << 10)
-#define OPT_OUTPUT      (1 << 11)
+#define OPT_INPUT       (1 << 11)
+#define OPT_OUTPUT      (1 << 12)
 
 /* 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)
+#define OPT_HAS_ALT     (1 << 13)
 /* This option is an alternative form of some other option, whose
  * name is stored in u1.name_canon */
-#define OPT_HAS_CANON   (1 << 13)
+#define OPT_HAS_CANON   (1 << 14)
 
      union {
         void *dst_ptr;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 6b16d92a87..4a0d126aca 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1456,15 +1456,15 @@ 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 | OPT_HAS_CANON,
+    { "c",                      OPT_TYPE_STRING, OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
         { .off       = OFFSET(codec_names) },
         "codec name", "codec",
         .u1.name_canon = "codec", },
-    { "codec",                  OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
+    { "codec",                  OPT_TYPE_STRING, OPT_PERSTREAM | 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_EXPERT | OPT_HAS_ALT,
+    { "pre",                    OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
         { .off       = OFFSET(presets) },
         "preset name", "preset",
         .u1.names_alt = alt_pre, },
@@ -1507,7 +1507,7 @@ const OptionDef options[] = {
     { "itsoffset",              OPT_TYPE_TIME, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
         { .off = OFFSET(input_ts_offset) },
         "set the input ts offset", "time_off" },
-    { "itsscale",               OPT_TYPE_DOUBLE, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+    { "itsscale",               OPT_TYPE_DOUBLE, OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT,
         { .off = OFFSET(ts_scale) },
         "set the input ts scale", "scale" },
     { "timestamp",              OPT_TYPE_FUNC,   OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT,
@@ -1581,7 +1581,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_EXPERT | OPT_OUTPUT,
+    { "apad",                   OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(apad) },
         "audio pad", "" },
     { "dts_delta_threshold",    OPT_TYPE_FLOAT, OPT_EXPERT,
@@ -1596,21 +1596,21 @@ const OptionDef options[] = {
     { "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,
+    { "copyinkf",               OPT_TYPE_BOOL, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(copy_initial_nonkeyframes) },
         "copy initial non-keyframes" },
-    { "copypriorss",            OPT_TYPE_INT, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "copypriorss",            OPT_TYPE_INT, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(copy_prior_start) },
         "copy or discard frames before start time" },
-    { "frames",                 OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
+    { "frames",                 OPT_TYPE_INT64, OPT_PERSTREAM | OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
         { .off = OFFSET(max_frames) },
         "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,
+    { "tag",                    OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT | OPT_HAS_ALT,
         { .off = OFFSET(codec_tags) },
         "force codec tag/fourcc", "fourcc/tag",
         .u1.names_alt = alt_tag, },
-    { "q",                      OPT_TYPE_DOUBLE, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT | OPT_HAS_CANON,
+    { "q",                      OPT_TYPE_DOUBLE, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT | OPT_HAS_CANON,
         { .off = OFFSET(qscale) },
         "use fixed quality scale (VBR)", "q",
         .u1.name_canon = "qscale", },
@@ -1621,7 +1621,7 @@ const OptionDef options[] = {
     { "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 | OPT_HAS_ALT,
+    { "filter",                 OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | OPT_HAS_ALT,
         { .off = OFFSET(filters) },
         "set stream filtergraph", "filter_graph",
         .u1.names_alt = alt_filter, },
@@ -1629,11 +1629,11 @@ const OptionDef options[] = {
         { .func_arg = opt_filter_threads },
         "number of non-complex filter threads" },
 #if FFMPEG_OPT_FILTER_SCRIPT
-    { "filter_script",          OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "filter_script",          OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(filter_scripts) },
         "deprecated, use -/filter", "filename" },
 #endif
-    { "reinit_filter",          OPT_TYPE_INT, OPT_SPEC | OPT_INPUT | OPT_EXPERT,
+    { "reinit_filter",          OPT_TYPE_INT, OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
         { .off = OFFSET(reinit_filters) },
         "reinit filtergraph on input parameter changes", "" },
     { "filter_complex",         OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
@@ -1673,10 +1673,10 @@ const OptionDef options[] = {
     { "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 | OPT_EXPERT,
+    { "discard",             OPT_TYPE_STRING, OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
         { .off = OFFSET(discard) },
         "discard", "" },
-    { "disposition",         OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
+    { "disposition",         OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | OPT_EXPERT,
         { .off = OFFSET(disposition) },
         "disposition", "" },
     { "thread_queue_size",   OPT_TYPE_INT,  OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
@@ -1685,26 +1685,26 @@ const OptionDef options[] = {
     { "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_TYPE_INT, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "bits_per_raw_sample", OPT_TYPE_INT, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(bits_per_raw_sample) },
         "set the number of bits per raw sample", "number" },
 
-    { "stats_enc_pre",      OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "stats_enc_pre",      OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(enc_stats_pre)      },
         "write encoding stats before encoding" },
-    { "stats_enc_post",     OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "stats_enc_post",     OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(enc_stats_post)     },
         "write encoding stats after encoding" },
-    { "stats_mux_pre",      OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "stats_mux_pre",      OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(mux_stats)          },
         "write packets stats before muxing" },
-    { "stats_enc_pre_fmt",  OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "stats_enc_pre_fmt",  OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(enc_stats_pre_fmt)  },
         "format of the stats written with -stats_enc_pre" },
-    { "stats_enc_post_fmt", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "stats_enc_post_fmt", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(enc_stats_post_fmt) },
         "format of the stats written with -stats_enc_post" },
-    { "stats_mux_pre_fmt",  OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "stats_mux_pre_fmt",  OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(mux_stats_fmt)      },
         "format of the stats written with -stats_mux_pre" },
 
@@ -1713,37 +1713,37 @@ const OptionDef options[] = {
         { .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,
+    { "r",                          OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM | 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 | OPT_EXPERT,
+    { "fpsmax",                     OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM | 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,
+    { "s",                          OPT_TYPE_STRING, OPT_VIDEO | OPT_SUBTITLE | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
         { .off = OFFSET(frame_sizes) },
         "set frame size (WxH or abbreviation)", "size" },
-    { "aspect",                     OPT_TYPE_STRING, OPT_VIDEO | OPT_SPEC | OPT_OUTPUT,
+    { "aspect",                     OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(frame_aspect_ratios) },
         "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
-    { "pix_fmt",                    OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+    { "pix_fmt",                    OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
         { .off = OFFSET(frame_pix_fmts) },
         "set pixel format", "format" },
-    { "display_rotation",           OPT_TYPE_DOUBLE, OPT_VIDEO | OPT_SPEC | OPT_INPUT | OPT_EXPERT,
+    { "display_rotation",           OPT_TYPE_DOUBLE, OPT_VIDEO | OPT_PERSTREAM | 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 | OPT_EXPERT,
+    { "display_hflip",              OPT_TYPE_BOOL,   OPT_VIDEO | OPT_PERSTREAM | 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 | OPT_EXPERT,
+    { "display_vflip",              OPT_TYPE_BOOL,   OPT_VIDEO | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
         { .off = OFFSET(display_vflips) },
         "set display vertical flip for stream(s) "
         "(overrides any display rotation if it is not set)"},
     { "vn",                         OPT_TYPE_BOOL,   OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
         { .off = OFFSET(video_disable) },
         "disable video" },
-    { "rc_override",                OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT  | OPT_SPEC | OPT_OUTPUT,
+    { "rc_override",                OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT  | OPT_PERSTREAM | 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 | OPT_HAS_CANON,
@@ -1753,10 +1753,10 @@ const OptionDef options[] = {
     { "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 | OPT_EXPERT,
+    { "pass",                       OPT_TYPE_INT,    OPT_VIDEO | OPT_PERSTREAM | 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,
+    { "passlogfile",                OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(passlogfiles) },
         "select two pass log file name prefix", "prefix" },
     { "vstats",                     OPT_TYPE_FUNC,   OPT_VIDEO | OPT_EXPERT,
@@ -1772,53 +1772,53 @@ const OptionDef options[] = {
         { .func_arg = opt_video_filters },
         "set video filters", "filter_graph",
         .u1.name_canon = "filter", },
-    { "intra_matrix",               OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "intra_matrix",               OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(intra_matrices) },
         "specify intra matrix coeffs", "matrix" },
-    { "inter_matrix",               OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "inter_matrix",               OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(inter_matrices) },
         "specify inter matrix coeffs", "matrix" },
-    { "chroma_intra_matrix",        OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "chroma_intra_matrix",        OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | 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 | OPT_HAS_CANON,
         { .func_arg = opt_old2new },
         "force video tag/fourcc", "fourcc/tag",
         .u1.name_canon = "tag", },
-    { "fps_mode",                   OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "fps_mode",                   OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(fps_mode) },
         "set framerate mode for matching video streams; overrides vsync" },
-    { "force_fps",                  OPT_TYPE_BOOL,   OPT_VIDEO | OPT_EXPERT  | OPT_SPEC | OPT_OUTPUT,
+    { "force_fps",                  OPT_TYPE_BOOL,   OPT_VIDEO | OPT_EXPERT  | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(force_fps) },
         "force the selected framerate, disable the best supported framerate selection" },
     { "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,
+    { "force_key_frames",           OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
         { .off = OFFSET(forced_key_frames) },
         "force key frames at specified timestamps", "timestamps" },
     { "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,
+    { "hwaccel",                    OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT,
         { .off = OFFSET(hwaccels) },
         "use HW accelerated decoding", "hwaccel name" },
-    { "hwaccel_device",             OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
+    { "hwaccel_device",             OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT,
         { .off = OFFSET(hwaccel_devices) },
         "select a device for HW acceleration", "devicename" },
-    { "hwaccel_output_format",      OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
+    { "hwaccel_output_format",      OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT,
         { .off = OFFSET(hwaccel_output_formats) },
         "select output format used with HW accelerated decoding", "format" },
     { "hwaccels",                   OPT_TYPE_FUNC,   OPT_EXIT | OPT_EXPERT,
         { .func_arg = show_hwaccels },
         "show available HW acceleration methods" },
-    { "autorotate",                 OPT_TYPE_BOOL,   OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+    { "autorotate",                 OPT_TYPE_BOOL,   OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT,
         { .off = OFFSET(autorotate) },
         "automatically insert correct rotate filters" },
-    { "autoscale",                  OPT_TYPE_BOOL,   OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "autoscale",                  OPT_TYPE_BOOL,   OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(autoscale) },
         "automatically insert a scale filter at the end of the filter graph" },
-    { "fix_sub_duration_heartbeat", OPT_TYPE_BOOL,   OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "fix_sub_duration_heartbeat", OPT_TYPE_BOOL,   OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | 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 "
@@ -1832,10 +1832,10 @@ const OptionDef options[] = {
     { "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,
+    { "ar",               OPT_TYPE_INT,     OPT_AUDIO | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
         { .off = OFFSET(audio_sample_rate) },
         "set audio sampling rate (in Hz)", "rate" },
-    { "ac",               OPT_TYPE_INT,     OPT_AUDIO | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+    { "ac",               OPT_TYPE_INT,     OPT_AUDIO | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
         { .off = OFFSET(audio_channels) },
         "set number of audio channels", "channels" },
     { "an",               OPT_TYPE_BOOL,    OPT_AUDIO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,
@@ -1852,14 +1852,14 @@ const OptionDef options[] = {
         { .func_arg = opt_old2new },
         "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,
+    { "sample_fmt",       OPT_TYPE_STRING,  OPT_AUDIO | OPT_EXPERT | OPT_PERSTREAM | 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 | OPT_HAS_ALT,
+    { "channel_layout",   OPT_TYPE_STRING,  OPT_AUDIO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT | OPT_HAS_ALT,
         { .off = OFFSET(audio_ch_layouts) },
         "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,
+    { "ch_layout",        OPT_TYPE_STRING,  OPT_AUDIO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
         { .off = OFFSET(audio_ch_layouts) },
         "set channel layout", "layout",
         .u1.name_canon = "channel_layout", },
@@ -1867,7 +1867,7 @@ const OptionDef options[] = {
         { .func_arg = opt_audio_filters },
         "set audio filters", "filter_graph",
         .u1.name_canon = "filter", },
-    { "guess_layout_max", OPT_TYPE_INT,     OPT_AUDIO | OPT_SPEC | OPT_EXPERT | OPT_INPUT,
+    { "guess_layout_max", OPT_TYPE_INT,     OPT_AUDIO | OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT,
         { .off = OFFSET(guess_layout_max) },
       "set the maximum number of channels to try to guess the channel layout" },
 
@@ -1883,10 +1883,10 @@ const OptionDef options[] = {
         { .func_arg = opt_old2new }
         , "force subtitle tag/fourcc", "fourcc/tag",
         .u1.name_canon = "tag" },
-    { "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT,
+    { "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_PERSTREAM | OPT_INPUT,
         { .off = OFFSET(fix_sub_duration) },
         "fix subtitles duration" },
-    { "canvas_size", OPT_TYPE_STRING, OPT_SUBTITLE | OPT_SPEC | OPT_INPUT | OPT_EXPERT,
+    { "canvas_size", OPT_TYPE_STRING, OPT_SUBTITLE | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
         { .off = OFFSET(canvas_sizes) },
         "set canvas size (WxH or abbreviation)", "size" },
 
@@ -1901,17 +1901,17 @@ const OptionDef options[] = {
         { .func_arg = opt_sdp_file },
         "specify a file in which to print sdp information", "file" },
 
-    { "time_base",     OPT_TYPE_STRING, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "time_base",     OPT_TYPE_STRING, OPT_EXPERT | OPT_PERSTREAM | 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_TYPE_STRING, OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
+    { "enc_time_base", OPT_TYPE_STRING, OPT_EXPERT | OPT_PERSTREAM | 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_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT,
+    { "bsf", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT,
         { .off = OFFSET(bitstream_filters) },
         "A comma-separated list of bitstream filters", "bitstream_filters", },
 
@@ -1932,10 +1932,10 @@ const OptionDef options[] = {
         "set options from indicated preset file", "filename",
         .u1.name_canon = "pre", },
 
-    { "max_muxing_queue_size", OPT_TYPE_INT, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "max_muxing_queue_size", OPT_TYPE_INT, OPT_PERSTREAM | 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_TYPE_INT, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
+    { "muxing_queue_data_threshold", OPT_TYPE_INT, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
         { .off = OFFSET(muxing_queue_data_threshold) },
         "set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
 
@@ -1983,7 +1983,7 @@ const OptionDef options[] = {
         "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
 #endif
 #if FFMPEG_OPT_TOP
-    { "top", OPT_TYPE_INT,     OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT,
+    { "top", OPT_TYPE_INT,     OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
         { .off = OFFSET(top_field_first) },
         "deprecated, use the setfield video filter", "" },
 #endif
-- 
2.42.0



More information about the ffmpeg-devel mailing list