Browse code

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>

Michael Niedermayer authored on 2011/12/07 01:02:15
Showing 3 changed files
... ...
@@ -29,7 +29,7 @@
29 29
 #include "libavutil/rational.h"
30 30
 
31 31
 #define LIBAVFILTER_VERSION_MAJOR  2
32
-#define LIBAVFILTER_VERSION_MINOR 51
32
+#define LIBAVFILTER_VERSION_MINOR 52
33 33
 #define LIBAVFILTER_VERSION_MICRO  0
34 34
 
35 35
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
... ...
@@ -76,6 +76,12 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void);
76 76
 int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink,
77 77
                                  AVFilterBufferRef **bufref, int flags);
78 78
 
79
+
80
+/**
81
+ * Get the number of immediately available frames.
82
+ */
83
+int av_buffersink_poll_frame(AVFilterContext *ctx);
84
+
79 85
 #if FF_API_OLD_VSINK_API
80 86
 /**
81 87
  * @deprecated Use av_buffersink_get_buffer_ref() instead.
... ...
@@ -140,6 +140,14 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
140 140
     return 0;
141 141
 }
142 142
 
143
+int av_buffersink_poll_frame(AVFilterContext *ctx)
144
+{
145
+    BufferSinkContext *buf = ctx->priv;
146
+    AVFilterLink *inlink = ctx->inputs[0];
147
+
148
+    return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + avfilter_poll_frame(inlink);
149
+}
150
+
143 151
 #if FF_API_OLD_VSINK_API
144 152
 int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *ctx,
145 153
                                          AVFilterBufferRef **picref, int flags)