FFmpeg
Loading...
Searching...
No Matches
buffersink.c File Reference

buffer sink More...

#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "avfilter_internal.h"
#include "buffersink.h"
#include "filters.h"
#include "formats.h"
#include "framequeue.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BufferSinkContext
 

Macros

#define TERMINATE_ARRAY(arr, val)
 
#define MAKE_AVFILTERLINK_ACCESSOR(type, field)
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
 

Functions

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.
 
static int return_or_keep_frame (BufferSinkContext *buf, AVFrame *out, AVFrame *in, int flags)
 
static int get_frame_internal (AVFilterContext *ctx, AVFrame *frame, int flags, int samples)
 
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.
 
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.
 
static av_cold int common_init (AVFilterContext *ctx)
 
static int init_video (AVFilterContext *ctx)
 
static int init_audio (AVFilterContext *ctx)
 
static void uninit (AVFilterContext *ctx)
 
static int activate (AVFilterContext *ctx)
 
static int config_input_audio (AVFilterLink *inlink)
 
void av_buffersink_set_frame_size (AVFilterContext *ctx, unsigned frame_size)
 Set the frame size for an audio buffer sink.
 
AVRational av_buffersink_get_frame_rate (const AVFilterContext *ctx)
 
AVBufferRefav_buffersink_get_hw_frames_ctx (const AVFilterContext *ctx)
 
int av_buffersink_get_channels (const AVFilterContext *ctx)
 
int av_buffersink_get_ch_layout (const AVFilterContext *ctx, AVChannelLayout *out)
 
const AVFrameSideData *const * av_buffersink_get_side_data (const AVFilterContext *ctx, int *nb_side_data)
 
static int vsink_query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int asink_query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
 AVFILTER_DEFINE_CLASS (buffersink)
 
 AVFILTER_DEFINE_CLASS (abuffersink)
 

Variables

static const AVOption buffersink_options []
 
static const AVOption abuffersink_options []
 
const FFFilter ff_vsink_buffer
 
static const AVFilterPad inputs_audio []
 
const FFFilter ff_asink_abuffer
 

Detailed Description

buffer sink

Definition in file buffersink.c.

Macro Definition Documentation

◆ TERMINATE_ARRAY

#define TERMINATE_ARRAY ( arr,
val )
Value:
if (s->arr) { \
void *tmp = av_realloc_array(s->arr, s->nb_ ## arr + 1, sizeof(*s->arr)); \
if (!tmp) \
return AVERROR(ENOMEM); \
s->arr = tmp; \
s->arr[s->nb_ ## arr] = val; \
}
static double val(void *priv, double ch)
Definition aeval.c:77
#define s(width, name)
Definition cbs_vp9.c:198
#define AVERROR(e)
Definition error.h:45
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition mem.c:217
static uint8_t tmp[40]
Definition aes_ctr.c:52

Definition at line 155 of file buffersink.c.

Referenced by init_audio(), and init_video().

◆ MAKE_AVFILTERLINK_ACCESSOR

#define MAKE_AVFILTERLINK_ACCESSOR ( type,
field )
Value:
type av_buffersink_get_##field(const AVFilterContext *ctx) { \
av_assert0(fffilter(ctx->filter)->activate == activate); \
return ctx->inputs[0]->field; \
}
cl_device_type type
static int activate(AVBitStreamFilterContext *ctx)
static const FFFilter * fffilter(const AVFilter *f)
Definition filters.h:464
An instance of a filter.
Definition avfilter.h:273
int(* activate)(AVFilterContext *ctx)
Filter activation function.
Definition filters.h:461
static AVFormatContext * ctx
Definition movenc.c:49

Definition at line 235 of file buffersink.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 352 of file buffersink.c.

◆ FLAGS [1/2]

Definition at line 353 of file buffersink.c.

◆ FLAGS [2/2]

Definition at line 353 of file buffersink.c.

Function Documentation

◆ return_or_keep_frame()

static int return_or_keep_frame ( BufferSinkContext * buf,
AVFrame * out,
AVFrame * in,
int flags )
static

Definition at line 79 of file buffersink.c.

Referenced by get_frame_internal().

◆ get_frame_internal()

static int get_frame_internal ( AVFilterContext * ctx,
AVFrame * frame,
int flags,
int samples )
static

