[FFmpeg-cvslog] sink_buffer: implement fixed frame size.
Nicolas George
git at videolan.org
Sat Jun 30 14:22:01 CEST 2012
ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Mon Jun 25 00:30:15 2012 +0200| [1f5c1333a733a7cba1803c9f9eab86da5f010bd5] | committer: Nicolas George
sink_buffer: implement fixed frame size.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f5c1333a733a7cba1803c9f9eab86da5f010bd5
---
libavfilter/buffersink.h | 9 +++++++++
libavfilter/sink_buffer.c | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index e9148f7..808c0c7 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -56,6 +56,15 @@ typedef struct {
AVABufferSinkParams *av_abuffersink_params_alloc(void);
/**
+ * Set the frame size for an audio buffer sink.
+ *
+ * All calls to av_buffersink_get_buffer_ref will return a buffer with
+ * exactly the specified number of samples, or AVERROR(EAGAIN) if there is
+ * not enough. The last buffer at EOF will be padded with 0.
+ */
+void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size);
+
+/**
* Tell av_buffersink_get_buffer_ref() to read video/samples buffer
* reference, but not remove it from the buffer. This is useful if you
* need only to read a video/samples buffer, without to fetch it.
diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c
index 4db874f..2f3dff8 100644
--- a/libavfilter/sink_buffer.c
+++ b/libavfilter/sink_buffer.c
@@ -125,6 +125,14 @@ static void end_frame(AVFilterLink *inlink)
}
}
+void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
+{
+ AVFilterLink *inlink = ctx->inputs[0];
+
+ inlink->min_samples = inlink->max_samples =
+ inlink->partial_buf_size = frame_size;
+}
+
int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
AVFilterBufferRef **bufref, int flags)
{
More information about the ffmpeg-cvslog
mailing list