[FFmpeg-devel] [PATCH] lavfi/super2xsai: switch to ff_filter_frame() API

Clément Bœsch ubitux at gmail.com
Sun Dec 2 02:04:22 CET 2012


On Sun, Dec 02, 2012 at 01:53:54AM +0100, Stefano Sabatini wrote:
> ---
>  libavfilter/vf_super2xsai.c |   24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c
> index af4adff..d082761 100644
> --- a/libavfilter/vf_super2xsai.c
> +++ b/libavfilter/vf_super2xsai.c
> @@ -30,6 +30,7 @@
>  #include "libavutil/intreadwrite.h"
>  #include "avfilter.h"
>  #include "formats.h"
> +#include "internal.h"
>  #include "video.h"
>  
>  typedef struct {
> @@ -302,20 +303,20 @@ static int config_output(AVFilterLink *outlink)
>      return 0;
>  }
>  
> -static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { return 0; }
> -
> -static int end_frame(AVFilterLink *inlink)
> +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inframe)
>  {
>      AVFilterLink *outlink = inlink->dst->outputs[0];
> -    AVFilterBufferRef  *inpicref =  inlink->cur_buf;
> -    AVFilterBufferRef *outpicref = outlink->out_buf;
> -
> -    super2xsai(inlink->dst, inpicref->data[0], inpicref->linesize[0],
> -               outpicref->data[0], outpicref->linesize[0],
> +    AVFilterBufferRef *outframe = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
> +    if (!outframe) {
> +        avfilter_unref_bufferp(&inframe);
> +        return AVERROR(ENOMEM);
> +    }
> +    avfilter_copy_buffer_ref_props(outframe, inframe);
> +    super2xsai(inlink->dst, inframe->data[0], inframe->linesize[0],
> +               outframe->data[0], outframe->linesize[0],
>                 inlink->w, inlink->h);
>  
> -    ff_draw_slice(outlink, 0, outlink->h, 1);
> -    return ff_end_frame(outlink);
> +    return ff_filter_frame(outlink, outframe);

You're requesting a new buffer, so you need to unref inframe.

>  }
>  
>  static const AVFilterPad super2xsai_inputs[] = {
> @@ -323,8 +324,7 @@ static const AVFilterPad super2xsai_inputs[] = {
>          .name         = "default",
>          .type         = AVMEDIA_TYPE_VIDEO,
>          .config_props = config_input,
> -        .draw_slice   = null_draw_slice,
> -        .end_frame    = end_frame,
> +        .filter_frame = filter_frame,
>          .min_perms    = AV_PERM_READ,
>      },
>      { NULL }

Rest LGTM.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121202/d4c3b2d1/attachment.asc>


More information about the ffmpeg-devel mailing list