Definition at line 93 of file buffersink.c.

Referenced by av_buffersink_get_frame_flags(), and av_buffersink_get_samples().

◆ common_init()

static av_cold int common_init ( AVFilterContext * ctx)
static

Definition at line 147 of file buffersink.c.

Referenced by init_audio(), and init_video().

◆ init_video()

static int init_video ( AVFilterContext * ctx)
static

Definition at line 164 of file buffersink.c.

◆ init_audio()

static int init_audio ( AVFilterContext * ctx)
static

Definition at line 176 of file buffersink.c.

◆ uninit()

static void uninit ( AVFilterContext * ctx)
static

Definition at line 189 of file buffersink.c.

◆ activate()

static int activate ( AVFilterContext * ctx)
static

Definition at line 196 of file buffersink.c.

◆ config_input_audio()

static int config_input_audio ( AVFilterLink * inlink)
static

Definition at line 214 of file buffersink.c.

◆ vsink_query_formats()

static int vsink_query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
static

Definition at line 295 of file buffersink.c.

◆ asink_query_formats()

static int asink_query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
static

Definition at line 326 of file buffersink.c.

◆ AVFILTER_DEFINE_CLASS() [1/2]

AVFILTER_DEFINE_CLASS ( buffersink )

◆ AVFILTER_DEFINE_CLASS() [2/2]

AVFILTER_DEFINE_CLASS ( abuffersink )

Variable Documentation

◆ buffersink_options

const AVOption buffersink_options[]
static
Initial value:
= {
{ "pixel_formats", "array of supported pixel formats", OFFSET(pixel_formats),
AV_OPT_TYPE_PIXEL_FMT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "colorspaces", "array of supported color spaces", OFFSET(colorspaces),
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "colorranges", "array of supported color ranges", OFFSET(colorranges),
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "alphamodes", "array of supported color ranges", OFFSET(alphamodes),
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ NULL },
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_PIXEL_FMT
Underlying C type is enum AVPixelFormat.
Definition opt.h:306
@ AV_OPT_TYPE_FLAG_ARRAY
May be combined with another regular option type to declare an array option.
Definition opt.h:345
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
static enum AVPixelFormat pixel_formats[]
Definition vf_sr.c:64

Definition at line 354 of file buffersink.c.

◆ abuffersink_options

const AVOption abuffersink_options[]
static
Initial value:
= {
{ "sample_formats", "array of supported sample formats", OFFSET(sample_formats),
AV_OPT_TYPE_SAMPLE_FMT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "samplerates", "array of supported sample formats", OFFSET(samplerates),
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "channel_layouts", "array of supported channel layouts", OFFSET(channel_layouts),
{ NULL },
}
static const uint16_t channel_layouts[7]
Definition dca_lbr.c:112
@ AV_OPT_TYPE_SAMPLE_FMT
Underlying C type is enum AVSampleFormat.
Definition opt.h:310
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition opt.h:330
static const struct @161106304217160064156176027033213377304043230355 sample_formats[]

Definition at line 368 of file buffersink.c.

◆ ff_vsink_buffer

const FFFilter ff_vsink_buffer
Initial value:
= {
.p.name = "buffersink",
.p.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
.p.priv_class = &buffersink_class,
.p.outputs = NULL,
.priv_size = sizeof(BufferSinkContext),
}
static int vsink_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition buffersink.c:295
static int init_video(AVFilterContext *ctx)
Definition buffersink.c:164
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 382 of file buffersink.c.

◆ inputs_audio

const AVFilterPad inputs_audio[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input_audio,
},
}
static int config_input_audio(AVFilterLink *inlink)
Definition buffersink.c:214
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201

Definition at line 395 of file buffersink.c.

◆ ff_asink_abuffer

const FFFilter ff_asink_abuffer
Initial value:
= {
.p.name = "abuffersink",
.p.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
.p.priv_class = &abuffersink_class,
.p.outputs = NULL,
.priv_size = sizeof(BufferSinkContext),
}
static const AVFilterPad inputs_audio[]
Definition buffersink.c:395
static int asink_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition buffersink.c:326
static int init_audio(AVFilterContext *ctx)
Definition buffersink.c:176

Definition at line 403 of file buffersink.c.