FFmpeg
Data Structures | Macros | Functions | Variables
sink_buffer.c File Reference

buffer sink More...

#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/fifo.h"
#include "avfilter.h"
#include "buffersink.h"
#include "audio.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  BufferSinkContext
 

Macros

#define FIFO_INIT_SIZE   8
 

Functions

AVBufferSinkParamsav_buffersink_params_alloc (void)
 Create an AVBufferSinkParams structure.
 
AVABufferSinkParamsav_abuffersink_params_alloc (void)
 Create an AVABufferSinkParams structure.
 
static av_cold int common_init (AVFilterContext *ctx)
 
static av_cold void common_uninit (AVFilterContext *ctx)
 
static int add_buffer_ref (AVFilterContext *ctx, AVFilterBufferRef *ref)
 
static int filter_frame (AVFilterLink *inlink, AVFilterBufferRef *ref)
 
void av_buffersink_set_frame_size (AVFilterContext *ctx, unsigned frame_size)
 Set the frame size for an audio buffer sink.
 
int av_buffersink_get_buffer_ref (AVFilterContext *ctx, AVFilterBufferRef **bufref, int flags)
 Get an audio/video buffer data from buffer_sink and put it in bufref.
 
AVRational av_buffersink_get_frame_rate (AVFilterContext *ctx)
 Get the frame rate of the input.
 
int av_buffersink_poll_frame (AVFilterContext *ctx)
 Get the number of immediately available frames.
 
static av_cold int vsink_init (AVFilterContext *ctx, const char *args, void *opaque)
 
static av_cold void vsink_uninit (AVFilterContext *ctx)
 
static int vsink_query_formats (AVFilterContext *ctx)
 
static int64_t * concat_channels_lists (const int64_t *layouts, const int *counts)
 
static av_cold int asink_init (AVFilterContext *ctx, const char *args, void *opaque)
 
static av_cold void asink_uninit (AVFilterContext *ctx)
 
static int asink_query_formats (AVFilterContext *ctx)
 
int av_buffersink_read (AVFilterContext *ctx, AVFilterBufferRef **buf)
 Get a buffer with filtered data from sink and put it in buf.
 
int av_buffersink_read_samples (AVFilterContext *ctx, AVFilterBufferRef **buf, int nb_samples)
 Same as av_buffersink_read, but with the ability to specify the number of samples read.
 

Variables

static const AVFilterPad ffbuffersink_inputs []
 
AVFilter avfilter_vsink_ffbuffersink
 
static const AVFilterPad buffersink_inputs []
 
AVFilter avfilter_vsink_buffersink
 
static const AVFilterPad ffabuffersink_inputs []
 
AVFilter avfilter_asink_ffabuffersink
 
static const AVFilterPad abuffersink_inputs []
 
AVFilter avfilter_asink_abuffersink
 
AVFilter avfilter_vsink_buffer
 
AVFilter avfilter_asink_abuffer
 

Detailed Description

buffer sink

Definition in file sink_buffer.c.

Macro Definition Documentation

#define FIFO_INIT_SIZE   8

Definition at line 68 of file sink_buffer.c.

Referenced by common_init().

Function Documentation

static int add_buffer_ref ( AVFilterContext ctx,
AVFilterBufferRef ref 
)
static

Definition at line 98 of file sink_buffer.c.

Referenced by av_buffersink_read_samples(), and filter_frame().

static av_cold int asink_init ( AVFilterContext ctx,
const char *  args,
void opaque 
)
static

Definition at line 297 of file sink_buffer.c.

static int asink_query_formats ( AVFilterContext ctx)
static

Definition at line 338 of file sink_buffer.c.

static av_cold void asink_uninit ( AVFilterContext ctx)
static

Definition at line 328 of file sink_buffer.c.

AVABufferSinkParams* av_abuffersink_params_alloc ( void  )

Create an AVABufferSinkParams structure.

Must be freed with av_free().

Definition at line 45 of file sink_buffer.c.

Referenced by configure_output_audio_filter(), init_filters(), and lavfi_read_header().

