Commit 1f5c1333 authored by Nicolas George's avatar Nicolas George

sink_buffer: implement fixed frame size.

parent 0689d5e1
...@@ -55,6 +55,15 @@ typedef struct { ...@@ -55,6 +55,15 @@ typedef struct {
*/ */
AVABufferSinkParams *av_abuffersink_params_alloc(void); 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 * Tell av_buffersink_get_buffer_ref() to read video/samples buffer
* reference, but not remove it from the buffer. This is useful if you * reference, but not remove it from the buffer. This is useful if you
......
...@@ -125,6 +125,14 @@ static void end_frame(AVFilterLink *inlink) ...@@ -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, int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
AVFilterBufferRef **bufref, int flags) AVFilterBufferRef **bufref, int flags)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment