FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
buffersink.c File Reference

buffer sink More...

#include "libavutil/audio_fifo.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "buffersink.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  BufferSinkContext
 

Macros

#define NB_ITEMS(list)   (list ## _size / sizeof(*list))
 
#define FIFO_INIT_SIZE   8
 
#define FIFO_INIT_ELEMENT_SIZE   sizeof(void *)
 
#define CHECK_LIST_SIZE(field)
 
#define OFFSET(x)   offsetof(BufferSinkContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

static av_cold void uninit (AVFilterContext *ctx)
 
static int add_buffer_ref (AVFilterContext *ctx, AVFrame *ref)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 
int attribute_align_arg av_buffersink_get_frame (AVFilterContext *ctx, AVFrame *frame)
 Get a frame with filtered data from sink and put it in frame. More...
 
int attribute_align_arg av_buffersink_get_frame_flags (AVFilterContext *ctx, AVFrame *frame, int flags)
 Get a frame with filtered data from sink and put it in frame. More...
 
static int read_from_fifo (AVFilterContext *ctx, AVFrame *frame, int nb_samples)
 
int attribute_align_arg av_buffersink_get_samples (AVFilterContext *ctx, AVFrame *frame, int nb_samples)
 Same as av_buffersink_get_frame(), but with the ability to specify the number of samples read. More...
 
AVBufferSinkParamsav_buffersink_params_alloc (void)
 Create an AVBufferSinkParams structure. More...
 
AVABufferSinkParamsav_abuffersink_params_alloc (void)
 Create an AVABufferSinkParams structure. More...
 
static av_cold int common_init (AVFilterContext *ctx)
 
void av_buffersink_set_frame_size (AVFilterContext *ctx, unsigned frame_size)
 Set the frame size for an audio buffer sink. More...
 
AVRational av_buffersink_get_frame_rate (AVFilterContext *ctx)
 Get the frame rate of the input. More...
 
static av_cold int vsink_init (AVFilterContext *ctx, void *opaque)
 
static int vsink_query_formats (AVFilterContext *ctx)
 
static av_cold int asink_init (AVFilterContext *ctx, void *opaque)
 
