From 35a27402ade928d78f8b7a89c8b4e8bf8b473215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 01:10:40 +0200 Subject: [PATCH 1/8] lavfi/concat: switch to an AVOptions-based system. --- doc/filters.texi | 3 ++- libavfilter/avf_concat.c | 3 --- libavfilter/avfilter.c | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 7fd1481161..63ca00f435 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6937,7 +6937,8 @@ The filter works on segments of synchronized video and audio streams. All segments must have the same number of streams of each type, and that will also be the number of streams at output. -The filter accepts the following named parameters: +The filter accepts the following options: + @table @option @item n diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index 2b3640b1b0..8312efa514 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -409,8 +409,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_free(cat->in); } -static const char *const shorthand[] = { NULL }; - AVFilter avfilter_avf_concat = { .name = "concat", .description = NULL_IF_CONFIG_SMALL("Concatenate audio and video streams."), @@ -421,5 +419,4 @@ AVFilter avfilter_avf_concat = { .inputs = NULL, .outputs = NULL, .priv_class = &concat_class, - .shorthand = shorthand, }; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index e958923ff2..659aeddcf9 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -697,6 +697,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "channelsplit") || !strcmp(filter->filter->name, "color" ) || !strcmp(filter->filter->name, "colormatrix") || + !strcmp(filter->filter->name, "concat" ) || !strcmp(filter->filter->name, "crop" ) || !strcmp(filter->filter->name, "cropdetect") || !strcmp(filter->filter->name, "curves" ) || From 64a103138c04c1155adb5868a0ae176be3550723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Wed, 10 Apr 2013 23:15:06 +0200 Subject: [PATCH 2/8] lavfi/tile: switch to an AVOptions-based system. --- doc/filters.texi | 26 +++++++++++++------------- libavfilter/avfilter.c | 1 + libavfilter/vf_tile.c | 8 ++------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 63ca00f435..a0616bf2db 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -5414,8 +5414,7 @@ ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png Tile several successive frames together. -It accepts a list of options in the form of @var{key}=@var{value} pairs -separated by ":". A description of the accepted options follows. +The filter accepts the following options: @table @option @@ -5423,6 +5422,11 @@ separated by ":". A description of the accepted options follows. Set the grid size (i.e. the number of lines and columns) in the form "@var{w}x@var{h}". +@item nb_frames +Set the maximum number of frames to render in the given area. It must be less +than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all +the area will be used. + @item margin Set the outer border margin in pixels. @@ -5431,19 +5435,13 @@ Set the inner border thickness (i.e. the number of pixels between frames). For more advanced padding options (such as having different values for the edges), refer to the pad video filter. -@item nb_frames -Set the maximum number of frames to render in the given area. It must be less -than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all -the area will be used. - @end table -Alternatively, the options can be specified as a flat string: +@subsection Examples -@var{layout}[:@var{nb_frames}[:@var{margin}[:@var{padding}]]] - -For example, produce 8x8 PNG tiles of all keyframes (@option{-skip_frame -nokey}) in a movie: +@itemize +@item +Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie: @example ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png @end example @@ -5451,12 +5449,14 @@ The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from duplicating each output frame to accomodate the originally detected frame rate. -Another example to display @code{5} pictures in an area of @code{3x2} frames, +@item +Display @code{5} pictures in an area of @code{3x2} frames, with @code{7} pixels between them, and @code{2} pixels of initial margin, using mixed flat and named options: @example tile=3x2:nb_frames=5:padding=7:margin=2 @end example +@end itemize @section tinterlace diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 659aeddcf9..de47b80e14 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -757,6 +757,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "subtitles") || !strcmp(filter->filter->name, "testsrc" ) || !strcmp(filter->filter->name, "thumbnail") || + !strcmp(filter->filter->name, "tile") || !strcmp(filter->filter->name, "transpose") || !strcmp(filter->filter->name, "treble" ) || !strcmp(filter->filter->name, "unsharp" ) || diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index 64bf97076c..f92844b807 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -51,12 +51,12 @@ typedef struct { static const AVOption tile_options[] = { { "layout", "set grid size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "6x5"}, 0, 0, FLAGS }, + { "nb_frames", "set maximum number of frame to render", OFFSET(nb_frames), + AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS }, { "margin", "set outer border margin in pixels", OFFSET(margin), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, { "padding", "set inner border thickness in pixels", OFFSET(padding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, - { "nb_frames", "set maximum number of frame to render", OFFSET(nb_frames), - AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS }, {NULL}, }; @@ -230,9 +230,6 @@ static const AVFilterPad tile_outputs[] = { { NULL } }; -static const char *const shorthand[] = - { "layout", "nb_frames", "margin", "padding", NULL }; - AVFilter avfilter_vf_tile = { .name = "tile", .description = NULL_IF_CONFIG_SMALL("Tile several successive frames together."), @@ -242,5 +239,4 @@ AVFilter avfilter_vf_tile = { .inputs = tile_inputs, .outputs = tile_outputs, .priv_class = &tile_class, - .shorthand = shorthand, }; From c85f56bb4fd8051a2e365ed71bdf3e4a3f0d9faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 11:35:01 +0200 Subject: [PATCH 3/8] lavfi/tinterlace: switch to an AVOptions-based system. --- doc/filters.texi | 8 +------- libavfilter/avfilter.c | 1 + libavfilter/vf_tinterlace.c | 3 --- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index a0616bf2db..d9a3599882 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -5465,13 +5465,7 @@ Perform various types of temporal field interlacing. Frames are counted starting from 1, so the first input frame is considered odd. -This filter accepts options in the form of @var{key}=@var{value} pairs -separated by ":". -Alternatively, the @var{mode} option can be specified as a value alone, -optionally followed by a ":" and further ":" separated @var{key}=@var{value} -pairs. - -A description of the accepted options follows. +The filter accepts the following options: @table @option diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index de47b80e14..363614eb37 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -758,6 +758,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "testsrc" ) || !strcmp(filter->filter->name, "thumbnail") || !strcmp(filter->filter->name, "tile") || + !strcmp(filter->filter->name, "tinterlace") || !strcmp(filter->filter->name, "transpose") || !strcmp(filter->filter->name, "treble" ) || !strcmp(filter->filter->name, "unsharp" ) || diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 6ff2140bbe..13b8ce286a 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -385,8 +385,6 @@ static const AVFilterPad tinterlace_outputs[] = { { NULL } }; -static const char *const shorthand[] = { "mode", NULL }; - AVFilter avfilter_vf_tinterlace = { .name = "tinterlace", .description = NULL_IF_CONFIG_SMALL("Perform temporal field interlacing."), @@ -396,5 +394,4 @@ AVFilter avfilter_vf_tinterlace = { .inputs = tinterlace_inputs, .outputs = tinterlace_outputs, .priv_class = &tinterlace_class, - .shorthand = shorthand, }; From 9ceb7bdf6f88fb2ee7449401db2ebd4ee4c37597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 11:39:24 +0200 Subject: [PATCH 4/8] lavfi/deshake: switch to an AVOptions-based system. --- doc/filters.texi | 15 +++++++-------- libavfilter/avfilter.c | 1 + libavfilter/vf_deshake.c | 7 ------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index d9a3599882..1e236143df 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2529,16 +2529,14 @@ Attempt to fix small changes in horizontal and/or vertical shift. This filter helps remove camera shake from hand-holding a camera, bumping a tripod, moving on a vehicle, etc. -The filter accepts parameters as a list of @var{key}=@var{value} -pairs, separated by ":". If the key of the first options is omitted, -the arguments are interpreted according to the syntax -@var{x}:@var{y}:@var{w}:@var{h}:@var{rx}:@var{ry}:@var{edge}:@var{blocksize}:@var{contrast}:@var{search}:@var{filename}:@var{opencl}. - -A description of the accepted parameters follows. +The filter accepts the following options: @table @option -@item x, y, w, h +@item x +@item y +@item w +@item h Specify a rectangular area where to limit the search for motion vectors. If desired the search for motion vectors can be limited to a @@ -2556,7 +2554,8 @@ without specifying the bounding box for the motion vector search. Default - search the whole frame. -@item rx, ry +@item rx +@item ry Specify the maximum extent of movement in x and y directions in the range 0-64 pixels. Default 16. diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 363614eb37..39dfff68c1 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -703,6 +703,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "curves" ) || !strcmp(filter->filter->name, "decimate" ) || !strcmp(filter->filter->name, "delogo" ) || + !strcmp(filter->filter->name, "deshake" ) || !strcmp(filter->filter->name, "drawbox" ) || !strcmp(filter->filter->name, "drawtext" ) || !strcmp(filter->filter->name, "ebur128" ) || diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index c8b8775371..f363c6eadf 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -560,12 +560,6 @@ static const AVFilterPad deshake_outputs[] = { { NULL } }; -static const char *const shorthand[] = { - "x", "y", "w", "h", "rx", "ry", "edge", - "blocksize", "contrast", "search", "filename", - NULL -}; - AVFilter avfilter_vf_deshake = { .name = "deshake", .description = NULL_IF_CONFIG_SMALL("Stabilize shaky video."), @@ -576,5 +570,4 @@ AVFilter avfilter_vf_deshake = { .inputs = deshake_inputs, .outputs = deshake_outputs, .priv_class = &deshake_class, - .shorthand = shorthand, }; From bca4cafaf2d49c8a9c4bada17606e1f20da94d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 11:42:19 +0200 Subject: [PATCH 5/8] lavfi/sine: switch to an AVOptions-based system. --- doc/filters.texi | 6 +----- libavfilter/asrc_sine.c | 3 --- libavfilter/avfilter.c | 1 + 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 1e236143df..0334d3acbd 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1688,11 +1688,7 @@ Generate an audio signal made of a sine wave with amplitude 1/8. The audio signal is bit-exact. -It accepts a list of options in the form of @var{key}=@var{value} pairs -separated by ":". If the option name is omitted, the first option is the -frequency and the second option is the beep factor. - -The supported options are: +The filter accepts the following options: @table @option diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c index 148e1ee12e..9387e37688 100644 --- a/libavfilter/asrc_sine.c +++ b/libavfilter/asrc_sine.c @@ -210,8 +210,6 @@ static const AVFilterPad sine_outputs[] = { { NULL } }; -static const char *const shorthand[] = { "frequency", "beep_factor", NULL }; - AVFilter avfilter_asrc_sine = { .name = "sine", .description = NULL_IF_CONFIG_SMALL("Generate sine wave audio signal."), @@ -222,5 +220,4 @@ AVFilter avfilter_asrc_sine = { .inputs = NULL, .outputs = sine_outputs, .priv_class = &sine_class, - .shorthand = shorthand, }; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 39dfff68c1..feac86a462 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -752,6 +752,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "settb" ) || !strcmp(filter->filter->name, "showspectrum") || !strcmp(filter->filter->name, "silencedetect") || + !strcmp(filter->filter->name, "sine" ) || !strcmp(filter->filter->name, "smartblur") || !strcmp(filter->filter->name, "split" ) || !strcmp(filter->filter->name, "stereo3d" ) || From cb2327e88d662e3c1da812bc18e9c504d068dd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 11:45:25 +0200 Subject: [PATCH 6/8] lavfi/aselect: switch to an AVOptions-based system. --- doc/filters.texi | 2 +- libavfilter/avfilter.c | 1 + libavfilter/f_select.c | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 0334d3acbd..2a5b9af4a2 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6376,7 +6376,7 @@ This filter accepts the following options: @table @option -@item expr +@item expr, e An expression, which is evaluated for each input frame. If the expression is evaluated to a non-zero value, the frame is selected and passed to the output, otherwise it is discarded. diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index feac86a462..c59d155565 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -766,6 +766,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "unsharp" ) || // !strcmp(filter->filter->name, "scale" ) || !strcmp(filter->filter->name, "select") || + !strcmp(filter->filter->name, "aselect" ) || !strcmp(filter->filter->name, "volume" ) || !strcmp(filter->filter->name, "yadif" ) || 0 diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index e2c4ef719a..b34196dee3 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -388,8 +388,6 @@ static int query_formats(AVFilterContext *ctx) return 0; } -static const char *const shorthand[] = { "expr", NULL }; - #if CONFIG_ASELECT_FILTER #define OFFSET(x) offsetof(SelectContext, x) @@ -445,7 +443,6 @@ AVFilter avfilter_af_aselect = { .inputs = avfilter_af_aselect_inputs, .outputs = avfilter_af_aselect_outputs, .priv_class = &aselect_class, - .shorthand = shorthand, }; #endif /* CONFIG_ASELECT_FILTER */ From 73c1a00e73fbfcf27ce6fb474e3080ac0b1b445b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 11:48:42 +0200 Subject: [PATCH 7/8] lavfi/asettb: switch to an AVOptions-based system. --- doc/filters.texi | 2 +- libavfilter/avfilter.c | 1 + libavfilter/f_settb.c | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 2a5b9af4a2..94518d1514 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6873,7 +6873,7 @@ This filter accepts the following options: @table @option -@item expr +@item expr, tb The expression which is evaluated into the output timebase. @end table diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c59d155565..a6a426c7e8 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -750,6 +750,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "rgbtestsrc") || !strcmp(filter->filter->name, "setpts" ) || !strcmp(filter->filter->name, "settb" ) || + !strcmp(filter->filter->name, "asettb" ) || !strcmp(filter->filter->name, "showspectrum") || !strcmp(filter->filter->name, "silencedetect") || !strcmp(filter->filter->name, "sine" ) || diff --git a/libavfilter/f_settb.c b/libavfilter/f_settb.c index df03274dcb..b1eac716e3 100644 --- a/libavfilter/f_settb.c +++ b/libavfilter/f_settb.c @@ -60,7 +60,9 @@ typedef struct { #define OFFSET(x) offsetof(SetTBContext, x) #define DEFINE_OPTIONS(filt_name, filt_type) \ static const AVOption filt_name##_options[] = { \ - { "tb", "Expression determining the output timebase", OFFSET(tb_expr), AV_OPT_TYPE_STRING, {.str="intb"}, \ + { "expr", "set expression determining the output timebase", OFFSET(tb_expr), AV_OPT_TYPE_STRING, {.str="intb"}, \ + .flags=AV_OPT_FLAG_##filt_type##_PARAM|AV_OPT_FLAG_FILTERING_PARAM }, \ + { "tb", "set expression determining the output timebase", OFFSET(tb_expr), AV_OPT_TYPE_STRING, {.str="intb"}, \ .flags=AV_OPT_FLAG_##filt_type##_PARAM|AV_OPT_FLAG_FILTERING_PARAM }, \ { NULL } \ } @@ -118,8 +120,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(outlink, frame); } -static const char *const shorthand[] = { "tb", NULL }; - #if CONFIG_SETTB_FILTER DEFINE_OPTIONS(settb, VIDEO); @@ -188,6 +188,5 @@ AVFilter avfilter_af_asettb = { .inputs = avfilter_af_asettb_inputs, .outputs = avfilter_af_asettb_outputs, .priv_class = &asettb_class, - .shorthand = shorthand, }; #endif From 77add967a5e5dae8f322578580c440cb990624ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 11 Apr 2013 11:50:56 +0200 Subject: [PATCH 8/8] lavfi/setfield: switch to an AVOptions-based system. --- doc/filters.texi | 10 +++++++--- libavfilter/avfilter.c | 1 + libavfilter/vf_setfield.c | 3 --- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 94518d1514..af4bccbe5e 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -5057,9 +5057,12 @@ output frames. It does not change the input frame, but only sets the corresponding property, which affects how the frame is treated by following filters (e.g. @code{fieldorder} or @code{yadif}). -This filter accepts a single option @option{mode}, which can be -specified either by setting @code{mode=VALUE} or setting the value -alone. Available values are: +The filter accepts the following options: + +@table @option + +@item mode +Available values are: @table @samp @item auto @@ -5074,6 +5077,7 @@ Mark the frame as top-field-first. @item prog Mark the frame as progressive. @end table +@end table @section showinfo diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index a6a426c7e8..7c2abdcdbf 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -751,6 +751,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "setpts" ) || !strcmp(filter->filter->name, "settb" ) || !strcmp(filter->filter->name, "asettb" ) || + !strcmp(filter->filter->name, "setfield") || !strcmp(filter->filter->name, "showspectrum") || !strcmp(filter->filter->name, "silencedetect") || !strcmp(filter->filter->name, "sine" ) || diff --git a/libavfilter/vf_setfield.c b/libavfilter/vf_setfield.c index 22b3101b7b..4d42cfa968 100644 --- a/libavfilter/vf_setfield.c +++ b/libavfilter/vf_setfield.c @@ -85,8 +85,6 @@ static const AVFilterPad setfield_outputs[] = { { NULL } }; -static const char *const shorthand[] = { "mode", NULL }; - AVFilter avfilter_vf_setfield = { .name = "setfield", .description = NULL_IF_CONFIG_SMALL("Force field for the output video frame."), @@ -94,5 +92,4 @@ AVFilter avfilter_vf_setfield = { .inputs = setfield_inputs, .outputs = setfield_outputs, .priv_class = &setfield_class, - .shorthand = shorthand, };