[FFmpeg-devel] [PATCH 2/2] lavfi/sendcmd: correct the option flags dump
Paul B Mahol
onemda at gmail.com
Sun Sep 13 13:29:45 EEST 2020
On Sun, Sep 13, 2020 at 12:40:45PM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao at tencent.com>
>
> correct the option flags dump for sendcmd/asendcmd.
>
> Signed-off-by: Jun Zhao <barryjzhao at 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 at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list