OSDN Git Service

buffersink: Implement a poll function.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Dec 2011 16:02:15 +0000 (17:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 8 Dec 2011 20:19:23 +0000 (21:19 +0100)
With this the application can find out how many frames are available.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/avfilter.h
libavfilter/buffersink.h
libavfilter/sink_buffer.c

index 24998a6..1e295ab 100644 (file)
@@ -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, \
index c5ae7dc..73926a4 100644 (file)
@@ -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.
index bfbec7d..e572385 100644 (file)
@@ -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)