Go to the documentation of this file.
101 int buffersrc_empty = 0;
126 }
else if (
ret < 0) {
155 #define TERMINATE_ARRAY(arr, val) \
157 void *tmp = av_realloc_array(s->arr, s->nb_ ## arr + 1, sizeof(*s->arr)); \
159 return AVERROR(ENOMEM); \
161 s->arr[s->nb_ ## arr] = val; \
187 #undef TERMINATE_ARRAY
204 "%d buffers queued in %s, something may be wrong.\n",
229 if (
ctx->inputs &&
ctx->inputs[0]) {
235 #define MAKE_AVFILTERLINK_ACCESSOR(type, field) \
236 type av_buffersink_get_##field(const AVFilterContext *ctx) { \
237 av_assert0(fffilter(ctx->filter)->activate == activate); \
238 return ctx->inputs[0]->field; \
271 return ctx->inputs[0]->ch_layout.nb_channels;
291 *nb_side_data =
ctx->inputs[0]->nb_side_data;
352 #define OFFSET(x) offsetof(BufferSinkContext, x)
353 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
357 {
"colorspaces",
"array of supported color spaces",
OFFSET(colorspaces),
359 {
"colorranges",
"array of supported color ranges",
OFFSET(colorranges),
361 {
"alphamodes",
"array of supported color ranges",
OFFSET(alphamodes),
367 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
371 {
"samplerates",
"array of supported sample formats",
OFFSET(samplerates),
383 .
p.
name =
"buffersink",
384 .p.description =
NULL_IF_CONFIG_SMALL(
"Buffer video frames, and make them available to the end of the filter graph."),
385 .p.priv_class = &buffersink_class,
404 .
p.
name =
"abuffersink",
405 .p.description =
NULL_IF_CONFIG_SMALL(
"Buffer audio frames, and make them available to the end of the filter graph."),
406 .p.priv_class = &abuffersink_class,
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
#define AV_LOG_WARNING
Something somehow does not look correct.
int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out)
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.
AVPixelFormat
Pixel format.
static FilterLinkInternal * ff_link_internal(AVFilterLink *link)
static const AVOption abuffersink_options[]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
@ AV_OPT_TYPE_SAMPLE_FMT
Underlying C type is enum AVSampleFormat.
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.
static void uninit(AVFilterContext *ctx)
#define TERMINATE_ARRAY(arr, val)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
int max_samples
Maximum number of samples to filter at once.
const FFFilter ff_asink_abuffer
const char * name
Filter name.
AVBufferRef * av_buffersink_get_hw_frames_ctx(const AVFilterContext *ctx)
A link between two filters.
static const AVFilterPad inputs_audio[]
Link properties exposed to filter code, but not external callers.
enum AVSampleFormat * sample_formats
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
Set the frame size for an audio buffer sink.
static int init_video(AVFilterContext *ctx)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
#define FILTER_QUERY_FUNC2(func)
A filter pad used for either input or output.
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVRational av_buffersink_get_frame_rate(const AVFilterContext *ctx)
#define AV_BUFFERSINK_FLAG_PEEK
Tell av_buffersink_get_buffer_ref() to read video/samples buffer reference, but not remove it from th...
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
static int return_or_keep_frame(BufferSinkContext *buf, AVFrame *out, AVFrame *in, int flags)
static FilterLink * ff_filter_link(AVFilterLink *link)
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 const FFFilter * fffilter(const AVFilter *f)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVFILTER_DEFINE_CLASS(buffersink)
static AVFormatContext * ctx
static enum AVPixelFormat pixel_formats[]
const FFFilter ff_vsink_buffer
enum AVPixelFormat * pixel_formats
static int activate(AVFilterContext *ctx)
int(* activate)(AVFilterContext *ctx)
Filter activation function.
Describe the class of an AVClass context structure.
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Rational number (pair of numerator and denominator).
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
static const AVOption buffersink_options[]
#define attribute_align_arg
AVAlphaMode
Correlation between the alpha channel and color values.
unsigned nb_sample_formats
int(* init)(AVBSFContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
An AVChannelLayout holds information about the channel layout of audio data.
@ AV_OPT_TYPE_FLAG_ARRAY
May be combined with another regular option type to declare an array option.
unsigned nb_channel_layouts
static int config_input_audio(AVFilterLink *inlink)
static av_cold int common_init(AVFilterContext *ctx)
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
const AVFrameSideData *const * av_buffersink_get_side_data(const AVFilterContext *ctx, int *nb_side_data)
AVColorSpace
YUV colorspace type.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
AVSampleFormat
Audio sample formats.
int frame_wanted_out
True if a frame is currently wanted on the output of this filter.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
unsigned nb_pixel_formats
static int init_audio(AVFilterContext *ctx)
const char * name
Pad name.
#define AV_BUFFERSINK_FLAG_NO_REQUEST
Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define FILTER_INPUTS(array)
static size_t ff_framequeue_queued_frames(const FFFrameQueue *fq)
Get the number of queued frames.
static int asink_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
@ AV_OPT_TYPE_INT
Underlying C type is int.
int av_buffersink_get_channels(const AVFilterContext *ctx)
Filter the word “frame” indicates either a video frame or a group of audio samples
@ AV_OPT_TYPE_PIXEL_FMT
Underlying C type is enum AVPixelFormat.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, int samples)
AVFilter p
The public AVFilter.
A reference to a data buffer.
#define MAKE_AVFILTERLINK_ACCESSOR(type, field)
Structure to hold side data for an AVFrame.
static const uint16_t channel_layouts[7]
char * name
Name of this format context, only used for logging purposes.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
FFFrameQueue fifo
Queue of frames waiting to be filtered.
int min_samples
Minimum number of samples to filter at once.
static int vsink_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
AVColorRange
Visual content value range.
AVChannelLayout * channel_layouts
#define FFERROR_BUFFERSRC_EMPTY
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.