int av_buffersink_get_buffer_ref ( AVFilterContext buffer_sink,
AVFilterBufferRef **  bufref,
int  flags 
)

Get an audio/video buffer data from buffer_sink and put it in bufref.

This function works with both audio and video buffer sinks.

Parameters
buffer_sinkpointer to a buffersink or abuffersink context
flagsa combination of AV_BUFFERSINK_FLAG_* flags
Returns
>= 0 in case of success, a negative AVERROR code in case of failure

Definition at line 144 of file sink_buffer.c.

Referenced by av_buffersink_read(), av_buffersink_read_samples(), lavfi_read_packet(), main(), reap_filters(), and video_thread().

AVRational av_buffersink_get_frame_rate ( AVFilterContext ctx)

Get the frame rate of the input.

Definition at line 176 of file sink_buffer.c.

Referenced by transcode_init().

AVBufferSinkParams* av_buffersink_params_alloc ( void  )

Create an AVBufferSinkParams structure.

Must be freed with av_free().

Definition at line 34 of file sink_buffer.c.

Referenced by configure_output_video_filter(), init_filters(), and lavfi_read_header().

int av_buffersink_poll_frame ( AVFilterContext ctx)

Get the number of immediately available frames.

Definition at line 184 of file sink_buffer.c.

void av_buffersink_set_frame_size ( AVFilterContext ctx,
unsigned  frame_size 
)

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.

Definition at line 136 of file sink_buffer.c.

Referenced by decode_audio(), and transcode_init().

static av_cold int common_init ( AVFilterContext ctx)
static

Definition at line 70 of file sink_buffer.c.

Referenced by asink_init(), and vsink_init().

static av_cold void common_uninit ( AVFilterContext ctx)
static

Definition at line 83 of file sink_buffer.c.

Referenced by asink_uninit(), and vsink_uninit().

static int64_t* concat_channels_lists ( const int64_t *  layouts,
const int *  counts 
)
static

Definition at line 276 of file sink_buffer.c.

Referenced by asink_init().

static int filter_frame ( AVFilterLink inlink,
AVFilterBufferRef ref 
)
static

Definition at line 117 of file sink_buffer.c.

static av_cold int vsink_init ( AVFilterContext ctx,
const char *  args,
void opaque 
)
static

Definition at line 197 of file sink_buffer.c.

static int vsink_query_formats ( AVFilterContext ctx)
static

Definition at line 220 of file sink_buffer.c.

static av_cold void vsink_uninit ( AVFilterContext ctx)
static

Definition at line 213 of file sink_buffer.c.

Variable Documentation

const AVFilterPad abuffersink_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL },
}

Definition at line 389 of file sink_buffer.c.

AVFilter avfilter_asink_abuffer

Definition at line 178 of file buffersink.c.

AVFilter avfilter_asink_abuffersink
Initial value:
= {
.name = "abuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
.init_opaque = asink_init,
.uninit = asink_uninit,
.priv_size = sizeof(BufferSinkContext),
}

Definition at line 399 of file sink_buffer.c.

AVFilter avfilter_asink_ffabuffersink
Initial value:
= {
.name = "ffabuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
.init_opaque = asink_init,
.uninit = asink_uninit,
.priv_size = sizeof(BufferSinkContext),
}

Definition at line 378 of file sink_buffer.c.

AVFilter avfilter_vsink_buffer

Definition at line 153 of file buffersink.c.

AVFilter avfilter_vsink_buffersink
Initial value:
= {
.name = "buffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
.priv_size = sizeof(BufferSinkContext),
.init_opaque = vsink_init,
}

Definition at line 264 of file sink_buffer.c.

AVFilter avfilter_vsink_ffbuffersink
Initial value:
= {
.name = "ffbuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
.priv_size = sizeof(BufferSinkContext),
.init_opaque = vsink_init,
}

Definition at line 242 of file sink_buffer.c.

const AVFilterPad buffersink_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL },
}

Definition at line 254 of file sink_buffer.c.

const AVFilterPad ffabuffersink_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL },
}

Definition at line 368 of file sink_buffer.c.

const AVFilterPad ffbuffersink_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL },
}

Definition at line 232 of file sink_buffer.c.