From a502939d64e807da6b3a9be84f4b21b35e5d251f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 6 Dec 2011 17:02:15 +0100 Subject: buffersink: Implement a poll function. With this the application can find out how many frames are available. Signed-off-by: Michael Niedermayer --- libavfilter/sink_buffer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libavfilter/sink_buffer.c') diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c index bfbec7d555..e572385419 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) -- cgit v1.2.3