diff mbox series

[FFmpeg-devel,2/2] lavfi/sendcmd: correct the option flags dump

Message ID 1599972045-11361-2-git-send-email-mypopydev@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] lavfi/drawtext: Add reinit to debug message
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Jun Zhao Sept. 13, 2020, 4:40 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

correct the option flags dump for sendcmd/asendcmd.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavfilter/f_sendcmd.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

Comments

Paul B Mahol Sept. 13, 2020, 10:29 a.m. UTC | #1
On Sun, Sep 13, 2020 at 12:40:45PM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> correct the option flags dump for sendcmd/asendcmd.
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavfilter/f_sendcmd.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
> index 6b02669..5e4c891 100644
> --- a/libavfilter/f_sendcmd.c
> +++ b/libavfilter/f_sendcmd.c
> @@ -103,14 +103,6 @@ typedef struct SendCmdContext {
>  } SendCmdContext;
>  
>  #define OFFSET(x) offsetof(SendCmdContext, x)
> -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> -static const AVOption options[] = {
> -    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> -    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> -    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> -    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> -    { NULL }
> -};

Cant you use macro somehow?, because you are duplicating most of lines/code.

>  
>  #define SPACES " \f\t\n\r"
>  
> @@ -574,7 +566,14 @@ end:
>  
>  #if CONFIG_SENDCMD_FILTER
>  
> -#define sendcmd_options options
> +#define VFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> +static const AVOption sendcmd_options[] = {
> +    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
> +    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
> +    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
> +    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
> +    { NULL }
> +};
>  AVFILTER_DEFINE_CLASS(sendcmd);
>  
>  static const AVFilterPad sendcmd_inputs[] = {
> @@ -609,7 +608,14 @@ AVFilter ff_vf_sendcmd = {
>  
>  #if CONFIG_ASENDCMD_FILTER
>  
> -#define asendcmd_options options
> +#define AFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
> +static const AVOption asendcmd_options[] = {
> +    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
> +    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
> +    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
> +    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
> +    { NULL }
> +};
>  AVFILTER_DEFINE_CLASS(asendcmd);
>  
>  static const AVFilterPad asendcmd_inputs[] = {
> -- 
> 2.7.4
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
mypopy@gmail.com Sept. 14, 2020, 1:48 a.m. UTC | #2
On Sun, Sep 13, 2020 at 6:30 PM Paul B Mahol <onemda@gmail.com> wrote:
>
> On Sun, Sep 13, 2020 at 12:40:45PM +0800, Jun Zhao wrote:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > correct the option flags dump for sendcmd/asendcmd.
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavfilter/f_sendcmd.c | 26 ++++++++++++++++----------
> >  1 file changed, 16 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
> > index 6b02669..5e4c891 100644
> > --- a/libavfilter/f_sendcmd.c
> > +++ b/libavfilter/f_sendcmd.c
> > @@ -103,14 +103,6 @@ typedef struct SendCmdContext {
> >  } SendCmdContext;
> >
> >  #define OFFSET(x) offsetof(SendCmdContext, x)
> > -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> > -static const AVOption options[] = {
> > -    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> > -    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> > -    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> > -    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
> > -    { NULL }
> > -};
>
> Cant you use macro somehow?, because you are duplicating most of lines/code.
>
Will try to remove the redundant, thx
diff mbox series

Patch

diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
index 6b02669..5e4c891 100644
--- a/libavfilter/f_sendcmd.c
+++ b/libavfilter/f_sendcmd.c
@@ -103,14 +103,6 @@  typedef struct SendCmdContext {
 } SendCmdContext;
 
 #define OFFSET(x) offsetof(SendCmdContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption options[] = {
-    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-    { NULL }
-};
 
 #define SPACES " \f\t\n\r"
 
@@ -574,7 +566,14 @@  end:
 
 #if CONFIG_SENDCMD_FILTER
 
-#define sendcmd_options options
+#define VFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption sendcmd_options[] = {
+    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+    { NULL }
+};
 AVFILTER_DEFINE_CLASS(sendcmd);
 
 static const AVFilterPad sendcmd_inputs[] = {
@@ -609,7 +608,14 @@  AVFilter ff_vf_sendcmd = {
 
 #if CONFIG_ASENDCMD_FILTER
 
-#define asendcmd_options options
+#define AFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption asendcmd_options[] = {
+    { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+    { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+    { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+    { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+    { NULL }
+};
 AVFILTER_DEFINE_CLASS(asendcmd);
 
 static const AVFilterPad asendcmd_inputs[] = {