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 #if FF_API_OLD_CHANNEL_LAYOUT
59  int64_t *channel_layouts; ///< list of accepted channel layouts
60  int channel_layouts_size;
61  int *channel_counts; ///< list of accepted channel counts
62  int channel_counts_size;
63 #endif
64  char *channel_layouts_str; ///< list of accepted channel layouts
66  int *sample_rates; ///< list of accepted sample rates
68 
71 
72 #define NB_ITEMS(list) (list ## _size / sizeof(*list))
73 
74 #if FF_API_OLD_CHANNEL_LAYOUT
75 static void cleanup_redundant_layouts(AVFilterContext *ctx)
76 {
77  BufferSinkContext *buf = ctx->priv;
78  int nb_layouts = NB_ITEMS(buf->channel_layouts);
79  int nb_counts = NB_ITEMS(buf->channel_counts);
80  uint64_t counts = 0;
81  int i, lc, n;
82 
83  for (i = 0; i < nb_counts; i++)
84  if (buf->channel_counts[i] < 64)
85  counts |= (uint64_t)1 << buf->channel_counts[i];
86  for (i = lc = 0; i < nb_layouts; i++) {
87  n = av_popcount64(buf->channel_layouts[i]);
88  if (n < 64 && (counts & ((uint64_t)1 << n)))
90  "Removing channel layout 0x%"PRIx64", redundant with %d channels\n",
91  buf->channel_layouts[i], n);
92  else
93  buf->channel_layouts[lc++] = buf->channel_layouts[i];
94  }
95  buf->channel_layouts_size = lc * sizeof(*buf->channel_layouts);
96 }
97 #endif
98 
100 {
102 }
103 
105 {
106  if ((flags & AV_BUFFERSINK_FLAG_PEEK)) {
107  buf->peeked_frame = in;
108  return out ? av_frame_ref(out, in) : 0;
109  } else {
110  av_assert1(out);
111  buf->peeked_frame = NULL;
112  av_frame_move_ref(out, in);
113  av_frame_free(&in);
114  return 0;
115  }
116 }
117 
119 {
120  BufferSinkContext *buf = ctx->priv;
121  AVFilterLink *inlink = ctx->inputs[0];
122  int status, ret;
123  AVFrame *cur_frame;
124  int64_t pts;
125 
126  if (buf->peeked_frame)
127  return return_or_keep_frame(buf, frame, buf->peeked_frame, flags);
128 
129  while (1) {
131  ff_inlink_consume_frame(inlink, &cur_frame);
132  if (ret < 0) {
133  return ret;
134  } else if (ret) {
135  /* TODO return the frame instead of copying it */
136  return return_or_keep_frame(buf, frame, cur_frame, flags);
137  } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
138  return status;
139  } else if ((flags & AV_BUFFERSINK_FLAG_NO_REQUEST)) {
140  return AVERROR(EAGAIN);
141  } else if (inlink->frame_wanted_out) {
142  ret = ff_filter_graph_run_once(ctx->graph);
143  if (ret < 0)
144  return ret;
145  } else {
147  }
148  }
149 }
150 
152 {
153  return get_frame_internal(ctx, frame, flags, ctx->inputs[0]->min_samples);
154 }
155 
157  AVFrame *frame, int nb_samples)
158 {
159  return get_frame_internal(ctx, frame, 0, nb_samples);
160 }
161 
163 {
164  BufferSinkContext *buf = ctx->priv;
165 
166  buf->warning_limit = 100;
167  return 0;
168 }
169 
171 {
172  BufferSinkContext *buf = ctx->priv;
173 
175 }
176 
178 {
179  BufferSinkContext *buf = ctx->priv;
180  FilterLinkInternal * const li = ff_link_internal(ctx->inputs[0]);
181 
182  if (buf->warning_limit &&
185  "%d buffers queued in %s, something may be wrong.\n",
186  buf->warning_limit,
187  (char *)av_x_if_null(ctx->name, ctx->filter->name));
188  buf->warning_limit *= 10;
189  }
190 
191  /* The frame is queued, the rest is up to get_frame_internal */
192  return 0;
193 }
194 
196 {
197  AVFilterLink *inlink = ctx->inputs[0];
198 
199  inlink->min_samples = inlink->max_samples = frame_size;
200 }
201 
202 #define MAKE_AVFILTERLINK_ACCESSOR(type, field) \
203 type av_buffersink_get_##field(const AVFilterContext *ctx) { \
204  av_assert0(ctx->filter->activate == activate); \
205  return ctx->inputs[0]->field; \
206 }
207 
211 
215 MAKE_AVFILTERLINK_ACCESSOR(AVRational , sample_aspect_ratio)
218 
219 #if FF_API_OLD_CHANNEL_LAYOUT
221 MAKE_AVFILTERLINK_ACCESSOR(uint64_t , channel_layout )
223 #endif
225 
226 MAKE_AVFILTERLINK_ACCESSOR(AVBufferRef * , hw_frames_ctx )
227 
229 {
230  av_assert0(ctx->filter->activate == activate);
231  return ctx->inputs[0]->ch_layout.nb_channels;
232 }
233 
235 {
236  AVChannelLayout ch_layout = { 0 };
237  int ret;
238 
239  av_assert0(ctx->filter->activate == activate);
240  ret = av_channel_layout_copy(&ch_layout, &ctx->inputs[0]->ch_layout);
241  if (ret < 0)
242  return ret;
243  *out = ch_layout;
244  return 0;
245 }
246 
247 #define CHECK_LIST_SIZE(field) \
248  if (buf->field ## _size % sizeof(*buf->field)) { \
249  av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \
250  "should be multiple of %d\n", \
251  buf->field ## _size, (int)sizeof(*buf->field)); \
252  return AVERROR(EINVAL); \
253  }
255 {
256  BufferSinkContext *buf = ctx->priv;
257  unsigned i;
258  int ret;
259 
261  CHECK_LIST_SIZE(color_spaces)
262  CHECK_LIST_SIZE(color_ranges)
263  if (buf->pixel_fmts_size) {
265  for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)
266  if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0)
267  return ret;
268  if ((ret = ff_set_common_formats(ctx, formats)) < 0)
269  return ret;
270  }
271 
272  if (buf->color_spaces_size) {
274  for (i = 0; i < NB_ITEMS(buf->color_spaces); i++)
275  if ((ret = ff_add_format(&formats, buf->color_spaces[i])) < 0)
276  return ret;
278  return ret;
279  }
280 
281  if (buf->color_ranges_size) {
283  for (i = 0; i < NB_ITEMS(buf->color_ranges); i++)
284  if ((ret = ff_add_format(&formats, buf->color_ranges[i])) < 0)
285  return ret;
287  return ret;
288  }
289 
290  return 0;
291 }
292 
294 {
295  BufferSinkContext *buf = ctx->priv;
297  AVChannelLayout layout = { 0 };
299  unsigned i;
300  int ret;
301 
304 #if FF_API_OLD_CHANNEL_LAYOUT
306  CHECK_LIST_SIZE(channel_counts)
307 #endif
308 
309  if (buf->sample_fmts_size) {
310  for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++)
311  if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0)
312  return ret;
313  if ((ret = ff_set_common_formats(ctx, formats)) < 0)
314  return ret;
315  }
316 
317  if (
319  buf->channel_layouts_size || buf->channel_counts_size ||
320 #endif
322 #if FF_API_OLD_CHANNEL_LAYOUT
323  cleanup_redundant_layouts(ctx);
324  for (i = 0; i < NB_ITEMS(buf->channel_layouts); i++)
325  if ((ret = av_channel_layout_from_mask(&layout, buf->channel_layouts[i])) < 0 ||
327  return ret;
328  for (i = 0; i < NB_ITEMS(buf->channel_counts); i++) {
329  layout = FF_COUNT2LAYOUT(buf->channel_counts[i]);
330  if ((ret = ff_add_channel_layout(&layouts, &layout)) < 0)
331  return ret;
332  }
333 #endif
334  if (buf->channel_layouts_str) {
335  const char *cur = buf->channel_layouts_str;
336 
337 #if FF_API_OLD_CHANNEL_LAYOUT
338  if (layouts)
340  "Conflicting ch_layouts and list of channel_counts/channel_layouts. Ignoring the former\n");
341  else
342 #endif
343  while (cur) {
344  char *next = strchr(cur, '|');
345  if (next)
346  *next++ = 0;
347 
349  if (ret < 0) {
350  av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: %s.\n", cur);
351  return ret;
352  }
355  if (ret < 0)
356  return ret;
357 
358  cur = next;
359  }
360  }
361 
362  if (buf->all_channel_counts) {
363  if (layouts)
365  "Conflicting all_channel_counts and list in options\n");
366  else if (!(layouts = ff_all_channel_counts()))
367  return AVERROR(ENOMEM);
368  }
370  return ret;
371  }
372 
373  if (buf->sample_rates_size) {
374  formats = NULL;
375  for (i = 0; i < NB_ITEMS(buf->sample_rates); i++)
376  if ((ret = ff_add_format(&formats, buf->sample_rates[i])) < 0)
377  return ret;
379  return ret;
380  }
381 
382  return 0;
383 }
384 
385 #define OFFSET(x) offsetof(BufferSinkContext, x)
386 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
387 static const AVOption buffersink_options[] = {
388  { "pix_fmts", "set the supported pixel formats", OFFSET(pixel_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
389  { "color_spaces", "set the supported color spaces", OFFSET(color_spaces), AV_OPT_TYPE_BINARY, .flags = FLAGS },
390  { "color_ranges", "set the supported color ranges", OFFSET(color_ranges), AV_OPT_TYPE_BINARY, .flags = FLAGS },
391  { NULL },
392 };
393 #undef FLAGS
394 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
395 static const AVOption abuffersink_options[] = {
396  { "sample_fmts", "set the supported sample formats", OFFSET(sample_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
397  { "sample_rates", "set the supported sample rates", OFFSET(sample_rates), AV_OPT_TYPE_BINARY, .flags = FLAGS },
398 #if FF_API_OLD_CHANNEL_LAYOUT
399  { "channel_layouts", "set the supported channel layouts (deprecated, use ch_layouts)",
401  { "channel_counts", "set the supported channel counts (deprecated, use ch_layouts)",
402  OFFSET(channel_counts), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
403 #endif
404  { "ch_layouts", "set a '|'-separated list of supported channel layouts",
405  OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = FLAGS },
406  { "all_channel_counts", "accept all channel counts", OFFSET(all_channel_counts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
407  { NULL },
408 };
409 #undef FLAGS
410 
411 AVFILTER_DEFINE_CLASS(buffersink);
412 AVFILTER_DEFINE_CLASS(abuffersink);
413 
415  .name = "buffersink",
416  .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
417  .priv_size = sizeof(BufferSinkContext),
418  .priv_class = &buffersink_class,
419  .init = common_init,
420  .uninit = uninit,
421  .activate = activate,
423  .outputs = NULL,
425 };
426 
428  .name = "abuffersink",
429  .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
430  .priv_class = &abuffersink_class,
431  .priv_size = sizeof(BufferSinkContext),
432  .init = common_init,
433  .uninit = uninit,
434  .activate = activate,
436  .outputs = NULL,
438 };
formats
formats
Definition: signature.h:48
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
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:234
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:156
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:395
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:54
av_popcount64
#define av_popcount64
Definition: common.h:155
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:947
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:326
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:151
uninit
static void uninit(AVFilterContext *ctx)
Definition: buffersink.c:170
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:100
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:621
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
w
uint8_t w
Definition: llviddspenc.c:38
AVOption
AVOption.
Definition: opt.h:251
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
pixel_fmts
static enum AVPixelFormat pixel_fmts[]
Definition: vf_amplify.c:51
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:1502
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:247
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:1438
ff_asink_abuffer
const AVFilter ff_asink_abuffer
Definition: buffersink.c:427
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:195
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:231
BufferSinkContext::channel_layouts_str
char * channel_layouts_str
list of accepted channel layouts
Definition: buffersink.c:64
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:643
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:867
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:1564
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:104
frame_size
int frame_size
Definition: mxfenc.c:2422
av_channel_layout_from_mask
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.
Definition: channel_layout.c:421
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:99
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:48
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:394
frame
static AVFrame * frame
Definition: demux_decode.c:54
activate
static int activate(AVFilterContext *ctx)
Definition: buffersink.c:177
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:1458
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:254
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:504
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:521
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:1386
buffersink_options
static const AVOption buffersink_options[]
Definition: buffersink.c:387
BufferSinkContext::sample_rates_size
int sample_rates_size
Definition: buffersink.c:67
attribute_align_arg
#define attribute_align_arg
Definition: internal.h:50
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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:106
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:361
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:313
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
FF_API_OLD_CHANNEL_LAYOUT
#define FF_API_OLD_CHANNEL_LAYOUT
Definition: version.h:111
BufferSinkContext::color_ranges_size
int color_ranges_size
Definition: buffersink.c:53
NB_ITEMS
#define NB_ITEMS(list)
Definition: buffersink.c:72
common_init
static av_cold int common_init(AVFilterContext *ctx)
Definition: buffersink.c:162
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:844
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:434
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
internal.h
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:613
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:649
BufferSinkContext
Definition: buffersink.c:43
ff_vsink_buffer
const AVFilter ff_vsink_buffer
Definition: buffersink.c:414
AVFilter
Filter definition.
Definition: avfilter.h:166
OFFSET
#define OFFSET(x)
Definition: buffersink.c:385
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
ff_set_common_color_spaces
int ff_set_common_color_spaces(AVFilterContext *ctx, AVFilterFormats *color_spaces)
Definition: formats.c:826
FF_COUNT2LAYOUT
#define FF_COUNT2LAYOUT(c)
Encode a channel count as a channel layout.
Definition: formats.h:102
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:120
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:662
av_buffersink_get_channels
int av_buffersink_get_channels(const AVFilterContext *ctx)
Definition: buffersink.c:228
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:409
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:669
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
get_frame_internal
static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, int samples)
Definition: buffersink.c:118
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:202
asink_query_formats
static int asink_query_formats(AVFilterContext *ctx)
Definition: buffersink.c:293
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
channel_layouts
static const uint16_t channel_layouts[7]
Definition: dca_lbr.c:111
BufferSinkContext::all_channel_counts
int all_channel_counts
Definition: buffersink.c:65
BufferSinkContext::peeked_frame
AVFrame * peeked_frame
Definition: buffersink.c:69
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:808
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:229
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:652
int
int
Definition: ffmpeg_filter.c:424
BufferSinkContext::sample_rates
int * sample_rates
list of accepted sample rates
Definition: buffersink.c:66
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:790
BufferSinkContext::pixel_fmts_size
int pixel_fmts_size
Definition: buffersink.c:49
AV_OPT_FLAG_DEPRECATED
#define AV_OPT_FLAG_DEPRECATED
set if option is deprecated, users should refer to AVOption.help text for more information
Definition: opt.h:298