FFmpeg
Loading...
Searching...
No Matches
avf_concat.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Nicolas George
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.
14 * See the GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/**
22 * @file
23 * concat audio-video filter
24 */
25
26#include "libavutil/avstring.h"
28#include "libavutil/mem.h"
29#include "libavutil/opt.h"
30#include "avfilter.h"
31#include "filters.h"
32#include "formats.h"
33#include "video.h"
34#include "audio.h"
35
36#define TYPE_ALL 2
37
38typedef struct ConcatContext {
39 const AVClass *class;
40 unsigned nb_streams[TYPE_ALL]; /**< number of out streams of each type */
41 unsigned nb_segments;
42 unsigned cur_idx; /**< index of the first input of current segment */
43 int64_t delta_ts; /**< timestamp to add to produce output timestamps */
44 unsigned nb_in_active; /**< number of active inputs in current segment */
45 unsigned unsafe;
52
53#define OFFSET(x) offsetof(ConcatContext, x)
54#define A AV_OPT_FLAG_AUDIO_PARAM
55#define F AV_OPT_FLAG_FILTERING_PARAM
56#define V AV_OPT_FLAG_VIDEO_PARAM
57
58static const AVOption concat_options[] = {
59 { "n", "specify the number of segments", OFFSET(nb_segments),
60 AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, V|A|F},
61 { "v", "specify the number of video streams",
63 AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX, V|F },
64 { "a", "specify the number of audio streams",
66 AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A|F},
67 { "unsafe", "enable unsafe mode",
68 OFFSET(unsafe),
69 AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, V|A|F},
70 { NULL }
71};
72
74
76 AVFilterFormatsConfig **cfg_in,
77 AVFilterFormatsConfig **cfg_out)
78{
79 const ConcatContext *cat = ctx->priv;
80 unsigned type, nb_str, idx0 = 0, idx, str, seg;
83 int ret;
84
85 for (type = 0; type < TYPE_ALL; type++) {
86 nb_str = cat->nb_streams[type];
87 for (str = 0; str < nb_str; str++) {
88 idx = idx0;
89
90 /* Set the output formats */
92 if ((ret = ff_formats_ref(formats, &cfg_out[idx]->formats)) < 0)
93 return ret;
94
95 if (type == AVMEDIA_TYPE_AUDIO) {
97 if ((ret = ff_formats_ref(rates, &cfg_out[idx]->samplerates)) < 0)
98 return ret;
100 if ((ret = ff_channel_layouts_ref(layouts, &cfg_out[idx]->channel_layouts)) < 0)
101 return ret;
102 }
103
104 /* Set the same formats for each corresponding input */
105 for (seg = 0; seg < cat->nb_segments; seg++) {
106 if ((ret = ff_formats_ref(formats, &cfg_in[idx]->formats)) < 0)
107 return ret;
108 if (type == AVMEDIA_TYPE_AUDIO) {
109 if ((ret = ff_formats_ref(rates, &cfg_in[idx]->samplerates)) < 0 ||
110 (ret = ff_channel_layouts_ref(layouts, &cfg_in[idx]->channel_layouts)) < 0)
111 return ret;
112 }
113 idx += ctx->nb_outputs;
114 }
115
116 idx0++;
117 }
118 }
119 return 0;
120}
121
122static int config_output(AVFilterLink *outlink)
123{
124 FilterLink *outl = ff_filter_link(outlink);
125 AVFilterContext *ctx = outlink->src;
126 ConcatContext *cat = ctx->priv;
127 unsigned out_no = FF_OUTLINK_IDX(outlink);
128 unsigned in_no = out_no, seg;
129 AVFilterLink *inlink = ctx->inputs[in_no];
130 FilterLink *inl = ff_filter_link(inlink);
131
132 /* enhancement: find a common one */
133 outlink->time_base = AV_TIME_BASE_Q;
134 outlink->w = inlink->w;
135 outlink->h = inlink->h;
136 outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
137 outlink->format = inlink->format;
138 outl->frame_rate = inl->frame_rate;
139
140 for (seg = 1; seg < cat->nb_segments; seg++) {
141 inlink = ctx->inputs[in_no + seg * ctx->nb_outputs];
142 inl = ff_filter_link(inlink);
143 if (outl->frame_rate.num != inl->frame_rate.num ||
144 outl->frame_rate.den != inl->frame_rate.den) {
146 "Video inputs have different frame rates, output will be VFR\n");
147 outl->frame_rate = av_make_q(1, 0);
148 break;
149 }
150 }
151
152 for (seg = 1; seg < cat->nb_segments; seg++) {
153 inlink = ctx->inputs[in_no + seg * ctx->nb_outputs];
154 if (!outlink->sample_aspect_ratio.num)
155 outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
156 /* possible enhancement: unsafe mode, do not check */
157 if (outlink->w != inlink->w ||
158 outlink->h != inlink->h ||
159 outlink->sample_aspect_ratio.num != inlink->sample_aspect_ratio.num &&
160 inlink->sample_aspect_ratio.num ||
161 outlink->sample_aspect_ratio.den != inlink->sample_aspect_ratio.den) {
162 av_log(ctx, AV_LOG_ERROR, "Input link %s parameters "
163 "(size %dx%d, SAR %d:%d) do not match the corresponding "
164 "output link %s parameters (%dx%d, SAR %d:%d)\n",
165 ctx->input_pads[in_no].name, inlink->w, inlink->h,
166 inlink->sample_aspect_ratio.num,
167 inlink->sample_aspect_ratio.den,
168 ctx->input_pads[out_no].name, outlink->w, outlink->h,
169 outlink->sample_aspect_ratio.num,
170 outlink->sample_aspect_ratio.den);
171 if (!cat->unsafe)
172 return AVERROR(EINVAL);
173 }
174 }
175
176 return 0;
177}
178
179static int push_frame(AVFilterContext *ctx, unsigned in_no, AVFrame *buf)
180{
181 ConcatContext *cat = ctx->priv;
182 unsigned out_no = in_no % ctx->nb_outputs;
183 AVFilterLink * inlink = ctx-> inputs[ in_no];
184 AVFilterLink *outlink = ctx->outputs[out_no];
185 struct concat_in *in = &cat->in[in_no];
186
187 buf->pts = av_rescale_q(buf->pts, inlink->time_base, outlink->time_base);
188 buf->duration = av_rescale_q(buf->duration, inlink->time_base, outlink->time_base);
189 in->pts = buf->pts;
190 in->nb_frames++;
191 /* add duration to input PTS */
192 if (inlink->sample_rate)
193 /* use number of audio samples */
194 in->pts += av_rescale_q(buf->nb_samples,
195 av_make_q(1, inlink->sample_rate),
196 outlink->time_base);
197 else if (in->nb_frames >= 2)
198 /* use mean duration */
199 in->pts = av_rescale(in->pts, in->nb_frames, in->nb_frames - 1);
200
201 buf->pts += cat->delta_ts;
202 return ff_filter_frame(outlink, buf);
203}
204
205static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
206{
207 AVFilterContext *ctx = inlink->dst;
208 unsigned in_no = FF_INLINK_IDX(inlink);
209 AVFilterLink *outlink = ctx->outputs[in_no % ctx->nb_outputs];
210
211 return ff_get_video_buffer(outlink, w, h);
212}
213
214static AVFrame *get_audio_buffer(AVFilterLink *inlink, int nb_samples)
215{
216 AVFilterContext *ctx = inlink->dst;
217 unsigned in_no = FF_INLINK_IDX(inlink);
218 AVFilterLink *outlink = ctx->outputs[in_no % ctx->nb_outputs];
219
220 return ff_get_audio_buffer(outlink, nb_samples);
221}
222
223static void close_input(AVFilterContext *ctx, unsigned in_no)
224{
225 ConcatContext *cat = ctx->priv;
226
227 cat->in[in_no].eof = 1;
228 cat->nb_in_active--;
229 av_log(ctx, AV_LOG_VERBOSE, "EOF on %s, %d streams left in segment.\n",
230 ctx->input_pads[in_no].name, cat->nb_in_active);
231}
232
234{
235 ConcatContext *cat = ctx->priv;
236 unsigned i = cat->cur_idx;
237 unsigned imax = i + ctx->nb_outputs;
238 int64_t pts;
239
240 pts = cat->in[i++].pts;
241 for (; i < imax; i++)
242 pts = FFMAX(pts, cat->in[i].pts);
243 cat->delta_ts += pts;
244 *seg_delta = pts;
245}
246
247static int send_silence(AVFilterContext *ctx, unsigned in_no, unsigned out_no,
248 int64_t seg_delta)
249{
250 ConcatContext *cat = ctx->priv;
251 AVFilterLink *outlink = ctx->outputs[out_no];
252 int64_t base_pts = cat->in[in_no].pts + cat->delta_ts - seg_delta;
253 int64_t nb_samples, sent = 0;
254 int frame_nb_samples, ret;
255 AVRational rate_tb = { 1, ctx->inputs[in_no]->sample_rate };
256 AVFrame *buf;
257
258 if (!rate_tb.den)
259 return AVERROR_BUG;
260 if (cat->in[in_no].pts < INT64_MIN + seg_delta)
261 return AVERROR_INVALIDDATA;
262 if (seg_delta < cat->in[in_no].pts)
263 return AVERROR_INVALIDDATA;
264 nb_samples = av_rescale_q(seg_delta - cat->in[in_no].pts,
265 outlink->time_base, rate_tb);
266 frame_nb_samples = FFMAX(9600, rate_tb.den / 5); /* arbitrary */
267 while (nb_samples) {
268 frame_nb_samples = FFMIN(frame_nb_samples, nb_samples);
269 buf = ff_get_audio_buffer(outlink, frame_nb_samples);
270 if (!buf)
271 return AVERROR(ENOMEM);
272 av_samples_set_silence(buf->extended_data, 0, frame_nb_samples,
273 outlink->ch_layout.nb_channels, outlink->format);
274 buf->pts = base_pts + av_rescale_q(sent, rate_tb, outlink->time_base);
275 ret = ff_filter_frame(outlink, buf);
276 if (ret < 0)
277 return ret;
278 sent += frame_nb_samples;
279 nb_samples -= frame_nb_samples;
280 }
281 return 0;
282}
283
285{
286 int ret;
287 ConcatContext *cat = ctx->priv;
288 unsigned str, str_max;
289 int64_t seg_delta;
290
291 find_next_delta_ts(ctx, &seg_delta);
292 cat->cur_idx += ctx->nb_outputs;
293 cat->nb_in_active = ctx->nb_outputs;
294 av_log(ctx, AV_LOG_VERBOSE, "Segment finished at pts=%"PRId64"\n",
295 cat->delta_ts);
296
297 if (cat->cur_idx < ctx->nb_inputs) {
298 /* pad audio streams with silence */
299 str = cat->nb_streams[AVMEDIA_TYPE_VIDEO];
300 str_max = str + cat->nb_streams[AVMEDIA_TYPE_AUDIO];
301 for (; str < str_max; str++) {
302 ret = send_silence(ctx, cat->cur_idx - ctx->nb_outputs + str, str,
303 seg_delta);
304 if (ret < 0)
305 return ret;
306 }
307 }
308 return 0;
309}
310
312{
313 ConcatContext *cat = ctx->priv;
314 unsigned seg, type, str;
315 int ret;
316
317 /* create input pads */
318 for (seg = 0; seg < cat->nb_segments; seg++) {
319 for (type = 0; type < TYPE_ALL; type++) {
320 for (str = 0; str < cat->nb_streams[type]; str++) {
321 AVFilterPad pad = {
322 .type = type,
323 };
326 else
328 pad.name = av_asprintf("in%d:%c%d", seg, "va"[type], str);
329 if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0)
330 return ret;
331 }
332 }
333 }
334 /* create output pads */
335 for (type = 0; type < TYPE_ALL; type++) {
336 for (str = 0; str < cat->nb_streams[type]; str++) {
337 AVFilterPad pad = {
338 .type = type,
339 .config_props = config_output,
340 };
341 pad.name = av_asprintf("out:%c%d", "va"[type], str);
342 if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0)
343 return ret;
344 }
345 }
346
347 cat->in = av_calloc(ctx->nb_inputs, sizeof(*cat->in));
348 if (!cat->in)
349 return AVERROR(ENOMEM);
350 cat->nb_in_active = ctx->nb_outputs;
351 return 0;
352}
353
355{
356 ConcatContext *cat = ctx->priv;
357
358 av_freep(&cat->in);
359}
360
362{
363 ConcatContext *cat = ctx->priv;
364 AVFrame *frame;
365 unsigned i, j;
366 int ret, status;
367 int64_t pts;
368
369 /* Forward status back */
370 for (i = 0; i < ctx->nb_outputs; i++) {
371 status = ff_outlink_get_status(ctx->outputs[i]);
372 if (!status)
373 continue;
374 for (j = i; j < ctx->nb_inputs; j += ctx->nb_outputs) {
375 if (!cat->in[j].eof) {
376 cat->in[j].eof = 1;
377 ff_inlink_set_status(ctx->inputs[j], status);
378 return 0;
379 }
380 }
381
382 }
383
384 /* Forward available frames */
385 if (cat->cur_idx < ctx->nb_inputs) {
386 for (i = 0; i < ctx->nb_outputs; i++) {
387 ret = ff_inlink_consume_frame(ctx->inputs[cat->cur_idx + i], &frame);
388 if (ret < 0)
389 return ret;
390 if (ret) {
392 return push_frame(ctx, cat->cur_idx + i, frame);
393 }
394 }
395 }
396
397 /* Forward status change */
398 if (cat->cur_idx < ctx->nb_inputs) {
399 for (i = 0; i < ctx->nb_outputs; i++) {
400 AVFilterLink *inlink = ctx->inputs[cat->cur_idx + i];
401
402 ret = ff_inlink_acknowledge_status(inlink, &status, &pts);
403 /* TODO use pts */
404 if (ret > 0) {
405 close_input(ctx, cat->cur_idx + i);
406 if (cat->cur_idx + ctx->nb_outputs >= ctx->nb_inputs) {
407 int64_t eof_pts = cat->delta_ts;
408
409 eof_pts += av_rescale_q(pts, inlink->time_base, ctx->outputs[i]->time_base);
410 ff_outlink_set_status(ctx->outputs[i], status, eof_pts);
411 }
412 if (!cat->nb_in_active) {
413 ret = flush_segment(ctx);
414 if (ret < 0)
415 return ret;
416 }
418 return 0;
419 }
420 }
421 }
422
423 ret = FFERROR_NOT_READY;
424 for (i = 0; i < ctx->nb_outputs; i++) {
425 if (ff_outlink_frame_wanted(ctx->outputs[i])) {
426 if (cat->in[cat->cur_idx + i].eof) {
427 for (j = 0; j < ctx->nb_outputs; j++)
428 if (!cat->in[cat->cur_idx + j].eof)
429 ff_inlink_request_frame(ctx->inputs[cat->cur_idx + j]);
430 return 0;
431 } else {
432 ff_inlink_request_frame(ctx->inputs[cat->cur_idx + i]);
433 ret = 0;
434 }
435 }
436 }
437
438 return ret;
439}
440
441static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
442 char *res, int res_len, int flags)
443{
444 int ret = AVERROR(ENOSYS);
445
446 if (!strcmp(cmd, "next")) {
447 av_log(ctx, AV_LOG_VERBOSE, "Command received: next\n");
448 return flush_segment(ctx);
449 }
450
451 return ret;
452}
453
455 .p.name = "concat",
456 .p.description = NULL_IF_CONFIG_SMALL("Concatenate audio and video streams."),
457 .p.inputs = NULL,
458 .p.outputs = NULL,
459 .p.priv_class = &concat_class,
461 .init = init,
462 .uninit = uninit,
463 .activate = activate,
464 .priv_size = sizeof(ConcatContext),
466 .process_command = process_command,
467};
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static const AVFilterPad inputs[]
Definition af_aap.c:299
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const FFFilter ff_avf_concat
Definition avf_concat.c:454
#define A(x)
Definition vpx_arith.h:28
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition audio.c:74
#define V
Definition avdct.c:32
static AVFrame * get_audio_buffer(AVFilterLink *inlink, int nb_samples)
Definition avf_concat.c:214
static void close_input(AVFilterContext *ctx, unsigned in_no)
Definition avf_concat.c:223
static int send_silence(AVFilterContext *ctx, unsigned in_no, unsigned out_no, int64_t seg_delta)
Definition avf_concat.c:247
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition avf_concat.c:205
static int push_frame(AVFilterContext *ctx, unsigned in_no, AVFrame *buf)
Definition avf_concat.c:179
static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
Definition avf_concat.c:233
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition avf_concat.c:75
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition avf_concat.c:441
static int activate(AVFilterContext *ctx)
Definition avf_concat.c:361
#define TYPE_ALL
Definition avf_concat.c:36
static av_cold void uninit(AVFilterContext *ctx)
Definition avf_concat.c:354
#define OFFSET(x)
Definition avf_concat.c:53
static int config_output(AVFilterLink *outlink)
Definition avf_concat.c:122
static int flush_segment(AVFilterContext *ctx)
Definition avf_concat.c:284
static const AVOption concat_options[]
Definition avf_concat.c:58
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition avfilter.c:132
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
Definition avfilter.c:1632
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition avfilter.c:1648
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:1467
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition avfilter.c:1690
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition avfilter.c:143
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition avfilter.c:229
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:1520
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition avfilter.c:1623
Main libavfilter public API header.
char * av_asprintf(const char *fmt,...)
Definition avstring.c:115
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
Public libavutil channel layout APIs header.
static const AVClass concat_class
Definition concatdec.c:946
#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 AVFrame * frame
#define F(x)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static unsigned int nb_streams
Definition ffprobe.c:352
AVFilterChannelLayouts * ff_all_channel_layouts(void)
Construct an empty AVFilterChannelLayouts/AVFilterFormats struct – representing any channel layout (w...
Definition formats.c:679
AVFilterFormats * ff_all_formats(enum AVMediaType type)
Return a list of all formats supported by FFmpeg for the given media type.
Definition formats.c:602
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add ref as a new reference to formats.
Definition formats.c:756
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition formats.c:751
AVFilterFormats * ff_all_samplerates(void)
Definition formats.c:673
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition avfilter.h:161
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition avfilter.h:155
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR(e)
Definition error.h:45
#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 AVRational av_make_q(int num, int den)
Create an AVRational.
Definition rational.h:71
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
int av_samples_set_silence(uint8_t *const *audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
Definition samplefmt.c:246
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition avutil.h:263
cl_device_type type
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
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
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define FF_INLINK_IDX(link)
Find the index of a link.
Definition filters.h:215
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define FF_OUTLINK_IDX(link)
Definition filters.h:216
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:264
Memory handling functions.
enum MovChannelLayoutTag * layouts
Definition mov_chan.c:335
AVOptions.
formats
Definition signature.h:47
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:273
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
AVFrame *(* audio)(AVFilterLink *link, int nb_samples)
Definition filters.h:82
AVFrame *(* video)(AVFilterLink *link, int w, int h)
Definition filters.h:81
union AVFilterPad::@363170257351226013155122005037023043242205350137 get_buffer
Callback functions to get a video/audio buffers.
const char * name
Pad name.
Definition filters.h:46
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int nb_samples
number of audio samples (per channel) described by this frame
Definition frame.h:552
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
int64_t duration
Duration of the frame, in the same units as pts.
Definition frame.h:820
uint8_t ** extended_data
pointers to the data planes/channels.
Definition frame.h:533
AVOption.
Definition opt.h:428
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
int64_t delta_ts
timestamp to add to produce output timestamps
Definition avf_concat.c:43
struct ConcatContext::concat_in * in
unsigned nb_streams[TYPE_ALL]
number of out streams of each type
Definition avf_concat.c:40
unsigned unsafe
Definition avf_concat.c:45
unsigned cur_idx
index of the first input of current segment
Definition avf_concat.c:42
unsigned nb_segments
Definition avf_concat.c:41
unsigned nb_in_active
number of active inputs in current segment
Definition avf_concat.c:44
#define av_freep(p)
#define av_log(a,...)
static int imax(const int a, const int b)
Definition internal.h:177
static AVFormatContext * ctx
Definition movenc.c:49
static const int rates[]
Definition swresample.c:99
static int64_t pts
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89
#define cat(a, bpp, b)
Definition vp9dsp_init.h:32