static int asink_query_formats (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (buffersink)
 
 AVFILTER_DEFINE_CLASS (abuffersink)
 

Variables

static const AVOption buffersink_options []
 
static const AVOption abuffersink_options []
 
static const AVFilterPad avfilter_vsink_buffer_inputs []
 
AVFilter ff_vsink_buffer
 
static const AVFilterPad avfilter_asink_abuffer_inputs []
 
AVFilter ff_asink_abuffer
 

Detailed Description

buffer sink

Definition in file buffersink.c.

Macro Definition Documentation

#define NB_ITEMS (   list)    (list ## _size / sizeof(*list))

Definition at line 64 of file buffersink.c.

Referenced by asink_query_formats(), and vsink_query_formats().

#define FIFO_INIT_SIZE   8

Definition at line 65 of file buffersink.c.

Referenced by common_init().

#define FIFO_INIT_ELEMENT_SIZE   sizeof(void *)

Definition at line 66 of file buffersink.c.

Referenced by add_buffer_ref(), common_init(), filter_frame(), and uninit().

#define CHECK_LIST_SIZE (   field)
Value:
if (buf->field ## _size % sizeof(*buf->field)) { \
av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \
"should be multiple of %d\n", \
buf->field ## _size, (int)sizeof(*buf->field)); \
return AVERROR(EINVAL); \
}
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define AVERROR(e)
Definition: error.h:43
return
AVFormatContext * ctx
Definition: movenc.c:48
void * buf
Definition: avisynth_c.h:553

Definition at line 293 of file buffersink.c.

Referenced by asink_query_formats(), and vsink_query_formats().

#define OFFSET (   x)    offsetof(BufferSinkContext, x)

Definition at line 391 of file buffersink.c.

Definition at line 398 of file buffersink.c.

Definition at line 398 of file buffersink.c.

Function Documentation

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 68 of file buffersink.c.

static int add_buffer_ref ( AVFilterContext ctx,
AVFrame ref 
)
static

Definition at line 85 of file buffersink.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 104 of file buffersink.c.

static int read_from_fifo ( AVFilterContext ctx,
AVFrame frame,
int  nb_samples 
)
static

Definition at line 163 of file buffersink.c.

Referenced by av_buffersink_get_samples().

static av_cold int common_init ( AVFilterContext ctx)
static

Definition at line 249 of file buffersink.c.

Referenced by asink_init(), and vsink_init().

static av_cold int vsink_init ( AVFilterContext ctx,
void opaque 
)
static

Definition at line 279 of file buffersink.c.

static int vsink_query_formats ( AVFilterContext ctx)
static

Definition at line 300 of file buffersink.c.

static av_cold int asink_init ( AVFilterContext ctx,
void opaque 
)
static

Definition at line 322 of file buffersink.c.

static int asink_query_formats ( AVFilterContext ctx)
static

Definition at line 339 of file buffersink.c.

AVFILTER_DEFINE_CLASS ( buffersink  )
AVFILTER_DEFINE_CLASS ( abuffersink  )

Variable Documentation

const AVOption buffersink_options[]
static
Initial value:
= {
{ "pix_fmts", "set the supported pixel formats", OFFSET(pixel_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: buffersink.c:398
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:229
#define OFFSET(x)
Definition: buffersink.c:391

Definition at line 393 of file buffersink.c.

const AVOption abuffersink_options[]
static
Initial value:
= {
{ "sample_fmts", "set the supported sample formats", OFFSET(sample_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
{ "sample_rates", "set the supported sample rates", OFFSET(sample_rates), AV_OPT_TYPE_BINARY, .flags = FLAGS },
{ "channel_layouts", "set the supported channel layouts", OFFSET(channel_layouts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
{ "channel_counts", "set the supported channel counts", OFFSET(channel_counts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
{ "all_channel_counts", "accept all channel counts", OFFSET(all_channel_counts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: buffersink.c:398
static const int sample_rates[]
Definition: dcaenc.h:32
static const uint8_t channel_counts[7]
Definition: dca_lbr.c:114
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:229
#define OFFSET(x)
Definition: buffersink.c:391
static const uint16_t channel_layouts[7]
Definition: dca_lbr.c:118
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701

Definition at line 399 of file buffersink.c.

const AVFilterPad avfilter_vsink_buffer_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: buffersink.c:104

Definition at line 412 of file buffersink.c.

AVFilter ff_vsink_buffer
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),
.priv_class = &buffersink_class,
.init_opaque = vsink_init,
}
#define NULL
Definition: coverity.c:32
static av_cold void uninit(AVFilterContext *ctx)
Definition: buffersink.c:68
static av_cold int vsink_init(AVFilterContext *ctx, void *opaque)
Definition: buffersink.c:279
static int vsink_query_formats(AVFilterContext *ctx)
Definition: buffersink.c:300
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244
static const AVFilterPad avfilter_vsink_buffer_inputs[]
Definition: buffersink.c:412

Definition at line 421 of file buffersink.c.

const AVFilterPad avfilter_asink_abuffer_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: buffersink.c:104

Definition at line 434 of file buffersink.c.

AVFilter ff_asink_abuffer
Initial value:
= {
.name = "abuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
.priv_class = &abuffersink_class,
.priv_size = sizeof(BufferSinkContext),
.init_opaque = asink_init,
}
#define NULL
Definition: coverity.c:32
static av_cold void uninit(AVFilterContext *ctx)
Definition: buffersink.c:68
static av_cold int asink_init(AVFilterContext *ctx, void *opaque)
Definition: buffersink.c:322
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const AVFilterPad avfilter_asink_abuffer_inputs[]
Definition: buffersink.c:434
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244
static int asink_query_formats(AVFilterContext *ctx)
Definition: buffersink.c:339

Definition at line 443 of file buffersink.c.