FFmpeg
Loading...
Searching...
No Matches
options.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
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#include "avformat.h"
21#include "avformat_internal.h"
22#include "avio_internal.h"
23#include "demux.h"
24#include "internal.h"
25
26#include "libavcodec/avcodec.h"
28
30#include "libavutil/avassert.h"
31#include "libavutil/iamf.h"
32#include "libavutil/internal.h"
33#include "libavutil/intmath.h"
34#include "libavutil/mem.h"
35#include "libavutil/opt.h"
36
37/**
38 * @file
39 * Options definition for AVFormatContext.
40 */
41
43#include "options_table.h"
45
46static const char* format_to_name(void* ptr)
47{
49 if (fc->name) return fc->name;
50 else if(fc->iformat) return fc->iformat->name;
51 else if(fc->oformat) return fc->oformat->name;
52 else return fc->av_class->class_name;
53}
54
55static void *format_child_next(void *obj, void *prev)
56{
57 AVFormatContext *s = obj;
58 if (!prev && s->priv_data &&
59 ((s->iformat && s->iformat->priv_class) ||
60 s->oformat && s->oformat->priv_class))
61 return s->priv_data;
62 if (s->pb && s->pb->av_class && prev != s->pb)
63 return s->pb;
64 return NULL;
65}
66
67enum {
72
73};
74
75#define ITER_STATE_SHIFT 16
76
77static const AVClass *format_child_class_iterate(void **iter)
78{
79 // we use the low 16 bits of iter as the value to be passed to
80 // av_(de)muxer_iterate()
81 void *val = (void*)(((uintptr_t)*iter) & ((1 << ITER_STATE_SHIFT) - 1));
82 unsigned int state = ((uintptr_t)*iter) >> ITER_STATE_SHIFT;
83 const AVClass *ret = NULL;
84
86 ret = &ff_avio_class;
87 state++;
88 goto finish;
89 }
90
92 const AVOutputFormat *ofmt;
93
94 while ((ofmt = av_muxer_iterate(&val))) {
95 ret = ofmt->priv_class;
96 if (ret)
97 goto finish;
98 }
99
100 val = NULL;
101 state++;
102 }
103
105 const AVInputFormat *ifmt;
106
107 while ((ifmt = av_demuxer_iterate(&val))) {
108 ret = ifmt->priv_class;
109 if (ret)
110 goto finish;
111 }
112 val = NULL;
113 state++;
114 }
115
116finish:
117 // make sure none av_(de)muxer_iterate does not set the high bits of val
118 av_assert0(!((uintptr_t)val >> ITER_STATE_SHIFT));
119 *iter = (void*)((uintptr_t)val | (state << ITER_STATE_SHIFT));
120 return ret;
121}
122
124{
125 AVFormatContext* s = ptr;
126 if(s->iformat) return AV_CLASS_CATEGORY_DEMUXER;
127 else return AV_CLASS_CATEGORY_MUXER;
128}
129
131 .class_name = "AVFormatContext",
132 .item_name = format_to_name,
133 .option = avformat_options,
134 .version = LIBAVUTIL_VERSION_INT,
135 .child_next = format_child_next,
136 .child_class_iterate = format_child_class_iterate,
137 .category = AV_CLASS_CATEGORY_MUXER,
138 .get_category = get_category,
139};
140
142 const char *url, int flags, AVDictionary **options)
143{
144 int loglevel;
145
146 if (!strcmp(url, s->url) ||
147 s->iformat && !strcmp(s->iformat->name, "image2") ||
148 s->oformat && !strcmp(s->oformat->name, "image2")
149 ) {
150 loglevel = AV_LOG_DEBUG;
151 } else
152 loglevel = AV_LOG_INFO;
153
154 av_log(s, loglevel, "Opening \'%s\' for %s\n", url, flags & AVIO_FLAG_WRITE ? "writing" : "reading");
155
156 return ffio_open_whitelist2(pb, url, flags, &s->interrupt_callback, options,
157 s->protocol_whitelist, s->protocol_blacklist, s);
158}
159
161{
162 return avio_close(pb);
163}
164
166{
168 FFFormatContext *si;
170
171 fci = av_mallocz(sizeof(*fci));
172 if (!fci)
173 return NULL;
174
175 si = &fci->fc;
176 s = &si->pub;
177 s->av_class = &av_format_context_class;
178 s->io_open = io_open_default;
179 s->io_close2= io_close2_default;
180
182
183 si->pkt = av_packet_alloc();
185 if (!si->pkt || !si->parse_pkt) {
187 return NULL;
188 }
189
190 return s;
191}
192
194{
196}
197
198#define DISPOSITION_OPT(ctx) \
199 { "disposition", NULL, offsetof(ctx, disposition), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, \
200 .flags = AV_OPT_FLAG_ENCODING_PARAM, .unit = "disposition" }, \
201 { "default", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEFAULT }, .unit = "disposition" }, \
202 { "dub", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DUB }, .unit = "disposition" }, \
203 { "original", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ORIGINAL }, .unit = "disposition" }, \
204 { "comment", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_COMMENT }, .unit = "disposition" }, \
205 { "lyrics", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_LYRICS }, .unit = "disposition" }, \
206 { "karaoke", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_KARAOKE }, .unit = "disposition" }, \
207 { "forced", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_FORCED }, .unit = "disposition" }, \
208 { "hearing_impaired", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "disposition" }, \
209 { "visual_impaired", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "disposition" }, \
210 { "clean_effects", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "disposition" }, \
211 { "attached_pic", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ATTACHED_PIC }, .unit = "disposition" }, \
212 { "timed_thumbnails", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_TIMED_THUMBNAILS }, .unit = "disposition" }, \
213 { "non_diegetic", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_NON_DIEGETIC }, .unit = "disposition" }, \
214 { "captions", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CAPTIONS }, .unit = "disposition" }, \
215 { "descriptions", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DESCRIPTIONS }, .unit = "disposition" }, \
216 { "metadata", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_METADATA }, .unit = "disposition" }, \
217 { "dependent", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEPENDENT }, .unit = "disposition" }, \
218 { "still_image", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_STILL_IMAGE }, .unit = "disposition" }, \
219 { "multilayer", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_MULTILAYER }, .unit = "disposition" }
220
221static const AVOption stream_options[] = {
223 { "discard", NULL, offsetof(AVStream, discard), AV_OPT_TYPE_INT, { .i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX,
224 .flags = AV_OPT_FLAG_DECODING_PARAM, .unit = "avdiscard" },
225 { "none", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONE }, .unit = "avdiscard" },
226 { "default", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_DEFAULT }, .unit = "avdiscard" },
227 { "noref", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONREF }, .unit = "avdiscard" },
228 { "bidir", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_BIDIR }, .unit = "avdiscard" },
229 { "nointra", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONINTRA }, .unit = "avdiscard" },
230 { "nokey", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONKEY }, .unit = "avdiscard" },
231 { "all", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_ALL }, .unit = "avdiscard" },
232 { NULL }
233};
234
235static const AVClass stream_class = {
236 .class_name = "AVStream",
237 .item_name = av_default_item_name,
238 .version = LIBAVUTIL_VERSION_INT,
239 .option = stream_options,
240};
241
243{
244 return &stream_class;
245}
246
248{
249 FFStream *sti;
250 AVStream *st;
251 AVStream **streams;
252
253 if (s->nb_streams >= s->max_streams) {
254 av_log(s, AV_LOG_ERROR, "Number of streams exceeds max_streams parameter"
255 " (%d), see the documentation if you wish to increase it\n",
256 s->max_streams);
257 return NULL;
258 }
259 streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams));
260 if (!streams)
261 return NULL;
262 s->streams = streams;
263
264 sti = av_mallocz(sizeof(*sti));
265 if (!sti)
266 return NULL;
267 st = &sti->pub;
268
269 st->av_class = &stream_class;
271 if (!st->codecpar)
272 goto fail;
273
274 sti->fmtctx = s;
275
276 sti->parse_pkt = av_packet_alloc();
277 if (!sti->parse_pkt)
278 goto fail;
279
280 if (s->iformat) {
282 if (!sti->avctx)
283 goto fail;
284
285 sti->info = av_mallocz(sizeof(*sti->info));
286 if (!sti->info)
287 goto fail;
288
289#if FF_API_R_FRAME_RATE
291#endif
294
295 /* default pts setting is MPEG-like */
296 avpriv_set_pts_info(st, 33, 1, 90000);
297 /* we set the current DTS to 0 so that formats without any timestamps
298 * but durations get some timestamps, formats with some unknown
299 * timestamps have their first few packets buffered and the
300 * timestamps corrected before they are returned to the user */
302 } else {
303 sti->cur_dts = AV_NOPTS_VALUE;
304 }
305
306 st->index = s->nb_streams;
310 sti->probe_packets = s->max_probe_packets;
313
316 for (int i = 0; i < MAX_REORDER_DELAY + 1; i++)
318
319 st->sample_aspect_ratio = (AVRational) { 0, 1 };
320
321 sti->need_context_update = 1;
322
323 s->streams[s->nb_streams++] = st;
324 return st;
325fail:
326 ff_free_stream(&st);
327 return NULL;
328}
329
330#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
331#define OFFSET(x) offsetof(AVStreamGroupTileGrid, x)
332static const AVOption tile_grid_options[] = {
333 { "grid_size", "size of the output canvas", OFFSET(coded_width),
334 AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
335 { "output_size", "size of valid pixels in output image meant for presentation", OFFSET(width),
336 AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
337 { "background_color", "set a background color for unused pixels",
338 OFFSET(background), AV_OPT_TYPE_COLOR, { .str = "black"}, 0, 0, FLAGS },
339 { "horizontal_offset", NULL, OFFSET(horizontal_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
340 { "vertical_offset", NULL, OFFSET(vertical_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
341 { NULL },
342};
343#undef OFFSET
344
345static const AVClass tile_grid_class = {
346 .class_name = "AVStreamGroupTileGrid",
347 .version = LIBAVUTIL_VERSION_INT,
348 .option = tile_grid_options,
349};
350
351#define OFFSET(x) offsetof(AVStreamGroupTREF, x)
352static const AVOption tref_options[] = {
353 { "metadata_index", "Index of the data stream within the group", OFFSET(metadata_index),
354 AV_OPT_TYPE_UINT, { .i64 = 0 }, 0, UINT_MAX, FLAGS },
355 { NULL },
356};
357#undef OFFSET
358
359static const AVClass tref_class = {
360 .class_name = "AVStreamGroupTREF",
361 .version = LIBAVUTIL_VERSION_INT,
362 .option = tref_options,
363};
364
365#if FF_API_LCEVC_STRUCT
367#endif
368#define OFFSET(x) offsetof(AVStreamGroupLayeredVideo, x)
370#if FF_API_LCEVC_STRUCT
371 { "lcevc_index", "Index of the LCEVC stream within the group", OFFSET(lcevc_index),
372 AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS | AV_OPT_FLAG_DEPRECATED },
373#endif
374 { "el_index", "Index of the enhancement layer stream within the group", OFFSET(el_index),
375 AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
376 { "video_size", "size of the final layered video presentation", OFFSET(width),
377 AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
378 { NULL },
379};
380#if FF_API_LCEVC_STRUCT
382#endif
383#undef OFFSET
384
386 .class_name = "AVStreamGroupLayeredVideo",
387 .version = LIBAVUTIL_VERSION_INT,
388 .option = layered_video_options,
389};
390
391static void *stream_group_child_next(void *obj, void *prev)
392{
393 AVStreamGroup *stg = obj;
394 if (!prev) {
395 switch(stg->type) {
397 return stg->params.iamf_audio_element;
399 return stg->params.iamf_mix_presentation;
401 return stg->params.tile_grid;
403 return stg->params.tref;
406 return stg->params.layered_video;
407 default:
408 break;
409 }
410 }
411 return NULL;
412}
413
414#undef FLAGS
415
416static const AVClass *stream_group_child_iterate(void **opaque)
417{
418 uintptr_t i = (uintptr_t)*opaque;
419 const AVClass *ret = NULL;
420
421 switch(i) {
423 i++;
427 break;
430 break;
432 ret = &tile_grid_class;
433 break;
435 ret = &tref_class;
436 break;
439 ret = &layered_video_class;
440 break;
441 default:
442 break;
443 }
444
445 if (ret)
446 *opaque = (void*)(i + 1);
447 return ret;
448}
449
452 {"id", "Set group id", offsetof(AVStreamGroup, id), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM },
453 { NULL }
454};
455
457 .class_name = "AVStreamGroup",
458 .item_name = av_default_item_name,
459 .version = LIBAVUTIL_VERSION_INT,
460 .option = stream_group_options,
461 .child_next = stream_group_child_next,
462 .child_class_iterate = stream_group_child_iterate,
463};
464
466{
467 return &stream_group_class;
468}
469
473{
474 AVStreamGroup **stream_groups;
475 AVStreamGroup *stg;
476 FFStreamGroup *stgi;
477
478 stream_groups = av_realloc_array(s->stream_groups, s->nb_stream_groups + 1,
479 sizeof(*stream_groups));
480 if (!stream_groups)
481 return NULL;
482 s->stream_groups = stream_groups;
483
484 stgi = av_mallocz(sizeof(*stgi));
485 if (!stgi)
486 return NULL;
487 stg = &stgi->pub;
488
491 stg->type = type;
492 switch (type) {
495 if (!stg->params.iamf_audio_element)
496 goto fail;
497 break;
501 goto fail;
502 break;
504 stg->params.tile_grid = av_mallocz(sizeof(*stg->params.tile_grid));
505 if (!stg->params.tile_grid)
506 goto fail;
509 break;
511 stg->params.tref = av_mallocz(sizeof(*stg->params.tref));
512 if (!stg->params.tref)
513 goto fail;
516 break;
519 stg->params.layered_video = av_mallocz(sizeof(*stg->params.layered_video));
520 if (!stg->params.layered_video)
521 goto fail;
524 break;
525 default:
526 goto fail;
527 }
528
529 if (options) {
531 goto fail;
532 }
533
534 stgi->fmtctx = s;
535 stg->index = s->nb_stream_groups;
536
537 s->stream_groups[s->nb_stream_groups++] = stg;
538
539 return stg;
540fail:
542 return NULL;
543}
544
546{
547 AVStream **streams = av_realloc_array(stg->streams, stg->nb_streams + 1,
548 sizeof(*stg->streams));
549 if (!streams)
550 return AVERROR(ENOMEM);
551
552 stg->streams = streams;
553 stg->streams[stg->nb_streams++] = st;
554
555 return 0;
556}
557
559{
560 const FFStreamGroup *stgi = cffstreamgroup(stg);
561 const FFStream *sti = cffstream(st);
562
563 if (stgi->fmtctx != sti->fmtctx)
564 return AVERROR(EINVAL);
565
566 for (int i = 0; i < stg->nb_streams; i++)
567 if (stg->streams[i]->index == st->index)
568 return AVERROR(EEXIST);
569
570 return stream_group_add_stream(stg, st);
571}
572
573static int option_is_disposition(const AVOption *opt)
574{
575 return opt->type == AV_OPT_TYPE_CONST &&
576 opt->unit && !strcmp(opt->unit, "disposition");
577}
578
579int av_disposition_from_string(const char *disp)
580{
581 for (const AVOption *opt = stream_options; opt->name; opt++)
582 if (option_is_disposition(opt) && !strcmp(disp, opt->name))
583 return opt->default_val.i64;
584 return AVERROR(EINVAL);
585}
586
587const char *av_disposition_to_string(int disposition)
588{
589 int val;
590
591 if (disposition <= 0)
592 return NULL;
593
594 val = 1 << ff_ctz(disposition);
595 for (const AVOption *opt = stream_options; opt->name; opt++)
596 if (option_is_disposition(opt) && opt->default_val.i64 == val)
597 return opt->name;
598
599 return NULL;
600}
static double val(void *priv, double ch)
Definition aeval.c:77
static void finish(void)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
Libavcodec external API header.
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition avformat.c:834
void ff_free_stream(AVStream **pst)
Frees a stream without modifying the corresponding AVFormatContext.
Definition avformat.c:47
void ff_free_stream_group(AVStreamGroup **pstg)
Frees a stream group without modifying the corresponding AVFormatContext.
Definition avformat.c:80
Main libavformat public API header.
#define AV_PTS_WRAP_IGNORE
Options for behavior on timestamp wrap detection.
Definition avformat.h:755
AVStreamGroupParamsType
Definition avformat.h:1146
@ AV_STREAM_GROUP_PARAMS_DOLBY_VISION
Definition avformat.h:1153
@ AV_STREAM_GROUP_PARAMS_TREF
Definition avformat.h:1152
@ AV_STREAM_GROUP_PARAMS_NONE
Definition avformat.h:1147
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition avformat.h:1149
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition avformat.h:1150
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition avformat.h:1148
@ AV_STREAM_GROUP_PARAMS_LCEVC
Definition avformat.h:1151
#define RELATIVE_TS_BASE
static av_always_inline const FFStreamGroup * cffstreamgroup(const AVStreamGroup *stg)
int ffio_open_whitelist2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, AVFormatContext *avfc)
Like ffio_open_whitelist(), but additionally records avfc on the underlying URLContext before it is c...
Definition avio.c:529
const AVClass ff_avio_class
Definition avio.c:103
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
Definition avio.c:684
#define AVIO_FLAG_WRITE
write-only
Definition avio.h:618
#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
#define FLAGS
Definition cmdutils.c:598
AVCodecParameters * avcodec_parameters_alloc(void)
Definition codec_par.c:57
#define NULL
Definition coverity.c:32
static const uint16_t fc[]
Definition dcaenc.h:43
static struct @346255127015250356166251341105367306144006377143 state
#define fail
Definition test.h:479
#define AV_OPT_FLAG_DEPRECATED
Set if option is deprecated, users should refer to AVOption.help text for more information.
Definition opt.h:385
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition opt.h:355
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition opt.h:351
@ 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_INT64
Underlying C type is int64_t.
Definition opt.h:262
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
Definition opt.h:322
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
Definition opt.h:334
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition options.c:149
@ AVDISCARD_ALL
discard all
Definition defs.h:232
@ AVDISCARD_NONKEY
discard all frames except keyframes
Definition defs.h:231
@ AVDISCARD_BIDIR
discard all bidirectional frames
Definition defs.h:229
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
Definition defs.h:227
@ AVDISCARD_NONE
discard nothing
Definition defs.h:226
@ AVDISCARD_NONINTRA
discard all non intra frames
Definition defs.h:230
@ AVDISCARD_NONREF
discard all non reference
Definition defs.h:228
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition packet.c:63
const AVClass * av_stream_group_get_class(void)
Get the AVClass for AVStreamGroup.
Definition options.c:465
AVStreamGroup * avformat_stream_group_create(AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
Add a new empty stream group to a media file.
Definition options.c:470
const AVClass * av_stream_get_class(void)
Get the AVClass for AVStream.
Definition options.c:242
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Add an already allocated stream to a stream group.
Definition options.c:558
const AVOutputFormat * av_muxer_iterate(void **opaque)
Iterate over all registered muxers.
Definition allformats.c:597
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
Definition options.c:165
const AVInputFormat * av_demuxer_iterate(void **opaque)
Iterate over all registered demuxers.
Definition allformats.c:618
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
Definition avformat.c:150
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition options.c:193
#define AVERROR(e)
Definition error.h:45
const AVClass * av_iamf_audio_element_get_class(void)
Definition iamf.c:319
AVIAMFAudioElement * av_iamf_audio_element_alloc(void)
Allocates a AVIAMFAudioElement, and initializes its fields with default values.
Definition iamf.c:324
AVIAMFMixPresentation * av_iamf_mix_presentation_alloc(void)
Allocates a AVIAMFMixPresentation, and initializes its fields with default values.
Definition iamf.c:522
const AVClass * av_iamf_mix_presentation_get_class(void)
Definition iamf.c:517
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define ff_ctz
Definition intmath.h:105
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition mem.c:217
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition opt.h:604
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition opt.c:1756
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
Definition opt.c:2040
#define MAX_REORDER_DELAY
cl_device_type type
static AVClassCategory get_category(void *ptr)
Definition options.c:69
static av_always_inline const FFStream * cffstream(const AVStream *st)
Definition internal.h:370
static const AVClass stream_group_class
Definition options.c:456
static int io_close2_default(AVFormatContext *s, AVIOContext *pb)
Definition options.c:160
static const AVOption stream_options[]
Definition options.c:221
#define DISPOSITION_OPT(ctx)
Definition options.c:198
#define ITER_STATE_SHIFT
Definition options.c:75
static const AVOption stream_group_options[]
Definition options.c:450
static const AVClass * format_child_class_iterate(void **iter)
Definition options.c:77
static const AVOption layered_video_options[]
Definition options.c:369
@ CHILD_CLASS_ITER_MUX
Definition options.c:69
@ CHILD_CLASS_ITER_AVIO
Definition options.c:68
@ CHILD_CLASS_ITER_DONE
Definition options.c:71
@ CHILD_CLASS_ITER_DEMUX
Definition options.c:70
static const AVClass av_format_context_class
Definition options.c:130
static void * format_child_next(void *obj, void *prev)
Definition options.c:55
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Definition options.c:247
static const AVOption tile_grid_options[]
Definition options.c:332
const char * av_disposition_to_string(int disposition)
Definition options.c:587
static const AVClass layered_video_class
Definition options.c:385
static int stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Definition options.c:545
int av_disposition_from_string(const char *disp)
Definition options.c:579
static int io_open_default(AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
Definition options.c:141
static const AVClass stream_class
Definition options.c:235
FF_DISABLE_DEPRECATION_WARNINGS static FF_ENABLE_DEPRECATION_WARNINGS const char * format_to_name(void *ptr)
Definition options.c:46
static int option_is_disposition(const AVOption *opt)
Definition options.c:573
#define OFFSET(x)
Definition options.c:331
static const AVClass tile_grid_class
Definition options.c:345
static const AVOption tref_options[]
Definition options.c:352
static void * stream_group_child_next(void *obj, void *prev)
Definition options.c:391
static const AVClass tref_class
Definition options.c:359
static const AVClass * stream_group_child_iterate(void **opaque)
Definition options.c:416
static const AVOption avformat_options[]
Macro definitions for various function/variable attributes.
#define av_fallthrough
Definition attributes.h:67
Immersive Audio Model and Formats API header.
common internal API header
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition internal.h:66
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition internal.h:67
AVClassCategory
Definition log.h:28
@ AV_CLASS_CATEGORY_MUXER
Definition log.h:32
@ AV_CLASS_CATEGORY_DEMUXER
Definition log.h:33
Memory handling functions.
AVOptions.
Describe the class of an AVClass context structure.
Definition log.h:76
AVCodec.
Definition codec.h:175
Format I/O context.
Definition avformat.h:1333
Bytestream IO Context.
Definition avio.h:160
const AVClass * priv_class
AVClass for the private context.
Definition avformat.h:596
AVOption.
Definition opt.h:428
const char * unit
The logical unit to which the option belongs.
Definition opt.h:478
enum AVOptionType type
Definition opt.h:444
const AVClass * priv_class
AVClass for the private context.
Definition avformat.h:555
Rational number (pair of numerator and denominator).
Definition rational.h:58
const AVClass * av_class
Definition avformat.h:1094
const AVClass * av_class
Definition avformat.h:1138
const AVClass * av_class
Definition avformat.h:974
union AVStreamGroup::@166361102046003066253145020066347265153020354020 params
Group type-specific parameters.
enum AVStreamGroupParamsType type
Group type.
Definition avformat.h:1186
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition avformat.h:1193
struct AVStreamGroupTileGrid * tile_grid
Definition avformat.h:1194
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
Definition avformat.h:1221
struct AVStreamGroupTREF * tref
Definition avformat.h:1203
unsigned int index
Group index in AVFormatContext.
Definition avformat.h:1170
struct AVIAMFAudioElement * iamf_audio_element
Definition avformat.h:1192
AVStream ** streams
A list of streams in the group.
Definition avformat.h:1234
struct AVStreamGroupLayeredVideo * layered_video
Definition avformat.h:1195
const AVClass * av_class
A class for AVOptions.
Definition avformat.h:1163
Stream structure.
Definition avformat.h:766
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:789
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition avformat.h:844
const AVClass * av_class
A class for AVOptions.
Definition avformat.h:770
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition avformat.h:825
int index
stream index in AVFormatContext
Definition avformat.h:772
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition avformat.h:815
AVFormatContext pub
The public context.
Definition internal.h:68
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
Definition internal.h:104
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
Definition internal.h:111
AVFormatContext * fmtctx
AVStreamGroup pub
The public context.
int64_t fps_first_dts
Those are used for average framerate estimation.
Definition demux.h:214
int64_t last_dts
Definition demux.h:193
int64_t fps_last_dts
Definition demux.h:216
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
Definition internal.h:262
int probe_packets
Number of packets to buffer for codec probing.
Definition internal.h:318
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition internal.h:163
int64_t cur_dts
Definition internal.h:360
int64_t pts_buffer[MAX_REORDER_DELAY+1]
Definition internal.h:289
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
Definition internal.h:294
AVFormatContext * fmtctx
Definition internal.h:141
AVStream pub
The public context.
Definition internal.h:139
int64_t first_dts
Timestamp corresponding to the last dts sync point.
Definition internal.h:359
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
Definition internal.h:274
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
Definition internal.h:180
struct FFStreamInfo * info
Stream information used internally by avformat_find_stream_info()
Definition internal.h:189
int64_t last_IP_pts
Definition internal.h:312
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
Definition internal.h:337
#define av_mallocz(s)
#define av_log(a,...)
#define width
Definition dsp.h:89
static double c[64]