diff mbox

[FFmpeg-devel,v1,1/3] avfilter/vf_yadif: rename config_props -> config_input, link -> outlink

Message ID 20191128013418.10908-1-lance.lmwang@gmail.com
State Accepted
Commit c1ed00fd185e347032bbe23b42f66ce027bbecce
Headers show

Commit Message

Lance Wang Nov. 28, 2019, 1:34 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/vf_yadif.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

mypopy@gmail.com Nov. 28, 2019, 6:24 a.m. UTC | #1
On Thu, Nov 28, 2019 at 9:34 AM <lance.lmwang@gmail.com> wrote:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/vf_yadif.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
> index 3107924932..0b34c5045b 100644
> --- a/libavfilter/vf_yadif.c
> +++ b/libavfilter/vf_yadif.c
> @@ -311,26 +311,26 @@ static int query_formats(AVFilterContext *ctx)
>      return ff_set_common_formats(ctx, fmts_list);
>  }
>
> -static int config_props(AVFilterLink *link)
> +static int config_output(AVFilterLink *outlink)
>  {
> -    AVFilterContext *ctx = link->src;
> +    AVFilterContext *ctx = outlink->src;
>      YADIFContext *s = ctx->priv;
>
> -    link->time_base.num = ctx->inputs[0]->time_base.num;
> -    link->time_base.den = ctx->inputs[0]->time_base.den * 2;
> -    link->w             = ctx->inputs[0]->w;
> -    link->h             = ctx->inputs[0]->h;
> +    outlink->time_base.num = ctx->inputs[0]->time_base.num;
> +    outlink->time_base.den = ctx->inputs[0]->time_base.den * 2;
> +    outlink->w             = ctx->inputs[0]->w;
> +    outlink->h             = ctx->inputs[0]->h;
>
>      if(s->mode & 1)
> -        link->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
> +        outlink->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
>                                      (AVRational){2, 1});
>
> -    if (link->w < 3 || link->h < 3) {
> +    if (outlink->w < 3 || outlink->h < 3) {
>          av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
>          return AVERROR(EINVAL);
>      }
>
> -    s->csp = av_pix_fmt_desc_get(link->format);
> +    s->csp = av_pix_fmt_desc_get(outlink->format);
>      s->filter = filter;
>      if (s->csp->comp[0].depth > 8) {
>          s->filter_line  = filter_line_c_16bit;
> @@ -369,7 +369,7 @@ static const AVFilterPad avfilter_vf_yadif_outputs[] = {
>          .name          = "default",
>          .type          = AVMEDIA_TYPE_VIDEO,
>          .request_frame = ff_yadif_request_frame,
> -        .config_props  = config_props,
> +        .config_props  = config_output,
>      },
>      { NULL }
>  };
> --
> 2.21.0
>
Why ?
Lance Wang Nov. 28, 2019, 11:26 a.m. UTC | #2
On Thu, Nov 28, 2019 at 02:24:38PM +0800, mypopy@gmail.com wrote:
> On Thu, Nov 28, 2019 at 9:34 AM <lance.lmwang@gmail.com> wrote:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  libavfilter/vf_yadif.c | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
> > index 3107924932..0b34c5045b 100644
> > --- a/libavfilter/vf_yadif.c
> > +++ b/libavfilter/vf_yadif.c
> > @@ -311,26 +311,26 @@ static int query_formats(AVFilterContext *ctx)
> >      return ff_set_common_formats(ctx, fmts_list);
> >  }
> >
> > -static int config_props(AVFilterLink *link)
> > +static int config_output(AVFilterLink *outlink)
> >  {
> > -    AVFilterContext *ctx = link->src;
> > +    AVFilterContext *ctx = outlink->src;
> >      YADIFContext *s = ctx->priv;
> >
> > -    link->time_base.num = ctx->inputs[0]->time_base.num;
> > -    link->time_base.den = ctx->inputs[0]->time_base.den * 2;
> > -    link->w             = ctx->inputs[0]->w;
> > -    link->h             = ctx->inputs[0]->h;
> > +    outlink->time_base.num = ctx->inputs[0]->time_base.num;
> > +    outlink->time_base.den = ctx->inputs[0]->time_base.den * 2;
> > +    outlink->w             = ctx->inputs[0]->w;
> > +    outlink->h             = ctx->inputs[0]->h;
> >
> >      if(s->mode & 1)
> > -        link->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
> > +        outlink->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
> >                                      (AVRational){2, 1});
> >
> > -    if (link->w < 3 || link->h < 3) {
> > +    if (outlink->w < 3 || outlink->h < 3) {
> >          av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
> >          return AVERROR(EINVAL);
> >      }
> >
> > -    s->csp = av_pix_fmt_desc_get(link->format);
> > +    s->csp = av_pix_fmt_desc_get(outlink->format);
> >      s->filter = filter;
> >      if (s->csp->comp[0].depth > 8) {
> >          s->filter_line  = filter_line_c_16bit;
> > @@ -369,7 +369,7 @@ static const AVFilterPad avfilter_vf_yadif_outputs[] = {
> >          .name          = "default",
> >          .type          = AVMEDIA_TYPE_VIDEO,
> >          .request_frame = ff_yadif_request_frame,
> > -        .config_props  = config_props,
> > +        .config_props  = config_output,
> >      },
> >      { NULL }
> >  };
> > --
> > 2.21.0
> >
> Why ?

As both input and output have config_props, it's better to make
the function name clear for input or output for readability. So
I change it by the way as I'm touch other place.
diff mbox

Patch

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 3107924932..0b34c5045b 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -311,26 +311,26 @@  static int query_formats(AVFilterContext *ctx)
     return ff_set_common_formats(ctx, fmts_list);
 }
 
-static int config_props(AVFilterLink *link)
+static int config_output(AVFilterLink *outlink)
 {
-    AVFilterContext *ctx = link->src;
+    AVFilterContext *ctx = outlink->src;
     YADIFContext *s = ctx->priv;
 
-    link->time_base.num = ctx->inputs[0]->time_base.num;
-    link->time_base.den = ctx->inputs[0]->time_base.den * 2;
-    link->w             = ctx->inputs[0]->w;
-    link->h             = ctx->inputs[0]->h;
+    outlink->time_base.num = ctx->inputs[0]->time_base.num;
+    outlink->time_base.den = ctx->inputs[0]->time_base.den * 2;
+    outlink->w             = ctx->inputs[0]->w;
+    outlink->h             = ctx->inputs[0]->h;
 
     if(s->mode & 1)
-        link->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
+        outlink->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate,
                                     (AVRational){2, 1});
 
-    if (link->w < 3 || link->h < 3) {
+    if (outlink->w < 3 || outlink->h < 3) {
         av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
         return AVERROR(EINVAL);
     }
 
-    s->csp = av_pix_fmt_desc_get(link->format);
+    s->csp = av_pix_fmt_desc_get(outlink->format);
     s->filter = filter;
     if (s->csp->comp[0].depth > 8) {
         s->filter_line  = filter_line_c_16bit;
@@ -369,7 +369,7 @@  static const AVFilterPad avfilter_vf_yadif_outputs[] = {
         .name          = "default",
         .type          = AVMEDIA_TYPE_VIDEO,
         .request_frame = ff_yadif_request_frame,
-        .config_props  = config_props,
+        .config_props  = config_output,
     },
     { NULL }
 };