[FFmpeg-devel] [PATCH 2/2] lavfi/vf_tile: forward errors.

Clément Bœsch ubitux at gmail.com
Thu Nov 29 22:29:05 CET 2012


On Thu, Nov 29, 2012 at 05:19:37PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/vf_tile.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c
> index 676c5de..5f5c6d6 100644
> --- a/libavfilter/vf_tile.c
> +++ b/libavfilter/vf_tile.c
> @@ -149,17 +149,19 @@ static void draw_blank_frame(AVFilterContext *ctx, AVFilterBufferRef *out_buf)
>                        x0, y0, inlink->w, inlink->h);
>      tile->current++;
>  }
> -static void end_last_frame(AVFilterContext *ctx)
> +static int end_last_frame(AVFilterContext *ctx)
>  {
>      TileContext *tile    = ctx->priv;
>      AVFilterLink *outlink = ctx->outputs[0];
>      AVFilterBufferRef *out_buf = outlink->out_buf;
> +    int ret;
>  
>      outlink->out_buf = NULL;
>      while (tile->current < tile->nb_frames)
>          draw_blank_frame(ctx, out_buf);
> -    ff_filter_frame(outlink, out_buf);
> +    ret = ff_filter_frame(outlink, out_buf);
>      tile->current = 0;
> +    return ret;
>  }
>  
>  /* Note: direct rendering is not possible since there is no guarantee that
> @@ -198,7 +200,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
>  
>      avfilter_unref_bufferp(&inlink->cur_buf);
>      if (++tile->current == tile->nb_frames)
> -        end_last_frame(ctx);
> +        return end_last_frame(ctx);
>  
>      return 0;
>  }
> @@ -214,15 +216,13 @@ static int request_frame(AVFilterLink *outlink)
>          r = ff_request_frame(inlink);
>          if (r < 0) {
>              if (r == AVERROR_EOF && tile->current)
> -                end_last_frame(ctx);
> -            else
> -                return r;
> +                r = end_last_frame(ctx);
>              break;
>          }
>          if (!tile->current) /* done */
>              break;
>      }
> -    return 0;
> +    return r;

I saw a lot of filters ignoring the return of ff_filter_frame (and the
previous start/draw/end) in the request_frame callback; was this because
historically request_frame was void? Or there is another reason?

-- 
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/20121129/9ed721a8/attachment.asc>


More information about the ffmpeg-devel mailing list