[FFmpeg-devel] [PATCH 1/2] buffersink: Implement a poll function. With this the application can find out how many frames are available.

Michael Niedermayer michaelni at gmx.at
Thu Dec 8 21:20:15 CET 2011


On Thu, Dec 08, 2011 at 03:09:43PM +0100, Stefano Sabatini wrote:
> On date Tuesday 2011-12-06 17:10:24 +0100, Michael Niedermayer encoded:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavfilter/buffersink.h  |    6 ++++++
> >  libavfilter/sink_buffer.c |    8 ++++++++
> >  2 files changed, 14 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
> > index c5ae7dc..980fa81 100644
> > --- a/libavfilter/buffersink.h
> > +++ b/libavfilter/buffersink.h
> > @@ -76,6 +76,12 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void);
> >  int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink,
> >                                   AVFilterBufferRef **bufref, int flags);
> >  
> > +
> > +/**
> > + * Gets the number of immedeatly available frames.
> 
> typos: Gets -> Get, immedeatly -> immediately
> 
> > + */
> > +int av_buffersink_poll_frame(AVFilterContext *ctx);
> > +
> >  #if FF_API_OLD_VSINK_API
> >  /**
> >   * @deprecated Use av_buffersink_get_buffer_ref() instead.
> > diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c
> > index bfbec7d..e572385 100644
> > --- a/libavfilter/sink_buffer.c
> > +++ b/libavfilter/sink_buffer.c
> > @@ -140,6 +140,14 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
> >      return 0;
> >  }
> >  
> > +int av_buffersink_poll_frame(AVFilterContext *ctx)
> > +{
> > +    BufferSinkContext *buf = ctx->priv;
> > +    AVFilterLink *inlink = ctx->inputs[0];
> > +
> > +    return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + avfilter_poll_frame(inlink);
> > +}
> > +
> >  #if FF_API_OLD_VSINK_API
> >  int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *ctx,
> >                                           AVFilterBufferRef **picref, int flags)
> 
> Looks fine to me, just please bump minor and possibly add an
> APIchanges entry or I'll do it after the commit.

bumped, typo fixed
ill leave the APIchanges to you

applied, thanks


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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20111208/688cc03a/attachment.asc>


More information about the ffmpeg-devel mailing list