[FFmpeg-devel] [PATCH] Add "progressive" to the options that "setfield" can force

Nicolas George nicolas.george at normalesup.org
Wed Apr 18 18:27:05 CEST 2012


Le decadi 30 germinal, an CCXX, Tim Nicholson a écrit :
> This patch adds the option to force the property of a video stream to be
> progressive in addition to the existing auto/tff/bff options. It should
> be useful in situations where progressive material is in a stream
> flagged as interlaced to override filters that honour this flag.
> -- 
> Tim

> >From d833fea6cd9d3fddab07260d7c6d2b2803d598b8 Mon Sep 17 00:00:00 2001
> From: Tim Nicholson <Tim.Nicholson at bbc.co.uk>
> Date: Wed, 18 Apr 2012 15:49:47 +0100
> Subject: [PATCH] Add "progressive" option to setfield filter

Nit: "vf_setfueld: add "progressive" option".

Also, mention in the git message that the integer values are deprecated by
this patch as well.

> 
> ---
>  doc/filters.texi          |   14 ++++++++------
>  libavfilter/vf_setfield.c |   10 +++++++---
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 455189c..4c5e9f4 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -2538,19 +2538,21 @@ Force field for the output video frame.
>  The @code{setfield} filter marks the interlace type field for the
>  output frames. It does not change the input frame, but only sets the
>  corresponding property, which affects how the frame is treated by
> -followig filters (e.g. @code{fieldorder} or @code{yadif}).
> +following filters (e.g. @code{fieldorder} or @code{yadif}).

Unrelated, but that is not important and the change is good anyway.

>  
> -It accepts a parameter representing an integer or a string, which can
> -assume the following values:
> +It accepts a string parameter, which can assume the following values:
>  @table @samp
> - at item -1, auto
> + at item auto
>  Keep the same field property.
>  
> - at item 0, bff
> + at item bff
>  Mark the frame as bottom-field-first.
>  
> - at item 1, tff
> + at item tff
>  Mark the frame as top-field-first.
> +
> + at item prog
> +Mark the frame as progressive.
>  @end table
>  
>  @section setpts
> diff --git a/libavfilter/vf_setfield.c b/libavfilter/vf_setfield.c
> index bfb8006..6f536a7 100644
> --- a/libavfilter/vf_setfield.c
> +++ b/libavfilter/vf_setfield.c
> @@ -40,17 +40,20 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
>          if (sscanf(args, "%d%c", &setfield->top_field_first, &c) != 1) {
>              if      (!strcmp("tff",  args)) setfield->top_field_first = 1;
>              else if (!strcmp("bff",  args)) setfield->top_field_first = 0;
> +            else if (!strcmp("prog",  args)) setfield->top_field_first = 2;
>              else if (!strcmp("auto", args)) setfield->top_field_first = -1;
>              else {
>                  av_log(ctx, AV_LOG_ERROR, "Invalid argument '%s'\n", args);
>                  return AVERROR(EINVAL);
>              }
>          }
> +        else
> +            av_log(ctx, AV_LOG_WARNING, "Using -1/0/1 is deprecated, please use auto/tff/bff/prog \n", args);

Unusual indentation.

>      }
>  
> -    if (setfield->top_field_first < -1 || setfield->top_field_first > 1) {
> +    if (setfield->top_field_first < -1 || setfield->top_field_first > 2) {
>          av_log(ctx, AV_LOG_ERROR,
> -               "Provided integer value %d must be included between -1 and +1\n",
> +               "Provided integer value %d must be included between -1 and +2\n",
>                 setfield->top_field_first);

Nit: maybe move the integer check in the else just above, so it applies only
to numeric values and can stay at -1 - 1. That way, people will not start
using +2 despite the docs.

>          return AVERROR(EINVAL);
>      }
> @@ -63,7 +66,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
>      SetFieldContext *setfield = inlink->dst->priv;
>      AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
>  
> -    if (setfield->top_field_first != -1) {
> +    if (setfield->top_field_first = 2) outpicref->video->interlaced = 0;

This looks like a == / = mistake.

> +    else if (setfield->top_field_first != -1) {
>          outpicref->video->interlaced = 1;
>          outpicref->video->top_field_first = setfield->top_field_first;
>      }

Thanks for your work.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120418/213bfb24/attachment.asc>


More information about the ffmpeg-devel mailing list