FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
buffersrc.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 Vitor Sessak
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  * memory buffer source filter
24  */
25 
26 #include <float.h>
27 
29 #include "libavutil/common.h"
30 #include "libavutil/fifo.h"
31 #include "libavutil/frame.h"
32 #include "libavutil/imgutils.h"
33 #include "libavutil/internal.h"
34 #include "libavutil/opt.h"
35 #include "libavutil/samplefmt.h"
36 #include "audio.h"
37 #include "avfilter.h"
38 #include "buffersrc.h"
39 #include "formats.h"
40 #include "internal.h"
41 #include "video.h"
42 
43 typedef struct BufferSourceContext {
44  const AVClass *class;
46  AVRational time_base; ///< time_base to set in the output link
47  AVRational frame_rate; ///< frame_rate to set in the output link
49  unsigned warning_limit;
50 
51  /* video only */
52  int w, h;
55  char *sws_param;
56 
57  /* audio only */
60  int channels;
61  uint64_t channel_layout;
63 
64  int eof;
66 
67 #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\
68  if (c->w != width || c->h != height || c->pix_fmt != format) {\
69  av_log(s, AV_LOG_INFO, "Changing frame properties on the fly is not supported by all filters.\n");\
70  }
71 
72 #define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, ch_count, format)\
73  if (c->sample_fmt != format || c->sample_rate != srate ||\
74  c->channel_layout != ch_layout || c->channels != ch_count) {\
75  av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
76  return AVERROR(EINVAL);\
77  }
78 
79 int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame)
80 {
81  return av_buffersrc_add_frame_flags(ctx, (AVFrame *)frame,
83 }
84 
86 {
87  return av_buffersrc_add_frame_flags(ctx, frame, 0);
88 }
89 
91  AVFrame *frame, int flags);
92 
94 {
95  AVFrame *copy = NULL;
96  int ret = 0;
97 
98  if (frame && frame->channel_layout &&
100  av_log(ctx, AV_LOG_ERROR, "Layout indicates a different number of channels than actually present\n");
101  return AVERROR(EINVAL);
102  }
103 
104  if (!(flags & AV_BUFFERSRC_FLAG_KEEP_REF) || !frame)
105  return av_buffersrc_add_frame_internal(ctx, frame, flags);
106 
107  if (!(copy = av_frame_alloc()))
108  return AVERROR(ENOMEM);
109  ret = av_frame_ref(copy, frame);
110  if (ret >= 0)
111  ret = av_buffersrc_add_frame_internal(ctx, copy, flags);
112 
113  av_frame_free(&copy);
114  return ret;
115 }
116 
118  AVFrame *frame, int flags)
119 {
120  BufferSourceContext *s = ctx->priv;
121  AVFrame *copy;
122  int refcounted, ret;
123 
124  s->nb_failed_requests = 0;
125 
126  if (!frame) {
127  s->eof = 1;
128  return 0;
129  } else if (s->eof)
130  return AVERROR(EINVAL);
131 
132  refcounted = !!frame->buf[0];
133 
134  if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {
135 
136  switch (ctx->outputs[0]->type) {
137  case AVMEDIA_TYPE_VIDEO:
138  CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,
139  frame->format);
140  break;
141  case AVMEDIA_TYPE_AUDIO:
142  /* For layouts unknown on input but known on link after negotiation. */
143  if (!frame->channel_layout)
144  frame->channel_layout = s->channel_layout;
145  CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,
146  av_frame_get_channels(frame), frame->format);
147  break;
148  default:
149  return AVERROR(EINVAL);
150  }
151 
152  }
153 
154  if (!av_fifo_space(s->fifo) &&
155  (ret = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +
156  sizeof(copy))) < 0)
157  return ret;
158 
159  if (!(copy = av_frame_alloc()))
160  return AVERROR(ENOMEM);
161 
162  if (refcounted) {
163  av_frame_move_ref(copy, frame);
164  } else {
165  ret = av_frame_ref(copy, frame);
166  if (ret < 0) {
167  av_frame_free(&copy);
168  return ret;
169  }
170  }
171 
172  if ((ret = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) {
173  if (refcounted)
174  av_frame_move_ref(frame, copy);
175  av_frame_free(&copy);
176  return ret;
177  }
178 
179  if ((flags & AV_BUFFERSRC_FLAG_PUSH))
180  if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
181  return ret;
182 
183  return 0;
184 }
185 
187 {
188  BufferSourceContext *c = ctx->priv;
189 
190  if (c->pix_fmt == AV_PIX_FMT_NONE || !c->w || !c->h || av_q2d(c->time_base) <= 0) {
191  av_log(ctx, AV_LOG_ERROR, "Invalid parameters provided.\n");
192  return AVERROR(EINVAL);
193  }
194 
195  if (!(c->fifo = av_fifo_alloc(sizeof(AVFrame*))))
196  return AVERROR(ENOMEM);
197 
198  av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s tb:%d/%d fr:%d/%d sar:%d/%d sws_param:%s\n",
199  c->w, c->h, av_get_pix_fmt_name(c->pix_fmt),
201  c->pixel_aspect.num, c->pixel_aspect.den, (char *)av_x_if_null(c->sws_param, ""));
202  c->warning_limit = 100;
203  return 0;
204 }
205 
207 {
208  return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests;
209 }
210 
211 #define OFFSET(x) offsetof(BufferSourceContext, x)
212 #define A AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
213 #define V AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
214 
215 static const AVOption buffer_options[] = {
216  { "width", NULL, OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
217  { "video_size", NULL, OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, .flags = V },
218  { "height", NULL, OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
219  { "pix_fmt", NULL, OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, { .i64 = AV_PIX_FMT_NONE }, .min = AV_PIX_FMT_NONE, .max = INT_MAX, .flags = V },
220 #if FF_API_OLD_FILTER_OPTS
221  /* those 4 are for compatibility with the old option passing system where each filter
222  * did its own parsing */
223  { "time_base_num", "deprecated, do not use", OFFSET(time_base.num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
224  { "time_base_den", "deprecated, do not use", OFFSET(time_base.den), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
225  { "sar_num", "deprecated, do not use", OFFSET(pixel_aspect.num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
226  { "sar_den", "deprecated, do not use", OFFSET(pixel_aspect.den), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
227 #endif
228  { "sar", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, DBL_MAX, V },
229  { "pixel_aspect", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, DBL_MAX, V },
230  { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
231  { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
232  { "sws_param", NULL, OFFSET(sws_param), AV_OPT_TYPE_STRING, .flags = V },
233  { NULL },
234 };
235 
237 
238 static const AVOption abuffer_options[] = {
239  { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, A },
240  { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
241  { "sample_fmt", NULL, OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, { .i64 = AV_SAMPLE_FMT_NONE }, .min = AV_SAMPLE_FMT_NONE, .max = INT_MAX, .flags = A },
242  { "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A },
243  { "channels", NULL, OFFSET(channels), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
244  { NULL },
245 };
246 
247 AVFILTER_DEFINE_CLASS(abuffer);
248 
250 {
251  BufferSourceContext *s = ctx->priv;
252  int ret = 0;
253 
254  if (s->sample_fmt == AV_SAMPLE_FMT_NONE) {
255  av_log(ctx, AV_LOG_ERROR, "Sample format was not set or was invalid\n");
256  return AVERROR(EINVAL);
257  }
258 
259  if (s->channel_layout_str) {
260  int n;
261 
263  if (!s->channel_layout) {
264  av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
265  s->channel_layout_str);
266  return AVERROR(EINVAL);
267  }
269  if (s->channels) {
270  if (n != s->channels) {
271  av_log(ctx, AV_LOG_ERROR,
272  "Mismatching channel count %d and layout '%s' "
273  "(%d channels)\n",
274  s->channels, s->channel_layout_str, n);
275  return AVERROR(EINVAL);
276  }
277  }
278  s->channels = n;
279  } else if (!s->channels) {
280  av_log(ctx, AV_LOG_ERROR, "Neither number of channels nor "
281  "channel layout specified\n");
282  return AVERROR(EINVAL);
283  }
284 
285  if (!(s->fifo = av_fifo_alloc(sizeof(AVFrame*))))
286  return AVERROR(ENOMEM);
287 
288  if (!s->time_base.num)
289  s->time_base = (AVRational){1, s->sample_rate};
290 
291  av_log(ctx, AV_LOG_VERBOSE,
292  "tb:%d/%d samplefmt:%s samplerate:%d chlayout:%s\n",
295  s->warning_limit = 100;
296 
297  return ret;
298 }
299 
301 {
302  BufferSourceContext *s = ctx->priv;
303  while (s->fifo && av_fifo_size(s->fifo)) {
304  AVFrame *frame;
305  av_fifo_generic_read(s->fifo, &frame, sizeof(frame), NULL);
306  av_frame_free(&frame);
307  }
308  av_fifo_freep(&s->fifo);
309 }
310 
312 {
313  BufferSourceContext *c = ctx->priv;
314  AVFilterChannelLayouts *channel_layouts = NULL;
316  AVFilterFormats *samplerates = NULL;
317  int ret;
318 
319  switch (ctx->outputs[0]->type) {
320  case AVMEDIA_TYPE_VIDEO:
321  if ((ret = ff_add_format (&formats, c->pix_fmt)) < 0 ||
322  (ret = ff_set_common_formats (ctx , formats )) < 0)
323  return ret;
324  break;
325  case AVMEDIA_TYPE_AUDIO:
326  if ((ret = ff_add_format (&formats , c->sample_fmt )) < 0 ||
327  (ret = ff_set_common_formats (ctx , formats )) < 0 ||
328  (ret = ff_add_format (&samplerates, c->sample_rate)) < 0 ||
329  (ret = ff_set_common_samplerates (ctx , samplerates )) < 0)
330  return ret;
331 
332  if ((ret = ff_add_channel_layout(&channel_layouts,
334  FF_COUNT2LAYOUT(c->channels))) < 0)
335  return ret;
336  if ((ret = ff_set_common_channel_layouts(ctx, channel_layouts)) < 0)
337  return ret;
338  break;
339  default:
340  return AVERROR(EINVAL);
341  }
342 
343  return 0;
344 }
345 
346 static int config_props(AVFilterLink *link)
347 {
348  BufferSourceContext *c = link->src->priv;
349 
350  switch (link->type) {
351  case AVMEDIA_TYPE_VIDEO:
352  link->w = c->w;
353  link->h = c->h;
355  break;
356  case AVMEDIA_TYPE_AUDIO:
357  if (!c->channel_layout)
358  c->channel_layout = link->channel_layout;
359  break;
360  default:
361  return AVERROR(EINVAL);
362  }
363 
364  link->time_base = c->time_base;
365  link->frame_rate = c->frame_rate;
366  return 0;
367 }
368 
369 static int request_frame(AVFilterLink *link)
370 {
371  BufferSourceContext *c = link->src->priv;
372  AVFrame *frame;
373 
374  if (!av_fifo_size(c->fifo)) {
375  if (c->eof)
376  return AVERROR_EOF;
377  c->nb_failed_requests++;
378  return AVERROR(EAGAIN);
379  }
380  av_fifo_generic_read(c->fifo, &frame, sizeof(frame), NULL);
381 
382  return ff_filter_frame(link, frame);
383 }
384 
385 static int poll_frame(AVFilterLink *link)
386 {
387  BufferSourceContext *c = link->src->priv;
388  int size = av_fifo_size(c->fifo);
389  if (!size && c->eof)
390  return AVERROR_EOF;
391  return size/sizeof(AVFrame*);
392 }
393 
395  {
396  .name = "default",
397  .type = AVMEDIA_TYPE_VIDEO,
398  .request_frame = request_frame,
399  .poll_frame = poll_frame,
400  .config_props = config_props,
401  },
402  { NULL }
403 };
404 
406  .name = "buffer",
407  .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
408  .priv_size = sizeof(BufferSourceContext),
410 
411  .init = init_video,
412  .uninit = uninit,
413 
414  .inputs = NULL,
415  .outputs = avfilter_vsrc_buffer_outputs,
416  .priv_class = &buffer_class,
417 };
418 
420  {
421  .name = "default",
422  .type = AVMEDIA_TYPE_AUDIO,
423  .request_frame = request_frame,
424  .poll_frame = poll_frame,
425  .config_props = config_props,
426  },
427  { NULL }
428 };
429 
431  .name = "abuffer",
432  .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
433  .priv_size = sizeof(BufferSourceContext),
435 
436  .init = init_audio,
437  .uninit = uninit,
438 
439  .inputs = NULL,
440  .outputs = avfilter_asrc_abuffer_outputs,
441  .priv_class = &abuffer_class,
442 };
#define NULL
Definition: coverity.c:32
int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts)
A helper for query_formats() which sets all links to the same list of channel layouts/sample rates...
Definition: formats.c:549
const char * s
Definition: avisynth_c.h:631
static enum AVPixelFormat pix_fmt
This structure describes decoded (raw) audio or video data.
Definition: frame.h:181
AVOption.
Definition: opt.h:245
AVRational pixel_aspect
Definition: buffersrc.c:54
AVFormatContext * ctx
Definition: movenc-test.c:48
misc image utilities
Main libavfilter public API header.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition: frame.h:357
Memory buffer source API.
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int num
numerator
Definition: rational.h:44
Immediately push the frame to the output.
Definition: buffersrc.h:48
static av_cold int init_video(AVFilterContext *ctx)
Definition: buffersrc.c:186
static const AVFilterPad avfilter_vsrc_buffer_outputs[]
Definition: buffersrc.c:394
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition: frame.c:496
static enum AVSampleFormat formats[]
enum AVPixelFormat pix_fmt
Definition: buffersrc.c:53
static av_cold void uninit(AVFilterContext *ctx)
Definition: buffersrc.c:300
#define OFFSET(x)
Definition: buffersrc.c:211
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
Definition: fifo.c:122
AVFilter ff_asrc_abuffer
Definition: buffersrc.c:430
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
const char * name
Pad name.
Definition: internal.h:59
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
static const AVOption abuffer_options[]
Definition: buffersrc.c:238
unsigned warning_limit
Definition: buffersrc.c:49
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1163
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:315
#define av_cold
Definition: attributes.h:82
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:141
int(* request_frame)(AVFilterLink *link)
Frame request callback.
Definition: internal.h:112
AVOptions.
static int poll_frame(AVFilterLink *link)
Definition: buffersrc.c:385
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:375
int av_fifo_space(const AVFifoBuffer *f)
Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write int...
Definition: fifo.c:82
static AVFrame * frame
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:80
#define AVERROR_EOF
End of file.
Definition: error.h:55
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
static const AVFilterPad avfilter_asrc_abuffer_outputs[]
Definition: buffersrc.c:419
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking.
Definition: lzo.c:85
ptrdiff_t size
Definition: opengl_enc.c:101
#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, ch_count, format)
Definition: buffersrc.c:72
#define av_log(a,...)
A filter pad used for either input or output.
Definition: internal.h:53
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
Definition: avutil.h:300
int width
width and height of the video frame
Definition: frame.h:230
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
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:568
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
Definition: formats.c:343
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:154
static int request_frame(AVFilterLink *link)
Definition: buffersrc.c:369
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
void * priv
private data for use by the filter
Definition: avfilter.h:319
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
Definition: fifo.c:213
#define A
Definition: buffersrc.c:212
int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition: formats.c:337
AVRational time_base
time_base to set in the output link
Definition: buffersrc.c:46
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition: samplefmt.c:47
AVRational frame_rate
frame_rate to set in the output link
Definition: buffersrc.c:47
reference-counted frame API
uint64_t channel_layout
Channel layout of the audio data.
Definition: frame.h:343
common internal API header
AVFILTER_DEFINE_CLASS(buffer)
audio channel layout utility functions
int n
Definition: avisynth_c.h:547
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:385
static av_cold int init_audio(AVFilterContext *ctx)
Definition: buffersrc.c:249
A list of supported channel layouts.
Definition: formats.h:85
Keep a reference to the frame.
Definition: buffersrc.h:55
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:242
sample_rate
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:375
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:59
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
Definition: fifo.c:77
static const AVOption buffer_options[]
Definition: buffersrc.c:215
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
Resize an AVFifoBuffer.
Definition: fifo.c:87
a very simple circular buffer FIFO implementation
#define V
Definition: buffersrc.c:213
Describe the class of an AVClass context structure.
Definition: log.h:67
int sample_rate
Sample rate of the audio data.
Definition: frame.h:338
int av_frame_get_channels(const AVFrame *frame)
Filter definition.
Definition: avfilter.h:141
rational number numerator/denominator
Definition: rational.h:43
static int config_props(AVFilterLink *link)
Definition: buffersrc.c:346
const char * name
Filter name.
Definition: avfilter.h:145
static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags)
Definition: buffersrc.c:117
offset must point to two consecutive integers
Definition: opt.h:232
AVFifoBuffer * fifo
Definition: buffersrc.c:45
unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src)
Get the number of failed requests.
Definition: buffersrc.c:206
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:316
uint64_t channel_layout
Definition: buffersrc.c:61
static int flags
Definition: cpu.c:47
int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame)
Add a frame to the buffer source.
Definition: buffersrc.c:79
AVFilter ff_vsrc_buffer
Definition: buffersrc.c:405
common internal and external API header
static double c[64]
int den
denominator
Definition: rational.h:45
int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
Add a frame to the buffer source.
Definition: buffersrc.c:93
unsigned nb_failed_requests
Definition: buffersrc.c:48
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
Definition: fifo.c:43
enum AVSampleFormat sample_fmt
Definition: buffersrc.c:59
static int query_formats(AVFilterContext *ctx)
Definition: buffersrc.c:311
A list of supported formats for one end of a filter link.
Definition: formats.h:64
An instance of a filter.
Definition: avfilter.h:304
int height
Definition: frame.h:230
#define FF_COUNT2LAYOUT(c)
Encode a channel count as a channel layout.
Definition: formats.h:102
void av_fifo_freep(AVFifoBuffer **f)
Free an AVFifoBuffer and reset pointer to NULL.
Definition: fifo.c:63
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2078
internal API functions
AVPixelFormat
Pixel format.
Definition: pixfmt.h:61
int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:556
#define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)
Definition: buffersrc.c:67
GLuint buffer
Definition: opengl_enc.c:102
int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
Add a frame to the buffer source.
Definition: buffersrc.c:85
char * channel_layout_str
Definition: buffersrc.c:62
Do not check for format changes.
Definition: buffersrc.h:43