[FFmpeg-devel] [PATCH 2/6] lavfi: loop on request_frame if necessary.

Michael Niedermayer michaelni at gmx.at
Mon Apr 1 18:08:40 CEST 2013


On Sun, Mar 31, 2013 at 07:43:45PM +0200, Nicolas George wrote:
> Some filters need several input frames before producing output.
> For these filter, it becomes simpler to return 0 in
> request_frame() and let the framework call it again until
> output has been produced.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/avfilter.c |   17 +++++++++++++++--
>  libavfilter/avfilter.h |   11 +++++++++++
>  libavfilter/internal.h |   14 ++++++++++++++
>  3 files changed, 40 insertions(+), 2 deletions(-)
> 
> 
> Note: the flag on the link is not strictly necessary, looping could be
> unconditional, but it may hide bugs, so I would rather enable it only
> if requested.
> 
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 8a907dc..f621941 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -323,6 +323,10 @@ int ff_request_frame(AVFilterLink *link)
>  
>      if (link->closed)
>          return AVERROR_EOF;
> +    av_assert0(!link->frame_requested);
> +    link->frame_requested = 1;

iam not sure this assert (and thus 0 vs 1) is safe in complicated
filter graphs

otherwise patch should be ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- 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/20130401/6e950a50/attachment.asc>


More information about the ffmpeg-devel mailing list