[FFmpeg-cvslog] avfilter/vf_normalize: add support for commands

Paul B Mahol git at videolan.org
Sat Nov 23 12:08:43 EET 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Nov 23 11:07:02 2019 +0100| [aaac48fb50271aa753eb31bfca24ecabb8abc92b] | committer: Paul B Mahol

avfilter/vf_normalize: add support for commands

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aaac48fb50271aa753eb31bfca24ecabb8abc92b
---

 doc/filters.texi           |  7 +++++++
 libavfilter/vf_normalize.c | 10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 4587356f1d..39570d893b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -13636,6 +13636,13 @@ expensive no-op. Defaults to 1.0 (full strength).
 
 @end table
 
+ at subsection Commands
+This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
 @subsection Examples
 
 Stretch video contrast to use the full dynamic range, with no temporal
diff --git a/libavfilter/vf_normalize.c b/libavfilter/vf_normalize.c
index 4a96088ee5..2e1b274f8c 100644
--- a/libavfilter/vf_normalize.c
+++ b/libavfilter/vf_normalize.c
@@ -116,13 +116,14 @@ typedef struct NormalizeContext {
 
 #define OFFSET(x) offsetof(NormalizeContext, x)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+#define FLAGSR AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
 static const AVOption normalize_options[] = {
-    { "blackpt",  "output color to which darkest input color is mapped",  OFFSET(blackpt), AV_OPT_TYPE_COLOR, { .str = "black" }, CHAR_MIN, CHAR_MAX, FLAGS },
-    { "whitept",  "output color to which brightest input color is mapped",  OFFSET(whitept), AV_OPT_TYPE_COLOR, { .str = "white" }, CHAR_MIN, CHAR_MAX, FLAGS },
+    { "blackpt",  "output color to which darkest input color is mapped",  OFFSET(blackpt), AV_OPT_TYPE_COLOR, { .str = "black" }, CHAR_MIN, CHAR_MAX, FLAGSR },
+    { "whitept",  "output color to which brightest input color is mapped",  OFFSET(whitept), AV_OPT_TYPE_COLOR, { .str = "white" }, CHAR_MIN, CHAR_MAX, FLAGSR },
     { "smoothing",  "amount of temporal smoothing of the input range, to reduce flicker", OFFSET(smoothing), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX/8, FLAGS },
-    { "independence", "proportion of independent to linked channel normalization", OFFSET(independence), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 1.0, FLAGS },
-    { "strength", "strength of filter, from no effect to full normalization", OFFSET(strength), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 1.0, FLAGS },
+    { "independence", "proportion of independent to linked channel normalization", OFFSET(independence), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 1.0, FLAGSR },
+    { "strength", "strength of filter, from no effect to full normalization", OFFSET(strength), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 1.0, FLAGSR },
     { NULL }
 };
 
@@ -388,4 +389,5 @@ AVFilter ff_vf_normalize = {
     .inputs        = inputs,
     .outputs       = outputs,
     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
+    .process_command = ff_filter_process_command,
 };



More information about the ffmpeg-cvslog mailing list