Go to the documentation of this file.
33 #define FF_INTERNAL_FIELDS 1
55 #if FF_API_OLD_CHANNEL_LAYOUT
57 int channel_layouts_size;
59 int channel_counts_size;
69 #define NB_ITEMS(list) (list ## _size / sizeof(*list))
71 #if FF_API_OLD_CHANNEL_LAYOUT
75 int nb_layouts =
NB_ITEMS(buf->channel_layouts);
76 int nb_counts =
NB_ITEMS(buf->channel_counts);
80 for (
i = 0;
i < nb_counts;
i++)
81 if (buf->channel_counts[
i] < 64)
82 counts |= (uint64_t)1 << buf->channel_counts[
i];
83 for (
i = lc = 0;
i < nb_layouts;
i++) {
85 if (n < 64 && (counts & ((uint64_t)1 << n)))
87 "Removing channel layout 0x%"PRIx64
", redundant with %d channels\n",
88 buf->channel_layouts[
i], n);
90 buf->channel_layouts[lc++] = buf->channel_layouts[
i];
92 buf->channel_layouts_size = lc *
sizeof(*buf->channel_layouts);
138 }
else if (
inlink->frame_wanted_out) {
174 "%d buffers queued in %s, something may be wrong.\n",
191 #define MAKE_AVFILTERLINK_ACCESSOR(type, field) \
192 type av_buffersink_get_##field(const AVFilterContext *ctx) { \
193 av_assert0(ctx->filter->activate == activate); \
194 return ctx->inputs[0]->field; \
206 #if FF_API_OLD_CHANNEL_LAYOUT
218 return ctx->inputs[0]->ch_layout.nb_channels;
234 #define CHECK_LIST_SIZE(field) \
235 if (buf->field ## _size % sizeof(*buf->field)) { \
236 av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \
237 "should be multiple of %d\n", \
238 buf->field ## _size, (int)sizeof(*buf->field)); \
239 return AVERROR(EINVAL); \
274 #if FF_API_OLD_CHANNEL_LAYOUT
289 buf->channel_layouts_size || buf->channel_counts_size ||
292 #if FF_API_OLD_CHANNEL_LAYOUT
293 cleanup_redundant_layouts(
ctx);
294 for (
i = 0;
i <
NB_ITEMS(buf->channel_layouts);
i++)
298 for (
i = 0;
i <
NB_ITEMS(buf->channel_counts);
i++) {
307 #if FF_API_OLD_CHANNEL_LAYOUT
310 "Conflicting ch_layouts and list of channel_counts/channel_layouts. Ignoring the former\n");
314 char *next = strchr(cur,
'|');
335 "Conflicting all_channel_counts and list in options\n");
355 #define OFFSET(x) offsetof(BufferSinkContext, x)
356 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
362 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
366 #if FF_API_OLD_CHANNEL_LAYOUT
367 {
"channel_layouts",
"set the supported channel layouts (deprecated, use ch_layouts)",
369 {
"channel_counts",
"set the supported channel counts (deprecated, use ch_layouts)",
372 {
"ch_layouts",
"set a '|'-separated list of supported channel layouts",
383 .
name =
"buffersink",
384 .description =
NULL_IF_CONFIG_SMALL(
"Buffer video frames, and make them available to the end of the filter graph."),
386 .priv_class = &buffersink_class,
395 .
name =
"abuffersink",
396 .description =
NULL_IF_CONFIG_SMALL(
"Buffer audio frames, and make them available to the end of the filter graph."),
397 .priv_class = &abuffersink_class,
#define FF_ENABLE_DEPRECATION_WARNINGS
A list of supported channel layouts.
#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 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
enum AVSampleFormat * sample_fmts
list of accepted sample formats
static enum AVSampleFormat sample_fmts[]
enum MovChannelLayoutTag * layouts
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.
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.
#define FILTER_QUERY_FUNC(func)
static enum AVPixelFormat pixel_fmts[]
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
const char * name
Filter name.
A link between two filters.
#define CHECK_LIST_SIZE(field)
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
const AVFilter ff_asink_abuffer
void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
Set the frame size for an audio buffer sink.
@ AV_OPT_TYPE_BINARY
offset must point to a pointer immediately followed by an int for the length
char * channel_layouts_str
list of accepted channel layouts
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
enum AVPixelFormat * pixel_fmts
list of accepted pixel formats
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
#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.
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
static int return_or_keep_frame(BufferSinkContext *buf, AVFrame *out, AVFrame *in, int flags)
FF_ENABLE_DEPRECATION_WARNINGS int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
int(* init)(AVBSFContext *ctx)
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.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVFILTER_DEFINE_CLASS(buffersink)
#define FILTER_INPUTS(array)
static int activate(AVFilterContext *ctx)
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.
Rational number (pair of numerator and denominator).
static int vsink_query_formats(AVFilterContext *ctx)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
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
#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.
#define FF_API_OLD_CHANNEL_LAYOUT
static av_cold int common_init(AVFilterContext *ctx)
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 layout
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
#define i(width, name, range_min, range_max)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
AVSampleFormat
Audio sample formats.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
const AVFilter ff_vsink_buffer
#define AV_BUFFERSINK_FLAG_NO_REQUEST
Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
static size_t ff_framequeue_queued_frames(const FFFrameQueue *fq)
Get the number of queued frames.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_buffersink_get_channels(const AVFilterContext *ctx)
Filter the word “frame” indicates either a video frame or a group of audio samples
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
#define FF_DISABLE_DEPRECATION_WARNINGS
static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, int samples)
A reference to a data buffer.
#define MAKE_AVFILTERLINK_ACCESSOR(type, field)
static int asink_query_formats(AVFilterContext *ctx)
static const uint16_t channel_layouts[7]
#define flags(name, subs,...)
int * sample_rates
list of accepted sample rates
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
#define AV_OPT_FLAG_DEPRECATED
set if option is deprecated, users should refer to AVOption.help text for more information