FFmpeg
buffersink.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Stefano Sabatini
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * buffer sink
24  */
25 
26 #include "libavutil/avassert.h"
27 #include "libavutil/avstring.h"
29 #include "libavutil/common.h"
30 #include "libavutil/internal.h"
31 #include "libavutil/opt.h"
32 
33 #include "audio.h"
34 #include "avfilter.h"
35 #include "avfilter_internal.h"
36 #include "buffersink.h"
37 #include "filters.h"
38 #include "formats.h"
39 #include "framequeue.h"
40 #include "internal.h"
41 #include "video.h"
42 
43 typedef struct BufferSinkContext {
44  const AVClass *class;
45  unsigned warning_limit;
46 
47  /* only used for video */
48  enum AVPixelFormat *pixel_fmts; ///< list of accepted pixel formats
50  enum AVColorSpace *color_spaces; ///< list of accepted color spaces
52  enum AVColorRange *color_ranges; ///< list of accepted color ranges
54 
55  /* only used for audio */
56  enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats
58  char *channel_layouts_str; ///< list of accepted channel layouts
60  int *sample_rates; ///< list of accepted sample rates
62 
65 
66 #define NB_ITEMS(list) (list ## _size / sizeof(*list))
67 
69 {
71 }
72 
74 {
76  buf->peeked_frame = in;
77  return out ? av_frame_ref(out, in) : 0;
78  } else {
79  av_assert1(out);
80  buf->peeked_frame = NULL;
82  av_frame_free(&in);
83  return 0;
84  }
85 }
86 
88 {
89  BufferSinkContext *buf = ctx->priv;
90  AVFilterLink *inlink = ctx->inputs[0];
91  int status, ret;
92  AVFrame *cur_frame;
93  int64_t pts;
94 
95  if (buf->peeked_frame)
96  return return_or_keep_frame(buf, frame, buf->peeked_frame, flags);
97 
98  while (1) {
100  ff_inlink_consume_frame(inlink, &cur_frame);
101  if (ret < 0) {
102  return ret;
103  } else if (ret) {
104  /* TODO return the frame instead of copying it */
105  return return_or_keep_frame(buf, frame, cur_frame, flags);
106  } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
107  return status;
108  } else if ((flags & AV_BUFFERSINK_FLAG_NO_REQUEST)) {
109  return AVERROR(EAGAIN);
110  } else if (inlink->frame_wanted_out) {
111  ret = ff_filter_graph_run_once(ctx->graph);
112  if (ret < 0)
113  return ret;
114  } else {
116  }
117  }
118 }
119 
121 {
122  return get_frame_internal(ctx, frame, flags, ctx->inputs[0]->min_samples);
123 }
124 
126  AVFrame *frame, int nb_samples)
127 {
128  return get_frame_internal(ctx, frame, 0, nb_samples);
129 }
130 
132 {
133  BufferSinkContext *buf = ctx->priv;
134 
135  buf->warning_limit = 100;
136  return 0;
137 }
138 
140 {
141  BufferSinkContext *buf = ctx->priv;
142 
144 }
145 
147 {
148  BufferSinkContext *buf = ctx->priv;
149  FilterLinkInternal * const li = ff_link_internal(ctx->inputs[0]);
150 
151  if (buf->warning_limit &&
154  "%d buffers queued in %s, something may be wrong.\n",
155  buf->warning_limit,
156  (char *)av_x_if_null(ctx->name, ctx->filter->name));
157  buf->warning_limit *= 10;
158  }
159 
160  /* The frame is queued, the rest is up to get_frame_internal */
161  return 0;
162 }
163 
165 {
166  AVFilterLink *inlink = ctx->inputs[0];
167 
168  inlink->min_samples = inlink->max_samples = frame_size;
169 }
170 
171 #define MAKE_AVFILTERLINK_ACCESSOR(type, field) \
172 type av_buffersink_get_##field(const AVFilterContext *ctx) { \
173  av_assert0(ctx->filter->activate == activate); \
174  return ctx->inputs[0]->field; \
175 }
176 
180 
184 MAKE_AVFILTERLINK_ACCESSOR(AVRational , sample_aspect_ratio)
187 
189 
190 MAKE_AVFILTERLINK_ACCESSOR(AVBufferRef * , hw_frames_ctx )
191 
193 {
194  av_assert0(ctx->filter->activate == activate);
195  return ctx->inputs[0]->ch_layout.nb_channels;
196 }
197 
199 {
200  AVChannelLayout ch_layout = { 0 };
201  int ret;
202 
203  av_assert0(ctx->filter->activate == activate);
204  ret = av_channel_layout_copy(&ch_layout, &ctx->inputs[0]->ch_layout);
205  if (ret < 0)
206  return ret;
207  *out = ch_layout;
208  return 0;
209 }
210 
211 #define CHECK_LIST_SIZE(field) \
212  if (buf->field ## _size % sizeof(*buf->field)) { \
213  av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \
214  "should be multiple of %d\n", \
215  buf->field ## _size, (int)sizeof(*buf->field)); \
216  return AVERROR(EINVAL); \
217  }
219 {
220  BufferSinkContext *buf = ctx->priv;
221  unsigned i;
222  int ret;
223 
225  CHECK_LIST_SIZE(color_spaces)
226  CHECK_LIST_SIZE(color_ranges)
227  if (buf->pixel_fmts_size) {
229  for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)
230  if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0)
231  return ret;
232  if ((ret = ff_set_common_formats(ctx, formats)) < 0)
233  return ret;
234  }
235 
236  if (buf->color_spaces_size) {
238  for (i = 0; i < NB_ITEMS(buf->color_spaces); i++)
239  if ((ret = ff_add_format(&formats, buf->color_spaces[i])) < 0)
240  return ret;
242  return ret;
243  }
244 
245  if (buf->color_ranges_size) {
247  for (i = 0; i < NB_ITEMS(buf->color_ranges); i++)
248  if ((ret = ff_add_format(&formats, buf->color_ranges[i])) < 0)
249  return ret;
251  return ret;
252  }
253 
254  return 0;
255 }
256 
258 {
259  BufferSinkContext *buf = ctx->priv;
261  AVChannelLayout layout = { 0 };
263  unsigned i;
264  int ret;
265 
268 
269  if (buf->sample_fmts_size) {
270  for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++)
271  if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0)
272  return ret;
273  if ((ret = ff_set_common_formats(ctx, formats)) < 0)
274  return ret;
275  }
276 
277  if (buf->channel_layouts_str || buf->all_channel_counts) {
278  if (buf->channel_layouts_str) {
279  const char *cur = buf->channel_layouts_str;
280 
281  while (cur) {
282  char *next = strchr(cur, '|');
283  if (next)
284  *next++ = 0;
285 
287  if (ret < 0) {
288  av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: %s.\n", cur);
289  return ret;
290  }
293  if (ret < 0)
294  return ret;
295 
296  cur = next;
297  }
298  }
299 
300  if (buf->all_channel_counts) {
301  if (layouts)
303  "Conflicting all_channel_counts and list in options\n");
304  else if (!(layouts = ff_all_channel_counts()))
305  return AVERROR(ENOMEM);
306  }
308  return ret;
309  }
310 
311  if (buf->sample_rates_size) {
312  formats = NULL;
313  for (i = 0; i < NB_ITEMS(buf->sample_rates); i++)
314  if ((ret = ff_add_format(&formats, buf->sample_rates[i])) < 0)
315  return ret;
317  return ret;
318  }
319 
320  return 0;
321 }
322 
323 #define OFFSET(x) offsetof(BufferSinkContext, x)
324 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
325 static const AVOption buffersink_options[] = {
326  { "pix_fmts", "set the supported pixel formats", OFFSET(pixel_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
327  { "color_spaces", "set the supported color spaces", OFFSET(color_spaces), AV_OPT_TYPE_BINARY, .flags = FLAGS },
328  { "color_ranges", "set the supported color ranges", OFFSET(color_ranges), AV_OPT_TYPE_BINARY, .flags = FLAGS },
329  { NULL },
330 };
331 #undef FLAGS
332 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
333 static const AVOption abuffersink_options[] = {
334  { "sample_fmts", "set the supported sample formats", OFFSET(sample_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
335  { "sample_rates", "set the supported sample rates", OFFSET(sample_rates), AV_OPT_TYPE_BINARY, .flags = FLAGS },
336  { "ch_layouts", "set a '|'-separated list of supported channel layouts",
337  OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = FLAGS },
338  { "all_channel_counts", "accept all channel counts", OFFSET(all_channel_counts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
339  { NULL },
340 };
341 #undef FLAGS
342 
343 AVFILTER_DEFINE_CLASS(buffersink);
344 AVFILTER_DEFINE_CLASS(abuffersink);
345 
347  .name = "buffersink",
348  .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
349  .priv_size = sizeof(BufferSinkContext),
350  .priv_class = &buffersink_class,
351  .init = common_init,
352  .uninit = uninit,
353  .activate = activate,
355  .outputs = NULL,
357 };
358 
360  .name = "abuffersink",
361  .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
362  .priv_class = &abuffersink_class,
363  .priv_size = sizeof(BufferSinkContext),
364  .init = common_init,
365  .uninit = uninit,
366  .activate = activate,
368  .outputs = NULL,
370 };
formats
formats
Definition: signature.h:48
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
av_buffersink_get_ch_layout
int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out)
Definition: buffersink.c:198
av_buffersink_get_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.
Definition: buffersink.c:125
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
ff_link_internal
static FilterLinkInternal * ff_link_internal(AVFilterLink *link)
Definition: avfilter_internal.h:82
abuffersink_options
static const AVOption abuffersink_options[]
Definition: buffersink.c:333
AVERROR
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
BufferSinkContext::color_spaces_size
int color_spaces_size
Definition: buffersink.c:51
opt.h
BufferSinkContext::sample_fmts
enum AVSampleFormat * sample_fmts
list of accepted sample formats
Definition: buffersink.c:56
out
FILE * out
Definition: movenc.c:55
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:337
av_buffersink_get_frame_flags
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.
Definition: buffersink.c:120
uninit
static void uninit(AVFilterContext *ctx)
Definition: buffersink.c:139
inlink
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
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
ff_all_channel_counts
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition: formats.c:622
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
w
uint8_t w
Definition: llviddspenc.c:38
AVOption
AVOption.
Definition: opt.h:357
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
pixel_fmts
static enum AVPixelFormat pixel_fmts[]
Definition: vf_amplify.c:52
ff_filter_graph_run_once
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
Definition: avfiltergraph.c:1420
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
BufferSinkContext::sample_fmts_size
int sample_fmts_size
Definition: buffersink.c:57
video.h
sample_rate
sample_rate
Definition: ffmpeg_filter.c:424
CHECK_LIST_SIZE
#define CHECK_LIST_SIZE(field)
Definition: buffersink.c:211
FilterLinkInternal
Definition: avfilter_internal.h:33
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
formats.h
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1442
ff_asink_abuffer
const AVFilter ff_asink_abuffer
Definition: buffersink.c:359
av_buffersink_set_frame_size
void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
Set the frame size for an audio buffer sink.
Definition: buffersink.c:164
AV_OPT_TYPE_BINARY
@ AV_OPT_TYPE_BINARY
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:251
BufferSinkContext::channel_layouts_str
char * channel_layouts_str
list of accepted channel layouts
Definition: buffersink.c:58
type
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
Definition: writing_filters.txt:86
pts
static int64_t pts
Definition: transcode_aac.c:644
BufferSinkContext::pixel_fmts
enum AVPixelFormat * pixel_fmts
list of accepted pixel formats
Definition: buffersink.c:48
avassert.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
ff_set_common_formats
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:868
ff_video_default_filterpad
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
AV_BUFFERSINK_FLAG_PEEK
#define AV_BUFFERSINK_FLAG_PEEK
Tell av_buffersink_get_buffer_ref() to read video/samples buffer reference, but not remove it from th...
Definition: buffersink.h:90
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1568
format
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
return_or_keep_frame
static int return_or_keep_frame(BufferSinkContext *buf, AVFrame *out, AVFrame *in, int flags)
Definition: buffersink.c:73
frame_size
int frame_size
Definition: mxfenc.c:2423
av_buffersink_get_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.
Definition: buffersink.c:68
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(buffersink)
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:49
color_range
color_range
Definition: vf_selectivecolor.c:43
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
FLAGS
#define FLAGS
Definition: buffersink.c:332
activate
static int activate(AVFilterContext *ctx)
Definition: buffersink.c:146
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ff_inlink_consume_samples
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.
Definition: avfilter.c:1462
NULL
#define NULL
Definition: coverity.c:32
framequeue.h
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
BufferSinkContext::color_spaces
enum AVColorSpace * color_spaces
list of accepted color spaces
Definition: buffersink.c:50
vsink_query_formats
static int vsink_query_formats(AVFilterContext *ctx)
Definition: buffersink.c:218
ff_add_format
int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition: formats.c:505
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:33
avfilter_internal.h
ff_add_channel_layout
int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition: formats.c:522
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1389
buffersink_options
static const AVOption buffersink_options[]
Definition: buffersink.c:325
BufferSinkContext::sample_rates_size
int sample_rates_size
Definition: buffersink.c:61
attribute_align_arg
#define attribute_align_arg
Definition: internal.h:50
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
AVMediaType
AVMediaType
Definition: avutil.h:199
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
av_frame_ref
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:384
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:303
BufferSinkContext::color_ranges_size
int color_ranges_size
Definition: buffersink.c:53
NB_ITEMS
#define NB_ITEMS(list)
Definition: buffersink.c:66
common_init
static av_cold int common_init(AVFilterContext *ctx)
Definition: buffersink.c:131
sample_rates
sample_rates
Definition: ffmpeg_filter.c:424
internal.h
buffersink.h
layout
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
Definition: filter_design.txt:18
ff_set_common_color_ranges
int ff_set_common_color_ranges(AVFilterContext *ctx, AVFilterFormats *color_ranges)
Definition: formats.c:845
av_channel_layout_from_string
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
Definition: channel_layout.c:303
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
internal.h
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:609
common.h
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
av_frame_move_ref
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition: frame.c:633
BufferSinkContext
Definition: buffersink.c:43
ff_vsink_buffer
const AVFilter ff_vsink_buffer
Definition: buffersink.c:346
AVFilter
Filter definition.
Definition: avfilter.h:166
OFFSET
#define OFFSET(x)
Definition: buffersink.c:323
AV_BUFFERSINK_FLAG_NO_REQUEST
#define AV_BUFFERSINK_FLAG_NO_REQUEST
Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
Definition: buffersink.h:97
ret
ret
Definition: filter_design.txt:187
BufferSinkContext::warning_limit
unsigned warning_limit
Definition: buffersink.c:45
frame
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
Definition: filter_design.txt:264
ff_set_common_color_spaces
int ff_set_common_color_spaces(AVFilterContext *ctx, AVFilterFormats *color_spaces)
Definition: formats.c:827
ff_framequeue_queued_frames
static size_t ff_framequeue_queued_frames(const FFFrameQueue *fq)
Get the number of queued frames.
Definition: framequeue.h:146
status
ov_status_e status
Definition: dnn_backend_openvino.c:101
channel_layout.h
avfilter.h
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:433
av_buffersink_get_channels
int av_buffersink_get_channels(const AVFilterContext *ctx)
Definition: buffersink.c:192
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
av_channel_layout_copy
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
Definition: channel_layout.c:440
get_frame_internal
static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, int samples)
Definition: buffersink.c:87
audio.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
BufferSinkContext::color_ranges
enum AVColorRange * color_ranges
list of accepted color ranges
Definition: buffersink.c:52
MAKE_AVFILTERLINK_ACCESSOR
#define MAKE_AVFILTERLINK_ACCESSOR(type, field)
Definition: buffersink.c:171
asink_query_formats
static int asink_query_formats(AVFilterContext *ctx)
Definition: buffersink.c:257
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:261
BufferSinkContext::all_channel_counts
int all_channel_counts
Definition: buffersink.c:59
BufferSinkContext::peeked_frame
AVFrame * peeked_frame
Definition: buffersink.c:63
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ff_set_common_samplerates
int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:809
h
h
Definition: vp9dsp_template.c:2038
FilterLinkInternal::fifo
FFFrameQueue fifo
Queue of frames waiting to be filtered.
Definition: avfilter_internal.h:41
avstring.h
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:249
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:651
int
int
Definition: ffmpeg_filter.c:424
BufferSinkContext::sample_rates
int * sample_rates
list of accepted sample rates
Definition: buffersink.c:60
av_x_if_null
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
Definition: avutil.h:312
ff_set_common_channel_layouts
int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *channel_layouts)
Helpers for query_formats() which set all free audio links to the same list of channel layouts/sample...
Definition: formats.c:791
BufferSinkContext::pixel_fmts_size
int pixel_fmts_size
Definition: buffersink.c:49