FFmpeg
Loading...
Searching...
No Matches
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/frame.h"
30#include "libavutil/hwcontext.h"
31#include "libavutil/internal.h"
32#include "libavutil/mem.h"
33#include "libavutil/opt.h"
34#include "libavutil/pixdesc.h"
35#include "libavutil/samplefmt.h"
36#include "libavutil/timestamp.h"
37#include "avfilter.h"
38#include "avfilter_internal.h"
39#include "buffersrc.h"
40#include "filters.h"
41#include "formats.h"
42#include "video.h"
43
76
77#define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format, csp, range, alpha, chromaloc, pts)\
78 c->link_delta = c->w != width || c->h != height || c->pix_fmt != format ||\
79 c->color_space != csp || c->color_range != range || c->alpha_mode != alpha ||\
80 c->chroma_location != chromaloc;\
81 c->prev_delta = c->prev_w != width || c->prev_h != height || c->prev_pix_fmt != format ||\
82 c->prev_color_space != csp || c->prev_color_range != range || c->prev_alpha_mode != alpha ||\
83 c->prev_chroma_location != chromaloc;\
84 if (c->link_delta) {\
85 int loglevel = c->prev_delta ? AV_LOG_WARNING : AV_LOG_DEBUG;\
86 av_log(s, loglevel, "Changing video frame properties on the fly is not supported by all filters.\n");\
87 av_log(s, loglevel, "filter context - w: %d h: %d fmt: %d csp: %s range: %s alpha: %s chroma_loc: %s, incoming frame - w: %d h: %d fmt: %d csp: %s range: %s alpha: %s chroma_loc: %s pts_time: %s\n",\
88 c->w, c->h, c->pix_fmt, av_color_space_name(c->color_space), av_color_range_name(c->color_range), av_alpha_mode_name(c->alpha_mode),\
89 av_chroma_location_name(c->chroma_location),\
90 width, height, format, av_color_space_name(csp), av_color_range_name(range), av_alpha_mode_name(alpha),\
91 av_chroma_location_name(chromaloc),\
92 av_ts2timestr(pts, &s->outputs[0]->time_base));\
93 }\
94 if (c->prev_delta) {\
95 if (!c->link_delta)\
96 av_log(s, AV_LOG_VERBOSE, "video frame properties congruent with link at pts_time: %s\n", av_ts2timestr(pts, &s->outputs[0]->time_base));\
97 c->prev_w = width;\
98 c->prev_h = height;\
99 c->prev_pix_fmt = format;\
100 c->prev_color_space = csp;\
101 c->prev_color_range = range;\
102 c->prev_alpha_mode = alpha;\
103 c->prev_chroma_location = chromaloc;\
104 }
105
106#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, layout, format, pts)\
107 if (c->sample_fmt != format || c->sample_rate != srate ||\
108 av_channel_layout_compare(&c->ch_layout, &layout) || c->channels != layout.nb_channels) {\
109 av_log(s, AV_LOG_INFO, "filter context - fmt: %s r: %d layout: %"PRIX64" ch: %d, incoming frame - fmt: %s r: %d layout: %"PRIX64" ch: %d pts_time: %s\n",\
110 av_get_sample_fmt_name(c->sample_fmt), c->sample_rate, c->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? c->ch_layout.u.mask : 0, c->channels,\
111 av_get_sample_fmt_name(format), srate, layout.order == AV_CHANNEL_ORDER_NATIVE ? layout.u.mask : 0, layout.nb_channels, av_ts2timestr(pts, &s->outputs[0]->time_base));\
112 av_log(s, AV_LOG_ERROR, "Changing audio frame properties on the fly is not supported.\n");\
113 return AVERROR(EINVAL);\
114 }
115
117{
118 AVBufferSrcParameters *par = av_mallocz(sizeof(*par));
119 if (!par)
120 return NULL;
121
122 par->format = -1;
127
128 return par;
129}
130
132{
133 BufferSourceContext *s = ctx->priv;
134
135 if (param->time_base.num > 0 && param->time_base.den > 0)
136 s->time_base = param->time_base;
137
138 switch (ctx->filter->outputs[0].type) {
140 if (param->format != AV_PIX_FMT_NONE) {
141 s->pix_fmt = s->prev_pix_fmt = param->format;
142 }
143 if (param->width > 0)
144 s->w = s->prev_w = param->width;
145 if (param->height > 0)
146 s->h = s->prev_h = param->height;
147 if (param->sample_aspect_ratio.num > 0 && param->sample_aspect_ratio.den > 0)
148 s->pixel_aspect = param->sample_aspect_ratio;
149 if (param->frame_rate.num > 0 && param->frame_rate.den > 0)
150 s->frame_rate = param->frame_rate;
151 if (param->hw_frames_ctx) {
152 av_buffer_unref(&s->hw_frames_ctx);
153 s->hw_frames_ctx = av_buffer_ref(param->hw_frames_ctx);
154 if (!s->hw_frames_ctx)
155 return AVERROR(ENOMEM);
156 }
158 s->color_space = s->prev_color_space = param->color_space;
160 s->color_range = s->prev_color_range = param->color_range;
162 s->alpha_mode = s->prev_alpha_mode = param->alpha_mode;
164 s->chroma_location = s->prev_chroma_location = param->chroma_location;
165 break;
167 if (param->format != AV_SAMPLE_FMT_NONE) {
168 s->sample_fmt = param->format;
169 }
170 if (param->sample_rate > 0)
171 s->sample_rate = param->sample_rate;
172 if (param->ch_layout.nb_channels) {
173 int ret = av_channel_layout_copy(&s->ch_layout, &param->ch_layout);
174 if (ret < 0)
175 return ret;
176 }
177 break;
178 default:
179 return AVERROR_BUG;
180 }
181
182 if (param->nb_side_data > 0)
183 av_frame_side_data_free(&s->side_data, &s->nb_side_data);
184 for (int i = 0; i < param->nb_side_data; i++) {
185 int ret = av_frame_side_data_clone(&s->side_data, &s->nb_side_data,
186 param->side_data[i], 0);
187 if (ret < 0) {
188 av_frame_side_data_free(&s->side_data, &s->nb_side_data);
189 return ret;
190 }
191 }
192
193 return 0;
194}
195
201
206
207static int push_frame(AVFilterGraph *graph)
208{
209 int ret;
210
211 while (1) {
212 ret = ff_filter_graph_run_once(graph);
213 if (ret == AVERROR(EAGAIN))
214 break;
215 if (ret < 0 && ret != FFERROR_BUFFERSRC_EMPTY)
216 return ret;
217 }
218 return 0;
219}
220
222{
223 BufferSourceContext *s = ctx->priv;
224 AVFrame *copy;
225 int refcounted, ret;
226
227 s->nb_failed_requests = 0;
228
229 if (!frame)
230 return av_buffersrc_close(ctx, s->last_pts, flags);
231 if (s->eof)
232 return AVERROR_EOF;
233
234 s->last_pts = frame->pts + frame->duration;
235
236 refcounted = !!frame->buf[0];
237
239
240 switch (ctx->outputs[0]->type) {
242 CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,
243 frame->format, frame->colorspace,
244 frame->color_range, frame->alpha_mode,
245 frame->chroma_location, frame->pts);
246 break;
248 /* For layouts unknown on input but known on link after negotiation. */
249 if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC && frame->ch_layout.nb_channels == s->ch_layout.nb_channels) {
250 ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout);
251 if (ret < 0)
252 return ret;
253 }
254 CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->ch_layout,
255 frame->format, frame->pts);
256 break;
257 default:
258 return AVERROR(EINVAL);
259 }
260
261 }
262
263 if (refcounted && !(flags & AV_BUFFERSRC_FLAG_KEEP_REF)) {
264 if (!(copy = av_frame_alloc()))
265 return AVERROR(ENOMEM);
267 } else {
269 if (!copy)
270 return AVERROR(ENOMEM);
271 }
272
273 if (copy->colorspace == AVCOL_SPC_UNSPECIFIED)
274 copy->colorspace = ctx->outputs[0]->colorspace;
275 if (copy->color_range == AVCOL_RANGE_UNSPECIFIED)
276 copy->color_range = ctx->outputs[0]->color_range;
277 if (copy->alpha_mode == AVALPHA_MODE_UNSPECIFIED)
278 copy->alpha_mode = ctx->outputs[0]->alpha_mode;
279 if (copy->chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
280 copy->chroma_location = ctx->outputs[0]->chroma_location;
281 /* The input never said where its chroma sits, so it is assumed to be
282 * compatible with whatever the rest of the graph settled on. */
283 if (copy->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
284 av_log_once(ctx, AV_LOG_WARNING, AV_LOG_VERBOSE, &s->chroma_loc_warned,
285 "Input has no chroma sample location, assuming %s\n",
286 av_chroma_location_name(copy->chroma_location));
287 }
288
289 ret = ff_filter_frame(ctx->outputs[0], copy);
290 if (ret < 0)
291 return ret;
292
294 ret = push_frame(ctx->graph);
295 if (ret < 0)
296 return ret;
297 }
298
299 FilterLinkInternal *const li = ff_link_internal(ctx->outputs[0]);
300 if (s->warning_limit &&
301 ff_framequeue_queued_frames(&li->fifo) >= s->warning_limit) {
303 "%d buffers queued in %s, something may be wrong.\n",
304 s->warning_limit,
305 (char *)av_x_if_null(ctx->name, ctx->filter->name));
306 s->warning_limit *= 10;
307 }
308
309 return 0;
310}
311
313{
314 BufferSourceContext *s = ctx->priv;
315
316 s->eof = 1;
318 return (flags & AV_BUFFERSRC_FLAG_PUSH) ? push_frame(ctx->graph) : 0;
319}
320
322{
323 BufferSourceContext *s = ctx->priv;
324
325 if (!s->eof && ff_outlink_get_status(ctx->outputs[0]))
326 s->eof = 1;
327
328 return s->eof ? AVERROR(EOF) : 0;
329}
330
332{
333 BufferSourceContext *c = ctx->priv;
334
335 c->warning_limit = 100;
336 return 0;
337}
338
340{
341 BufferSourceContext *c = ctx->priv;
342
343 if (c->pix_fmt == AV_PIX_FMT_NONE) {
344 av_log(ctx, AV_LOG_ERROR, "Unspecified pixel format\n");
345 return AVERROR(EINVAL);
346 }
348 if (!c->hw_frames_ctx) {
349 av_log(ctx, AV_LOG_ERROR, "Setting BufferSourceContext.pix_fmt "
350 "to a HW format requires hw_frames_ctx to be non-NULL!\n");
351 return AVERROR(EINVAL);
352 }
353 }
354 if (c->w <= 0 || c->h <= 0) {
355 av_log(ctx, AV_LOG_ERROR, "Invalid size %dx%d\n", c->w, c->h);
356 return AVERROR(EINVAL);
357 }
358 if (av_q2d(c->time_base) <= 0) {
359 av_log(ctx, AV_LOG_ERROR, "Invalid time base %d/%d\n", c->time_base.num, c->time_base.den);
360 return AVERROR(EINVAL);
361 }
362
363 av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s tb:%d/%d fr:%d/%d sar:%d/%d csp:%s range:%s alpha:%s chroma_loc:%s\n",
364 c->w, c->h, av_get_pix_fmt_name(c->pix_fmt),
365 c->time_base.num, c->time_base.den, c->frame_rate.num, c->frame_rate.den,
366 c->pixel_aspect.num, c->pixel_aspect.den,
367 av_color_space_name(c->color_space), av_color_range_name(c->color_range),
368 av_alpha_mode_name(c->alpha_mode), av_chroma_location_name(c->chroma_location));
369
370 return common_init(ctx);
371}
372
374{
375 return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests;
376}
377
378#define OFFSET(x) offsetof(BufferSourceContext, x)
379#define A AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
380#define V AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
381
382static const AVOption buffer_options[] = {
383 { "width", NULL, OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
384 { "video_size", NULL, OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, .flags = V },
385 { "height", NULL, OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
386 { "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 },
387 { "sar", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
388 { "pixel_aspect", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
389 { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
390 { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
391 { "colorspace", "select colorspace", OFFSET(color_space), AV_OPT_TYPE_INT, {.i64=AVCOL_SPC_UNSPECIFIED}, 0, AVCOL_SPC_NB-1, V, .unit = "colorspace"},
392 { "gbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_RGB}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
393 { "bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT709}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
394 { "unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_UNSPECIFIED}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
395 { "fcc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_FCC}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
396 { "bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT470BG}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
397 { "smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE170M}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
398 { "smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE240M}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
399 { "ycgco", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
400 { "ycgco-re", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RE}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
401 { "ycgco-ro", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RO}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
402 { "bt2020nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_NCL}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
403 { "bt2020c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_CL}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
404 { "smpte2085", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE2085}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
405 { "chroma-derived-nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_NCL},INT_MIN, INT_MAX, V, .unit = "colorspace"},
406 { "chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
407 { "ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
408 { "ipt-c2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_IPT_C2}, INT_MIN, INT_MAX, V, .unit = "colorspace"},
409 { "range", "select color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, AVCOL_RANGE_NB-1, V, .unit = "range"},
410 { "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, V, .unit = "range"},
411 { "unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, V, .unit = "range"},
412 { "limited", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, V, .unit = "range"},
413 { "tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, V, .unit = "range"},
414 { "mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, V, .unit = "range"},
415 { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, V, .unit = "range"},
416 { "pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, V, .unit = "range"},
417 { "jpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, V, .unit = "range"},
418 { "alpha_mode", "select alpha mode", OFFSET(alpha_mode), AV_OPT_TYPE_INT, {.i64=AVALPHA_MODE_UNSPECIFIED}, 0, AVCOL_RANGE_NB-1, V, .unit = "alpha"},
419 { "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_UNSPECIFIED}, 0, 0, V, .unit = "alpha"},
420 { "unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_UNSPECIFIED}, 0, 0, V, .unit = "alpha"},
421 { "straight", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_STRAIGHT}, 0, 0, V, .unit = "alpha"},
422 { "premultiplied", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_PREMULTIPLIED}, 0, 0, V, .unit = "alpha"},
423 { "chroma_location", "select chroma sample location", OFFSET(chroma_location), AV_OPT_TYPE_INT, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, AVCHROMA_LOC_NB-1, V, .unit = "chroma_loc"},
424 { "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, 0, V, .unit = "chroma_loc"},
425 { "unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, 0, V, .unit = "chroma_loc"},
426 { "left", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_LEFT}, 0, 0, V, .unit = "chroma_loc"},
427 { "center", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_CENTER}, 0, 0, V, .unit = "chroma_loc"},
428 { "topleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOPLEFT}, 0, 0, V, .unit = "chroma_loc"},
429 { "top", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOP}, 0, 0, V, .unit = "chroma_loc"},
430 { "bottomleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOMLEFT}, 0, 0, V, .unit = "chroma_loc"},
431 { "bottom", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOM}, 0, 0, V, .unit = "chroma_loc"},
432 { NULL },
433};
434
436
437static const AVOption abuffer_options[] = {
438 { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, A },
439 { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
440 { "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 },
441 { "channel_layout", NULL, OFFSET(ch_layout), AV_OPT_TYPE_CHLAYOUT, .flags = A },
442 { "channels", NULL, OFFSET(channels), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
443 { NULL },
444};
445
447
449{
450 BufferSourceContext *s = ctx->priv;
451 char buf[128];
452
453 if (s->sample_fmt == AV_SAMPLE_FMT_NONE) {
454 av_log(ctx, AV_LOG_ERROR, "Sample format was not set or was invalid\n");
455 return AVERROR(EINVAL);
456 }
457
458 if (av_channel_layout_check(&s->ch_layout)) {
459 int n;
460
461 n = s->ch_layout.nb_channels;
462 av_channel_layout_describe(&s->ch_layout, buf, sizeof(buf));
463 if (s->channels) {
464 if (n != s->channels) {
466 "Mismatching channel count %d and layout '%s' "
467 "(%d channels)\n",
468 s->channels, buf, n);
469 return AVERROR(EINVAL);
470 }
471 }
472 s->channels = n;
473 } else if (!s->channels) {
474 av_log(ctx, AV_LOG_ERROR, "Neither number of channels nor "
475 "channel layout specified\n");
476 return AVERROR(EINVAL);
477 } else {
478 s->ch_layout = FF_COUNT2LAYOUT(s->channels);
479 av_channel_layout_describe(&s->ch_layout, buf, sizeof(buf));
480 }
481
482 if (s->sample_rate <= 0) {
483 av_log(ctx, AV_LOG_ERROR, "Sample rate not set\n");
484 return AVERROR(EINVAL);
485 }
486
487 if (!s->time_base.num)
488 s->time_base = (AVRational){1, s->sample_rate};
489
491 "tb:%d/%d samplefmt:%s samplerate:%d chlayout:%s\n",
492 s->time_base.num, s->time_base.den, av_get_sample_fmt_name(s->sample_fmt),
493 s->sample_rate, buf);
494
495 return common_init(ctx);
496}
497
499{
500 BufferSourceContext *s = ctx->priv;
501 av_buffer_unref(&s->hw_frames_ctx);
502 av_channel_layout_uninit(&s->ch_layout);
503 av_frame_side_data_free(&s->side_data, &s->nb_side_data);
504}
505
507 AVFilterFormatsConfig **cfg_in,
508 AVFilterFormatsConfig **cfg_out)
509{
510 const BufferSourceContext *c = ctx->priv;
513 AVFilterFormats *samplerates = NULL;
514 AVFilterFormats *color_spaces = NULL;
515 AVFilterFormats *color_ranges = NULL;
516 AVFilterFormats *alpha_modes = NULL;
517 AVFilterFormats *chroma_locations = NULL;
518 int ret;
519
520 switch (ctx->outputs[0]->type) {
521 case AVMEDIA_TYPE_VIDEO: {
522 enum AVPixelFormat swfmt = c->pix_fmt;
524 swfmt = ((AVHWFramesContext *) c->hw_frames_ctx->data)->sw_format;
525 if ((ret = ff_add_format (&formats, c->pix_fmt)) < 0 ||
526 (ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0)
527 return ret;
528 /* force specific colorspace/range downstream only for ordinary YUV */
529 if (ff_fmt_is_regular_yuv(swfmt)) {
530 if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 ||
531 (ret = ff_set_common_color_spaces2(ctx, cfg_in, cfg_out, color_spaces)) < 0)
532 return ret;
533 if (ff_fmt_is_forced_full_range(swfmt)) {
534 if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_JPEG)) < 0)
535 return ret;
536 } else {
537 if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0)
538 return ret;
539 if (c->color_range == AVCOL_RANGE_UNSPECIFIED) {
540 /* allow implicitly promoting unspecified to mpeg */
541 if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_MPEG)) < 0)
542 return ret;
543 }
544 }
545 if ((ret = ff_set_common_color_ranges2(ctx, cfg_in, cfg_out, color_ranges)) < 0)
546 return ret;
547 }
549 if ((ret = ff_add_format(&alpha_modes, c->alpha_mode)) < 0)
550 return ret;
551 if (c->alpha_mode == AVALPHA_MODE_UNSPECIFIED) {
552 /* allow implicitly promoting unspecified to straight */
553 if ((ret = ff_add_format(&alpha_modes, AVALPHA_MODE_STRAIGHT)) < 0)
554 return ret;
555 }
556 if ((ret = ff_set_common_alpha_modes2(ctx, cfg_in, cfg_out, alpha_modes)) < 0)
557 return ret;
558 }
559 if (av_pix_fmt_desc_get(swfmt)->log2_chroma_w ||
560 av_pix_fmt_desc_get(swfmt)->log2_chroma_h) {
561 if (c->chroma_location != AVCHROMA_LOC_UNSPECIFIED) {
562 if ((ret = ff_add_format(&chroma_locations, c->chroma_location)) < 0)
563 return ret;
564 if ((ret = ff_set_common_chroma_locations2(ctx, cfg_in, cfg_out,
565 chroma_locations)) < 0)
566 return ret;
567 }
568 /* Untagged input places no constraint, there is nothing to convert
569 * from, so whatever the rest of the graph wants is used as is. */
570 }
571 break;
572 }
574 if ((ret = ff_add_format (&formats , c->sample_fmt )) < 0 ||
575 (ret = ff_set_common_formats2 (ctx, cfg_in, cfg_out, formats)) < 0 ||
576 (ret = ff_add_format (&samplerates, c->sample_rate)) < 0 ||
577 (ret = ff_set_common_samplerates2(ctx, cfg_in, cfg_out, samplerates)) < 0)
578 return ret;
579
580 if ((ret = ff_add_channel_layout(&channel_layouts, &c->ch_layout)) < 0)
581 return ret;
582 if ((ret = ff_set_common_channel_layouts2(ctx, cfg_in, cfg_out, channel_layouts)) < 0)
583 return ret;
584 break;
585 default:
586 return AVERROR(EINVAL);
587 }
588
589 return 0;
590}
591
592static int config_props(AVFilterLink *link)
593{
594 FilterLink *l = ff_filter_link(link);
595 BufferSourceContext *c = link->src->priv;
596
597 switch (link->type) {
599 link->w = c->w;
600 link->h = c->h;
601 link->sample_aspect_ratio = c->pixel_aspect;
602
603 if (c->hw_frames_ctx) {
604 l->hw_frames_ctx = av_buffer_ref(c->hw_frames_ctx);
605 if (!l->hw_frames_ctx)
606 return AVERROR(ENOMEM);
607 }
608 break;
610 if (!c->ch_layout.nb_channels || c->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
611 int ret = av_channel_layout_copy(&c->ch_layout, &link->ch_layout);
612 if (ret < 0)
613 return ret;
614 }
615 break;
616 default:
617 return AVERROR(EINVAL);
618 }
619
620 for (int i = 0; i < c->nb_side_data; i++) {
621 int ret;
622
624 c->side_data[i], 0);
625 if (ret < 0) {
627 return ret;
628 }
629 }
630
631 link->time_base = c->time_base;
632 l->frame_rate = c->frame_rate;
633 return 0;
634}
635
637{
638 AVFilterLink *outlink = ctx->outputs[0];
639 BufferSourceContext *c = ctx->priv;
640
641 if (!c->eof && ff_outlink_get_status(outlink)) {
642 c->eof = 1;
643 return 0;
644 }
645
646 if (c->eof) {
647 ff_outlink_set_status(outlink, AVERROR_EOF, c->last_pts);
648 return 0;
649 }
650 c->nb_failed_requests++;
652}
653
655 {
656 .name = "default",
657 .type = AVMEDIA_TYPE_VIDEO,
658 .config_props = config_props,
659 },
660};
661
663 .p.name = "buffer",
664 .p.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
665 .p.priv_class = &buffer_class,
666 .priv_size = sizeof(BufferSourceContext),
668 .init = init_video,
669 .uninit = uninit,
670
673};
674
676 {
677 .name = "default",
678 .type = AVMEDIA_TYPE_AUDIO,
679 .config_props = config_props,
680 },
681};
682
684 .p.name = "abuffer",
685 .p.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
686 .p.priv_class = &abuffer_class,
687 .priv_size = sizeof(BufferSourceContext),
689 .init = init_audio,
690 .uninit = uninit,
691
694};
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
const FFFilter ff_vsrc_buffer
Definition buffersrc.c:662
const FFFilter ff_asrc_abuffer
Definition buffersrc.c:683
static AVFormatContext * ctx
channels
Definition aptx.h:31
#define A(x)
Definition vpx_arith.h:28
#define V
Definition avdct.c:32
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition avfilter.c:1653
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1073
void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition avfilter.c:250
Main libavfilter public API header.
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
int ff_fmt_is_forced_full_range(enum AVPixelFormat fmt)
Returns true if a YUV pixel format is forced full range (i.e.
int ff_fmt_is_regular_yuv(enum AVPixelFormat fmt)
Returns true if a pixel format is "regular YUV", which includes all pixel formats that are affected b...
static BitStreamFilterLinkInternal * ff_link_internal(AVBitStreamFilterLink *link)
static int init_audio(AVFilterContext *ctx)
Definition buffersink.c:180
static int init_video(AVFilterContext *ctx)
Definition buffersink.c:167
static const AVFilterPad avfilter_asrc_abuffer_outputs[]
Definition buffersrc.c:675
static int push_frame(AVFilterGraph *graph)
Definition buffersrc.c:207
static av_cold int common_init(AVFilterContext *ctx)
Definition buffersrc.c:331
static const AVFilterPad avfilter_vsrc_buffer_outputs[]
Definition buffersrc.c:654
#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, layout, format, pts)
Definition buffersrc.c:106
static av_cold int init_audio(AVFilterContext *ctx)
Definition buffersrc.c:448
static av_cold int init_video(AVFilterContext *ctx)
Definition buffersrc.c:339
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition buffersrc.c:506
static int activate(AVFilterContext *ctx)
Definition buffersrc.c:636
static av_cold void uninit(AVFilterContext *ctx)
Definition buffersrc.c:498
#define OFFSET(x)
Definition buffersrc.c:378
static const AVOption abuffer_options[]
Definition buffersrc.c:437
static int config_props(AVFilterLink *link)
Definition buffersrc.c:592
#define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format, csp, range, alpha, chromaloc, pts)
Definition buffersrc.c:77
Memory buffer source API.
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static const uint16_t channel_layouts[7]
Definition dca_lbr.c:112
static enum AVPixelFormat pix_fmt
static AVFrame * frame
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
int ff_set_common_samplerates2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *samplerates)
Definition formats.c:1079
int ff_set_common_color_ranges2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *color_ranges)
Definition formats.c:1127
int ff_set_common_formats2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *formats)
Definition formats.c:1200
int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition formats.c:580
int ff_set_common_channel_layouts2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterChannelLayouts *channel_layouts)
Helpers for query_formats2() which set all free audio links to the same list of channel layouts/sampl...
Definition formats.c:1055
int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition formats.c:597
int ff_set_common_color_spaces2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *color_spaces)
Definition formats.c:1103
int ff_set_common_chroma_locations2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *chroma_locations)
Definition formats.c:1175
int ff_set_common_alpha_modes2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *alpha_modes)
Definition formats.c:1151
#define FF_COUNT2LAYOUT(c)
Encode a channel count as a channel layout.
Definition formats.h:102
reference-counted frame API
static size_t ff_framequeue_queued_frames(const FFFrameQueue *fq)
Get the number of queued frames.
Definition framequeue.h:158
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition opt.h:302
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_PIXEL_FMT
Underlying C type is enum AVPixelFormat.
Definition opt.h:306
@ AV_OPT_TYPE_SAMPLE_FMT
Underlying C type is enum AVSampleFormat.
Definition opt.h:310
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
Definition opt.h:279
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition opt.h:330
int av_buffersrc_get_status(AVFilterContext *ctx)
Returns 0 or a negative AVERROR code.
Definition buffersrc.c:321
int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *param)
Initialize the buffersrc or abuffersrc filter with the provided parameters.
Definition buffersrc.c:131
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:221
int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame)
Add a frame to the buffer source.
Definition buffersrc.c:196
int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, unsigned flags)
Close the buffer source after EOF.
Definition buffersrc.c:312
int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
Add a frame to the buffer source.
Definition buffersrc.c:202
unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src)
Get the number of failed requests.
Definition buffersrc.c:373
AVBufferSrcParameters * av_buffersrc_parameters_alloc(void)
Allocate a new AVBufferSrcParameters instance.
Definition buffersrc.c:116
@ AV_BUFFERSRC_FLAG_KEEP_REF
Keep a reference to the frame.
Definition buffersrc.h:53
@ AV_BUFFERSRC_FLAG_PUSH
Immediately push the frame to the output.
Definition buffersrc.h:46
@ AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT
Do not check for format changes.
Definition buffersrc.h:41
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_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition buffer.c:140
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition buffer.c:104
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR_EOF
End of file.
Definition error.h:57
#define AVERROR(e)
Definition error.h:45
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
Free all side data entries and their contents, then zeroes out the values which the pointers are poin...
Definition side_data.c:140
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition frame.c:523
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:52
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, const AVFrameSideData *src, unsigned int flags)
Add a new side data entry to an array based on existing side data, taking a reference towards the con...
Definition side_data.c:255
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
Definition avutil.h:311
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
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:52
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
@ AV_SAMPLE_FMT_NONE
Definition samplefmt.h:56
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FFERROR_BUFFERSRC_EMPTY
Definition filters.h:35
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define av_cold
Definition attributes.h:117
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:97
#define attribute_align_arg
Definition internal.h:51
uint8_t w
Definition llvidencdsp.c:39
void av_log_once(void *avcl, int initial_level, int subsequent_level, int *state, const char *fmt,...)
Definition log.c:450
Memory handling functions.
AVOptions.
const char * av_color_space_name(enum AVColorSpace space)
Definition pixdesc.c:3860
const char * av_color_range_name(enum AVColorRange range)
Definition pixdesc.c:3776
const char * av_alpha_mode_name(enum AVAlphaMode mode)
Definition pixdesc.c:3925
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:3380
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition pixdesc.c:3881
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition pixdesc.h:147
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition pixdesc.h:128
AVChromaLocation
Location of chroma samples.
Definition pixfmt.h:802
@ AVCHROMA_LOC_TOP
Definition pixfmt.h:807
@ AVCHROMA_LOC_BOTTOM
Definition pixfmt.h:809
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition pixfmt.h:806
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition pixfmt.h:810
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition pixfmt.h:804
@ AVCHROMA_LOC_BOTTOMLEFT
Definition pixfmt.h:808
@ AVCHROMA_LOC_CENTER
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
Definition pixfmt.h:805
@ AVCHROMA_LOC_UNSPECIFIED
Definition pixfmt.h:803
AVColorRange
Visual content value range.
Definition pixfmt.h:748
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AVCOL_RANGE_UNSPECIFIED
Definition pixfmt.h:749
@ AVCOL_RANGE_NB
Not part of ABI.
Definition pixfmt.h:784
@ AVCOL_RANGE_JPEG
Full range content.
Definition pixfmt.h:783
AVAlphaMode
Correlation between the alpha channel and color values.
Definition pixfmt.h:816
@ AVALPHA_MODE_STRAIGHT
Alpha channel is independent of color values.
Definition pixfmt.h:819
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
Definition pixfmt.h:817
@ AVALPHA_MODE_PREMULTIPLIED
Alpha channel is multiplied into color values.
Definition pixfmt.h:818
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
AVColorSpace
YUV colorspace type.
Definition pixfmt.h:706
@ AVCOL_SPC_YCGCO_RE
YCgCo-R, even addition of bits.
Definition pixfmt.h:724
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition pixfmt.h:708
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
Definition pixfmt.h:712
@ AVCOL_SPC_CHROMA_DERIVED_CL
Chromaticity-derived constant luminance system.
Definition pixfmt.h:721
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition pixfmt.h:718
@ AVCOL_SPC_NB
Not part of ABI.
Definition pixfmt.h:726
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition pixfmt.h:707
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition pixfmt.h:717
@ AVCOL_SPC_SMPTE2085
SMPTE 2085, Y'D'zD'x.
Definition pixfmt.h:719
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:709
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition pixfmt.h:713
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition pixfmt.h:711
@ AVCOL_SPC_CHROMA_DERIVED_NCL
Chromaticity-derived non-constant luminance system.
Definition pixfmt.h:720
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition pixfmt.h:714
@ AVCOL_SPC_YCGCO_RO
YCgCo-R, odd addition of bits.
Definition pixfmt.h:725
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
Definition pixfmt.h:715
@ AVCOL_SPC_ICTCP
ITU-R BT.2100-0, ICtCp.
Definition pixfmt.h:722
@ AVCOL_SPC_IPT_C2
SMPTE ST 2128, IPT-C2.
Definition pixfmt.h:723
formats
Definition signature.h:47
static const AVOption buffer_options[]
Definition source.c:168
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181
A reference to a data buffer.
Definition buffer.h:82
This structure contains the parameters describing the frames that will be passed to this filter.
Definition buffersrc.h:73
AVRational frame_rate
Video only, the frame rate of the input video.
Definition buffersrc.h:100
int sample_rate
Audio only, the audio sampling rate in samples per second.
Definition buffersrc.h:111
AVFrameSideData ** side_data
Definition buffersrc.h:124
enum AVColorRange color_range
Definition buffersrc.h:122
AVChannelLayout ch_layout
Audio only, the audio channel layout.
Definition buffersrc.h:116
int format
video: the pixel format, value corresponds to enum AVPixelFormat audio: the sample format,...
Definition buffersrc.h:78
int width
Video only, the display dimensions of the input frames.
Definition buffersrc.h:87
enum AVColorSpace color_space
Video only, the YUV colorspace and range.
Definition buffersrc.h:121
enum AVAlphaMode alpha_mode
Video only, the alpha mode.
Definition buffersrc.h:130
AVRational time_base
The timebase to be used for the timestamps on the input frames.
Definition buffersrc.h:82
AVBufferRef * hw_frames_ctx
Video with a hwaccel pixel format only.
Definition buffersrc.h:106
AVRational sample_aspect_ratio
Video only, the sample (pixel) aspect ratio.
Definition buffersrc.h:92
enum AVChromaLocation chroma_location
Video only, the chroma sample location.
Definition buffersrc.h:135
An AVChannelLayout holds information about the channel layout of audio data.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
Definition log.h:76
A list of supported channel layouts.
Definition formats.h:85
An instance of a filter.
Definition avfilter.h:279
void * priv
private data for use by the filter
Definition avfilter.h:294
Lists of formats / etc.
Definition avfilter.h:120
A list of supported formats for one end of a filter link.
Definition formats.h:64
A filter pad used for either input or output.
Definition filters.h:40
Structure to hold side data for an AVFrame.
Definition frame.h:334
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
This struct describes a set or pool of "hardware" frames (i.e.
Definition hwcontext.h:118
AVOption.
Definition opt.h:428
uint64_t flags
Combination of AV_PIX_FMT_FLAG_... flags.
Definition pixdesc.h:94
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
unsigned warning_limit
Definition buffersrc.c:49
AVFrameSideData ** side_data
Definition buffersrc.c:67
AVRational pixel_aspect
Definition buffersrc.c:58
enum AVPixelFormat pix_fmt prev_pix_fmt
Definition buffersrc.c:53
enum AVColorRange color_range prev_color_range
Definition buffersrc.c:55
enum AVColorSpace color_space prev_color_space
Definition buffersrc.c:54
AVRational time_base
time_base to set in the output link
Definition buffersrc.c:46
unsigned nb_failed_requests
Definition buffersrc.c:48
AVBufferRef * hw_frames_ctx
Definition buffersrc.c:60
enum AVChromaLocation chroma_location prev_chroma_location
Definition buffersrc.c:57
enum AVSampleFormat sample_fmt
Definition buffersrc.c:64
enum AVAlphaMode alpha_mode prev_alpha_mode
Definition buffersrc.c:56
AVChannelLayout ch_layout
Definition buffersrc.c:66
AVRational frame_rate
frame_rate to set in the output link
Definition buffersrc.c:47
FFFrameQueue fifo
Queue of frames waiting to be filtered.
#define av_mallocz(s)
#define av_log(a,...)
static char buffer[20]
Definition seek.c:32
timestamp utils, mostly useful for debugging/logging purposes
static int64_t pts
color_range
static void copy(const float *p1, float *p2, const int length)
static double c[64]