[FFmpeg-devel] [PATCH 7/8] buffersink: add AV_BUFFERSINK_FLAG_NO_REQUEST.

Nicolas George nicolas.george at normalesup.org
Fri Apr 20 12:31:46 CEST 2012


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavfilter/buffersink.h  |    7 +++++++
 libavfilter/sink_buffer.c |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 73926a4..cf6bd69 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -64,6 +64,13 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void);
 #define AV_BUFFERSINK_FLAG_PEEK 1
 
 /**
+ * Tell av_buffersink_get_buffer_ref() not to request a frame fom its input.
+ * If a frame is already buffered, it is read (and removed from the buffer),
+ * but if no frame is present, return AVERROR(EAGAIN).
+ */
+#define AV_BUFFERSINK_FLAG_NO_REQUEST 2
+
+/**
  * Get an audio/video buffer data from buffer_sink and put it in bufref.
  *
  * This function works with both audio and video buffer sinks.
diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c
index 8eb695e..b0cc519 100644
--- a/libavfilter/sink_buffer.c
+++ b/libavfilter/sink_buffer.c
@@ -126,6 +126,8 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
 
     /* no picref available, fetch it from the filterchain */
     if (!av_fifo_size(buf->fifo)) {
+        if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)
+            return AVERROR(EAGAIN);
         if ((ret = avfilter_request_frame(inlink)) < 0)
             return ret;
     }
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list