diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-06 17:02:15 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-08 21:19:23 +0100 |
commit | a502939d64e807da6b3a9be84f4b21b35e5d251f (patch) | |
tree | 07edbecf8c03a308f295391f634a023b35a14161 | |
parent | fab97adb668b341376b77b9e28709e54afb4fa51 (diff) | |
download | ffmpeg-a502939d64e807da6b3a9be84f4b21b35e5d251f.tar.gz |
buffersink: Implement a poll function.
With this the application can find out how many frames are available.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavfilter/avfilter.h | 2 | ||||
-rw-r--r-- | libavfilter/buffersink.h | 6 | ||||
-rw-r--r-- | libavfilter/sink_buffer.c | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 24998a65a7..1e295abc04 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -29,7 +29,7 @@ #include "libavutil/rational.h" #define LIBAVFILTER_VERSION_MAJOR 2 -#define LIBAVFILTER_VERSION_MINOR 51 +#define LIBAVFILTER_VERSION_MINOR 52 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h index c5ae7dcdd0..73926a4539 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); + +/** + * Get the number of immediately available frames. + */ +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 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) |