[FFmpeg-devel] [PATCH 1/4] lavfi: add filter metaframes infrastructure.

Michael Niedermayer michaelni at gmx.at
Thu Jul 31 05:17:21 CEST 2014


On Wed, Jul 30, 2014 at 11:44:46PM +0200, Nicolas George wrote:
> Metaframes are frames without data, identified by a negative
> format code, used to carry special conditions.
> They are sent only to filter that declare supporting them.
> The only metaframe for now is EOF; this mechanism augments
> the current mechanism based on request_frame() returning
> AVERROR_EOF, with the advantage that the EOF metaframe carries
> a timestamp.
> The metaframes are a purely internal API and do not leak to
> the application.
> 
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavfilter/avfilter.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-----
>  libavfilter/internal.h | 34 +++++++++++++++++++++++
>  2 files changed, 100 insertions(+), 7 deletions(-)
> 
> 
> Changed the name to "metaframes".
> Allocate the frame with the classic method.
> 
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 7b11467..7894173 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -346,15 +346,16 @@ int ff_request_frame(AVFilterLink *link)
>              ret = link->srcpad->request_frame(link);
>          else if (link->src->inputs[0])
>              ret = ff_request_frame(link->src->inputs[0]);
> -        if (ret == AVERROR_EOF && link->partial_buf) {
> -            AVFrame *pbuf = link->partial_buf;
> -            link->partial_buf = NULL;
> -            ret = ff_filter_frame_framed(link, pbuf);
> -        }
>          if (ret < 0) {
> +            if (!link->frame_requested) {
> +                av_assert0(ret == AVERROR_EOF);
> +                ret = 0;
> +            }
>              link->frame_requested = 0;
> -            if (ret == AVERROR_EOF)
> -                link->closed = 1;
> +            if (ret == AVERROR_EOF) {
> +                ret = ff_filter_link_close(link, AV_NOPTS_VALUE);
> +                return ret < 0 ? ret : AVERROR_EOF;
> +            }
>          } else {
>              av_assert0(!link->frame_requested ||
>                         link->flags & FF_LINK_FLAG_REQUEST_LOOP);

> @@ -1132,10 +1133,52 @@ static int ff_filter_frame_needs_framing(AVFilterLink *link, AVFrame *frame)
>      return ret;
>  }
>  
> +static int ff_filter_metaframe(AVFilterLink *link, AVFrame *frame)
> +{
> +    AVFrame *pbuf = link->partial_buf;
> +    int ret;

ret needs to be initialized to 0 here
(this was what caused tha swr failures i belive)


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140731/0d1a8a4f/attachment.asc>


More information about the ffmpeg-devel mailing list