[FFmpeg-devel,09/14] avfilter/vf_amplify: add support for commands

Submitted by Paul B Mahol on Oct. 9, 2019, 10:17 a.m.

Details

Message ID 20191009101705.7072-9-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol Oct. 9, 2019, 10:17 a.m.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/vf_amplify.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Michael Niedermayer Oct. 9, 2019, 5:20 p.m.
On Wed, Oct 09, 2019 at 12:17:00PM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/vf_amplify.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
[...]
> @@ -311,4 +312,5 @@ AVFilter ff_vf_amplify = {
>      .init          = init,
>      .uninit        = uninit,
>      .flags         = AVFILTER_FLAG_SLICE_THREADS,
> +    .process_command = ff_filter_process_command,

maybe ff_filter_process_command() should be called by default if process_command is NULL

patch LGTM if tested

thx

[...]
Paul B Mahol Oct. 9, 2019, 6:16 p.m.
On 10/9/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Wed, Oct 09, 2019 at 12:17:00PM +0200, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol <onemda@gmail.com>
>> ---
>>  libavfilter/vf_amplify.c | 14 ++++++++------
>>  1 file changed, 8 insertions(+), 6 deletions(-)
> [...]
>> @@ -311,4 +312,5 @@ AVFilter ff_vf_amplify = {
>>      .init          = init,
>>      .uninit        = uninit,
>>      .flags         = AVFILTER_FLAG_SLICE_THREADS,
>> +    .process_command = ff_filter_process_command,
>
> maybe ff_filter_process_command() should be called by default if
> process_command is NULL

Maybe, but I prefer explicit solutions more.

>
> patch LGTM if tested
>
> thx
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The worst form of inequality is to try to make unequal things equal.
> -- Aristotle
>
Michael Niedermayer Oct. 11, 2019, 5:55 p.m.
On Wed, Oct 09, 2019 at 08:16:19PM +0200, Paul B Mahol wrote:
> On 10/9/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > On Wed, Oct 09, 2019 at 12:17:00PM +0200, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> >> ---
> >>  libavfilter/vf_amplify.c | 14 ++++++++------
> >>  1 file changed, 8 insertions(+), 6 deletions(-)
> > [...]
> >> @@ -311,4 +312,5 @@ AVFilter ff_vf_amplify = {
> >>      .init          = init,
> >>      .uninit        = uninit,
> >>      .flags         = AVFILTER_FLAG_SLICE_THREADS,
> >> +    .process_command = ff_filter_process_command,
> >
> > maybe ff_filter_process_command() should be called by default if
> > process_command is NULL
> 
> Maybe, but I prefer explicit solutions more.

sure, ok, its your code 

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_amplify.c b/libavfilter/vf_amplify.c
index 48dcb93a67..590d31e57f 100644
--- a/libavfilter/vf_amplify.c
+++ b/libavfilter/vf_amplify.c
@@ -268,15 +268,16 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
 #define OFFSET(x) offsetof(AmplifyContext, x)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
+#define C AV_OPT_FLAG_COMMAND_PARAM
 
 static const AVOption amplify_options[] = {
     { "radius", "set radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=2}, 1, 63, .flags = FLAGS },
-    { "factor", "set factor", OFFSET(factor), AV_OPT_TYPE_FLOAT, {.dbl=2}, 0, UINT16_MAX, .flags = FLAGS },
-    { "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl=10}, 0, UINT16_MAX, .flags = FLAGS },
-    { "tolerance", "set tolerance", OFFSET(tolerance), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, UINT16_MAX, .flags = FLAGS },
-    { "low", "set low limit for amplification", OFFSET(llimit), AV_OPT_TYPE_INT, {.i64=UINT16_MAX}, 0, UINT16_MAX, .flags = FLAGS },
-    { "high", "set high limit for amplification", OFFSET(hlimit), AV_OPT_TYPE_INT, {.i64=UINT16_MAX}, 0, UINT16_MAX, .flags = FLAGS },
-    { "planes", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7},    0, 15,  FLAGS },
+    { "factor", "set factor", OFFSET(factor), AV_OPT_TYPE_FLOAT, {.dbl=2}, 0, UINT16_MAX, .flags = FLAGS|C },
+    { "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl=10}, 0, UINT16_MAX, .flags = FLAGS|C },
+    { "tolerance", "set tolerance", OFFSET(tolerance), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, UINT16_MAX, .flags = FLAGS|C },
+    { "low", "set low limit for amplification", OFFSET(llimit), AV_OPT_TYPE_INT, {.i64=UINT16_MAX}, 0, UINT16_MAX, .flags = FLAGS|C },
+    { "high", "set high limit for amplification", OFFSET(hlimit), AV_OPT_TYPE_INT, {.i64=UINT16_MAX}, 0, UINT16_MAX, .flags = FLAGS|C },
+    { "planes", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7},    0, 15,  FLAGS|C },
     { NULL },
 };
 
@@ -311,4 +312,5 @@  AVFilter ff_vf_amplify = {
     .init          = init,
     .uninit        = uninit,
     .flags         = AVFILTER_FLAG_SLICE_THREADS,
+    .process_command = ff_filter_process_command,
 };