FFmpeg
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 "avio_internal.h"
22 #include "demux.h"
23 #include "internal.h"
24 
25 #include "libavcodec/avcodec.h"
26 #include "libavcodec/codec_par.h"
27 
28 #include "libavutil/avassert.h"
29 #include "libavutil/iamf.h"
30 #include "libavutil/internal.h"
31 #include "libavutil/intmath.h"
32 #include "libavutil/opt.h"
33 
34 /**
35  * @file
36  * Options definition for AVFormatContext.
37  */
38 
40 #include "options_table.h"
42 
43 static const char* format_to_name(void* ptr)
44 {
46  if(fc->iformat) return fc->iformat->name;
47  else if(fc->oformat) return fc->oformat->name;
48  else return fc->av_class->class_name;
49 }
50 
51 static void *format_child_next(void *obj, void *prev)
52 {
53  AVFormatContext *s = obj;
54  if (!prev && s->priv_data &&
55  ((s->iformat && s->iformat->priv_class) ||
56  s->oformat && s->oformat->priv_class))
57  return s->priv_data;
58  if (s->pb && s->pb->av_class && prev != s->pb)
59  return s->pb;
60  return NULL;
61 }
62 
63 enum {
68 
69 };
70 
71 #define ITER_STATE_SHIFT 16
72 
73 static const AVClass *format_child_class_iterate(void **iter)
74 {
75  // we use the low 16 bits of iter as the value to be passed to
76  // av_(de)muxer_iterate()
77  void *val = (void*)(((uintptr_t)*iter) & ((1 << ITER_STATE_SHIFT) - 1));
78  unsigned int state = ((uintptr_t)*iter) >> ITER_STATE_SHIFT;
79  const AVClass *ret = NULL;
80 
82  ret = &ff_avio_class;
83  state++;
84  goto finish;
85  }
86 
87  if (state == CHILD_CLASS_ITER_MUX) {
88  const AVOutputFormat *ofmt;
89 
90  while ((ofmt = av_muxer_iterate(&val))) {
91  ret = ofmt->priv_class;
92  if (ret)
93  goto finish;
94  }
95 
96  val = NULL;
97  state++;
98  }
99 
100  if (state == CHILD_CLASS_ITER_DEMUX) {
101  const AVInputFormat *ifmt;
102 
103  while ((ifmt = av_demuxer_iterate(&val))) {
104  ret = ifmt->priv_class;
105  if (ret)
106  goto finish;
107  }
108  val = NULL;
109  state++;
110  }
111 
112 finish:
113  // make sure none av_(de)muxer_iterate does not set the high bits of val
114  av_assert0(!((uintptr_t)val >> ITER_STATE_SHIFT));
115  *iter = (void*)((uintptr_t)val | (state << ITER_STATE_SHIFT));
116  return ret;
117 }
118 
119 static AVClassCategory get_category(void *ptr)
120 {
121  AVFormatContext* s = ptr;
122  if(s->iformat) return AV_CLASS_CATEGORY_DEMUXER;
123  else return AV_CLASS_CATEGORY_MUXER;
124 }
125 
127  .class_name = "AVFormatContext",
128  .item_name = format_to_name,
129  .option = avformat_options,
130  .version = LIBAVUTIL_VERSION_INT,
131  .child_next = format_child_next,
132  .child_class_iterate = format_child_class_iterate,
134  .get_category = get_category,
135 };
136 
138  const char *url, int flags, AVDictionary **options)
139 {
140  int loglevel;
141 
142  if (!strcmp(url, s->url) ||
143  s->iformat && !strcmp(s->iformat->name, "image2") ||
144  s->oformat && !strcmp(s->oformat->name, "image2")
145  ) {
146  loglevel = AV_LOG_DEBUG;
147  } else
148  loglevel = AV_LOG_INFO;
149 
150  av_log(s, loglevel, "Opening \'%s\' for %s\n", url, flags & AVIO_FLAG_WRITE ? "writing" : "reading");
151 
152  return ffio_open_whitelist(pb, url, flags, &s->interrupt_callback, options, s->protocol_whitelist, s->protocol_blacklist);
153 }
154 
155 #if FF_API_AVFORMAT_IO_CLOSE
157 {
158  avio_close(pb);
159 }
160 #endif
161 
163 {
164  return avio_close(pb);
165 }
166 
168 {
169  FFFormatContext *const si = av_mallocz(sizeof(*si));
171 
172  if (!si)
173  return NULL;
174 
175  s = &si->pub;
176  s->av_class = &av_format_context_class;
177  s->io_open = io_open_default;
178 #if FF_API_AVFORMAT_IO_CLOSE
180  s->io_close = ff_format_io_close_default;
182 #endif
183  s->io_close2= io_close2_default;
184 
186 
187  si->pkt = av_packet_alloc();
188  si->parse_pkt = av_packet_alloc();
189  if (!si->pkt || !si->parse_pkt) {
191  return NULL;
192  }
193 
194 #if FF_API_LAVF_SHORTEST
195  si->shortest_end = AV_NOPTS_VALUE;
196 #endif
197 
198  return s;
199 }
200 
202 {
204 }
205 
207 {
208  return &av_format_context_class;
209 }
210 
211 #define DISPOSITION_OPT(ctx) \
212  { "disposition", NULL, offsetof(ctx, disposition), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, \
213  .flags = AV_OPT_FLAG_ENCODING_PARAM, .unit = "disposition" }, \
214  { "default", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEFAULT }, .unit = "disposition" }, \
215  { "dub", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DUB }, .unit = "disposition" }, \
216  { "original", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ORIGINAL }, .unit = "disposition" }, \
217  { "comment", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_COMMENT }, .unit = "disposition" }, \
218  { "lyrics", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_LYRICS }, .unit = "disposition" }, \
219  { "karaoke", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_KARAOKE }, .unit = "disposition" }, \
220  { "forced", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_FORCED }, .unit = "disposition" }, \
221  { "hearing_impaired", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "disposition" }, \
222  { "visual_impaired", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "disposition" }, \
223  { "clean_effects", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "disposition" }, \
224  { "attached_pic", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ATTACHED_PIC }, .unit = "disposition" }, \
225  { "timed_thumbnails", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_TIMED_THUMBNAILS }, .unit = "disposition" }, \
226  { "non_diegetic", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_NON_DIEGETIC }, .unit = "disposition" }, \
227  { "captions", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CAPTIONS }, .unit = "disposition" }, \
228  { "descriptions", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DESCRIPTIONS }, .unit = "disposition" }, \
229  { "metadata", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_METADATA }, .unit = "disposition" }, \
230  { "dependent", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEPENDENT }, .unit = "disposition" }, \
231  { "still_image", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_STILL_IMAGE }, .unit = "disposition" }
232 
233 static const AVOption stream_options[] = {
235  { "discard", NULL, offsetof(AVStream, discard), AV_OPT_TYPE_INT, { .i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX,
236  .flags = AV_OPT_FLAG_DECODING_PARAM, .unit = "avdiscard" },
237  { "none", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONE }, .unit = "avdiscard" },
238  { "default", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_DEFAULT }, .unit = "avdiscard" },
239  { "noref", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONREF }, .unit = "avdiscard" },
240  { "bidir", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_BIDIR }, .unit = "avdiscard" },
241  { "nointra", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONINTRA }, .unit = "avdiscard" },
242  { "nokey", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONKEY }, .unit = "avdiscard" },
243  { "all", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_ALL }, .unit = "avdiscard" },
244  { NULL }
245 };
246 
247 static const AVClass stream_class = {
248  .class_name = "AVStream",
249  .item_name = av_default_item_name,
250  .version = LIBAVUTIL_VERSION_INT,
251  .option = stream_options,
252 };
253 
255 {
256  return &stream_class;
257 }
258 
260 {
261  FFFormatContext *const si = ffformatcontext(s);
262  FFStream *sti;
263  AVStream *st;
264  AVStream **streams;
265 
266  if (s->nb_streams >= s->max_streams) {
267  av_log(s, AV_LOG_ERROR, "Number of streams exceeds max_streams parameter"
268  " (%d), see the documentation if you wish to increase it\n",
269  s->max_streams);
270  return NULL;
271  }
272  streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams));
273  if (!streams)
274  return NULL;
275  s->streams = streams;
276 
277  sti = av_mallocz(sizeof(*sti));
278  if (!sti)
279  return NULL;
280  st = &sti->pub;
281 
282  st->av_class = &stream_class;
284  if (!st->codecpar)
285  goto fail;
286 
287  sti->fmtctx = s;
288 
289  if (s->iformat) {
291  if (!sti->avctx)
292  goto fail;
293 
294  sti->info = av_mallocz(sizeof(*sti->info));
295  if (!sti->info)
296  goto fail;
297 
298 #if FF_API_R_FRAME_RATE
299  sti->info->last_dts = AV_NOPTS_VALUE;
300 #endif
303 
304  /* default pts setting is MPEG-like */
305  avpriv_set_pts_info(st, 33, 1, 90000);
306  /* we set the current DTS to 0 so that formats without any timestamps
307  * but durations get some timestamps, formats with some unknown
308  * timestamps have their first few packets buffered and the
309  * timestamps corrected before they are returned to the user */
310  sti->cur_dts = RELATIVE_TS_BASE;
311  } else {
312  sti->cur_dts = AV_NOPTS_VALUE;
313  }
314 
315  st->index = s->nb_streams;
317  st->duration = AV_NOPTS_VALUE;
318  sti->first_dts = AV_NOPTS_VALUE;
319  sti->probe_packets = s->max_probe_packets;
322 
325  for (int i = 0; i < MAX_REORDER_DELAY + 1; i++)
326  sti->pts_buffer[i] = AV_NOPTS_VALUE;
327 
328  st->sample_aspect_ratio = (AVRational) { 0, 1 };
329  sti->transferred_mux_tb = (AVRational) { 0, 1 };;
330 
331 #if FF_API_AVSTREAM_SIDE_DATA
332  sti->inject_global_side_data = si->inject_global_side_data;
333 #endif
334 
335  sti->need_context_update = 1;
336 
337  s->streams[s->nb_streams++] = st;
338  return st;
339 fail:
340  ff_free_stream(&st);
341  return NULL;
342 }
343 
344 #define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
345 #define OFFSET(x) offsetof(AVStreamGroupTileGrid, x)
346 static const AVOption tile_grid_options[] = {
347  { "grid_size", "size of the output canvas", OFFSET(coded_width),
348  AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
349  { "output_size", "size of valid pixels in output image meant for presentation", OFFSET(width),
350  AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
351  { "background_color", "set a background color for unused pixels",
352  OFFSET(background), AV_OPT_TYPE_COLOR, { .str = "black"}, 0, 0, FLAGS },
353  { "horizontal_offset", NULL, OFFSET(horizontal_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
354  { "vertical_offset", NULL, OFFSET(vertical_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
355  { NULL },
356 };
357 #undef FLAGS
358 #undef OFFSET
359 
360 static const AVClass tile_grid_class = {
361  .class_name = "AVStreamGroupTileGrid",
362  .version = LIBAVUTIL_VERSION_INT,
363  .option = tile_grid_options,
364 };
365 
366 static void *stream_group_child_next(void *obj, void *prev)
367 {
368  AVStreamGroup *stg = obj;
369  if (!prev) {
370  switch(stg->type) {
372  return stg->params.iamf_audio_element;
374  return stg->params.iamf_mix_presentation;
376  return stg->params.tile_grid;
377  default:
378  break;
379  }
380  }
381  return NULL;
382 }
383 
384 static const AVClass *stream_group_child_iterate(void **opaque)
385 {
386  uintptr_t i = (uintptr_t)*opaque;
387  const AVClass *ret = NULL;
388 
389  switch(i) {
391  i++;
392  // fall-through
395  break;
398  break;
400  ret = &tile_grid_class;
401  break;
402  default:
403  break;
404  }
405 
406  if (ret)
407  *opaque = (void*)(i + 1);
408  return ret;
409 }
410 
411 static const AVOption stream_group_options[] = {
413  {"id", "Set group id", offsetof(AVStreamGroup, id), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM },
414  { NULL }
415 };
416 
417 static const AVClass stream_group_class = {
418  .class_name = "AVStreamGroup",
419  .item_name = av_default_item_name,
420  .version = LIBAVUTIL_VERSION_INT,
421  .option = stream_group_options,
422  .child_next = stream_group_child_next,
423  .child_class_iterate = stream_group_child_iterate,
424 };
425 
427 {
428  return &stream_group_class;
429 }
430 
434 {
435  AVStreamGroup **stream_groups;
436  AVStreamGroup *stg;
437  FFStreamGroup *stgi;
438 
439  stream_groups = av_realloc_array(s->stream_groups, s->nb_stream_groups + 1,
440  sizeof(*stream_groups));
441  if (!stream_groups)
442  return NULL;
443  s->stream_groups = stream_groups;
444 
445  stgi = av_mallocz(sizeof(*stgi));
446  if (!stgi)
447  return NULL;
448  stg = &stgi->pub;
449 
451  av_opt_set_defaults(stg);
452  stg->type = type;
453  switch (type) {
456  if (!stg->params.iamf_audio_element)
457  goto fail;
458  break;
461  if (!stg->params.iamf_mix_presentation)
462  goto fail;
463  break;
465  stg->params.tile_grid = av_mallocz(sizeof(*stg->params.tile_grid));
466  if (!stg->params.tile_grid)
467  goto fail;
470  break;
471  default:
472  goto fail;
473  }
474 
475  if (options) {
477  goto fail;
478  }
479 
480  stgi->fmtctx = s;
481  stg->index = s->nb_stream_groups;
482 
483  s->stream_groups[s->nb_stream_groups++] = stg;
484 
485  return stg;
486 fail:
487  ff_free_stream_group(&stg);
488  return NULL;
489 }
490 
492 {
493  AVStream **streams = av_realloc_array(stg->streams, stg->nb_streams + 1,
494  sizeof(*stg->streams));
495  if (!streams)
496  return AVERROR(ENOMEM);
497 
498  stg->streams = streams;
499  stg->streams[stg->nb_streams++] = st;
500 
501  return 0;
502 }
503 
505 {
506  const FFStreamGroup *stgi = cffstreamgroup(stg);
507  const FFStream *sti = cffstream(st);
508 
509  if (stgi->fmtctx != sti->fmtctx)
510  return AVERROR(EINVAL);
511 
512  for (int i = 0; i < stg->nb_streams; i++)
513  if (stg->streams[i]->index == st->index)
514  return AVERROR(EEXIST);
515 
516  return stream_group_add_stream(stg, st);
517 }
518 
519 static int option_is_disposition(const AVOption *opt)
520 {
521  return opt->type == AV_OPT_TYPE_CONST &&
522  opt->unit && !strcmp(opt->unit, "disposition");
523 }
524 
525 int av_disposition_from_string(const char *disp)
526 {
527  for (const AVOption *opt = stream_options; opt->name; opt++)
528  if (option_is_disposition(opt) && !strcmp(disp, opt->name))
529  return opt->default_val.i64;
530  return AVERROR(EINVAL);
531 }
532 
533 const char *av_disposition_to_string(int disposition)
534 {
535  int val;
536 
537  if (disposition <= 0)
538  return NULL;
539 
540  val = 1 << ff_ctz(disposition);
541  for (const AVOption *opt = stream_options; opt->name; opt++)
542  if (option_is_disposition(opt) && opt->default_val.i64 == val)
543  return opt->name;
544 
545  return NULL;
546 }
AV_OPT_SEARCH_CHILDREN
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:459
FFStreamInfo::fps_last_dts
int64_t fps_last_dts
Definition: demux.h:54
iamf.h
AVCodec
AVCodec.
Definition: codec.h:187
AVStreamGroupParamsType
AVStreamGroupParamsType
Definition: avformat.h:1178
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
av_opt_set_defaults
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition: opt.c:1435
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVStreamGroup::tile_grid
struct AVStreamGroupTileGrid * tile_grid
Definition: avformat.h:1223
DISPOSITION_OPT
#define DISPOSITION_OPT(ctx)
Definition: options.c:211
ITER_STATE_SHIFT
#define ITER_STATE_SHIFT
Definition: options.c:71
avio_close
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
Definition: aviobuf.c:1335
FFStream::first_dts
int64_t first_dts
Timestamp corresponding to the last dts sync point.
Definition: internal.h:415
ff_ctz
#define ff_ctz
Definition: intmath.h:107
stream_group_add_stream
static int stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Definition: options.c:491
FFStream::last_IP_pts
int64_t last_IP_pts
Definition: internal.h:383
ffformatcontext
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition: internal.h:194
format_child_class_iterate
static const AVClass * format_child_class_iterate(void **iter)
Definition: options.c:73
FLAGS
#define FLAGS
Definition: options.c:344
avformat_get_class
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition: options.c:206
AVOption
AVOption.
Definition: opt.h:294
AVFormatContext::duration_estimation_method
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
Definition: avformat.h:1751
ffio_open_whitelist
int ffio_open_whitelist(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist)
Definition: aviobuf.c:1308
fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:464
ff_avio_class
const AVClass ff_avio_class
Definition: aviobuf.c:67
AVDictionary
Definition: dict.c:34
cffstream
static const av_always_inline FFStream * cffstream(const AVStream *st)
Definition: internal.h:428
FFStream::last_dts_for_order_check
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
Definition: internal.h:358
av_disposition_to_string
const char * av_disposition_to_string(int disposition)
Definition: options.c:533
stream_group_class
static const AVClass stream_group_class
Definition: options.c:417
FFStream::transferred_mux_tb
AVRational transferred_mux_tb
Definition: internal.h:420
ff_free_stream_group
void ff_free_stream_group(AVStreamGroup **pstg)
Frees a stream group without modifying the corresponding AVFormatContext.
Definition: avformat.c:83
avpriv_set_pts_info
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:843
finish
static void finish(void)
Definition: movenc.c:342
MAX_REORDER_DELAY
@ MAX_REORDER_DELAY
Definition: vaapi_encode.h:45
AVStreamGroup::av_class
const AVClass * av_class
A class for AVOptions.
Definition: avformat.h:1192
fail
#define fail()
Definition: checkasm.h:179
state
static struct @377 state
FFStreamInfo::fps_first_dts
int64_t fps_first_dts
Those are used for average framerate estimation.
Definition: demux.h:52
FFStream::avctx
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition: internal.h:227
AVDISCARD_NONE
@ AVDISCARD_NONE
discard nothing
Definition: defs.h:213
val
static double val(void *priv, double ch)
Definition: aeval.c:78
av_iamf_audio_element_alloc
AVIAMFAudioElement * av_iamf_audio_element_alloc(void)
Allocates a AVIAMFAudioElement, and initializes its fields with default values.
Definition: iamf.c:322
av_stream_group_get_class
const AVClass * av_stream_group_get_class(void)
Get the AVClass for AVStreamGroup.
Definition: options.c:426
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:900
AV_PTS_WRAP_IGNORE
#define AV_PTS_WRAP_IGNORE
Options for behavior on timestamp wrap detection.
Definition: avformat.h:830
AVStreamGroupTileGrid::av_class
const AVClass * av_class
Definition: avformat.h:1081
stream_group_child_next
static void * stream_group_child_next(void *obj, void *prev)
Definition: options.c:366
avassert.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVInputFormat
Definition: avformat.h:549
AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition: avformat.h:1181
avcodec_alloc_context3
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition: options.c:154
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:198
FFStreamInfo::last_dts
int64_t last_dts
Definition: demux.h:31
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:215
CHILD_CLASS_ITER_DEMUX
@ CHILD_CLASS_ITER_DEMUX
Definition: options.c:66
RELATIVE_TS_BASE
#define RELATIVE_TS_BASE
Definition: demux.h:64
FFStreamGroup::fmtctx
AVFormatContext * fmtctx
Definition: internal.h:439
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:226
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
AVIO_FLAG_WRITE
#define AVIO_FLAG_WRITE
write-only
Definition: avio.h:637
AVStreamGroup::index
unsigned int index
Group index in AVFormatContext.
Definition: avformat.h:1199
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AVDISCARD_BIDIR
@ AVDISCARD_BIDIR
discard all bidirectional frames
Definition: defs.h:216
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Definition: options.c:259
AV_CLASS_CATEGORY_DEMUXER
@ AV_CLASS_CATEGORY_DEMUXER
Definition: log.h:33
FFFormatContext
Definition: internal.h:70
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:219
AVFormatContext
Format I/O context.
Definition: avformat.h:1363
FFStream::pub
AVStream pub
The public context.
Definition: internal.h:203
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:864
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
avformat_options
static const AVOption avformat_options[]
Definition: options_table.h:36
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:240
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AVDurationEstimationMethod
AVDurationEstimationMethod
The duration of a video can be estimated through various ways, and this enum can be used to know how ...
Definition: avformat.h:1343
CHILD_CLASS_ITER_AVIO
@ CHILD_CLASS_ITER_AVIO
Definition: options.c:64
AVOutputFormat::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:539
stream_group_options
static const AVOption stream_group_options[]
Definition: options.c:411
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition: opt.h:251
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
format_to_name
FF_DISABLE_DEPRECATION_WARNINGS static const FF_ENABLE_DEPRECATION_WARNINGS char * format_to_name(void *ptr)
Definition: options.c:43
stream_group_child_iterate
static const AVClass * stream_group_child_iterate(void **opaque)
Definition: options.c:384
av_disposition_from_string
int av_disposition_from_string(const char *disp)
Definition: options.c:525
avformat_stream_group_add_stream
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Add an already allocated stream to a stream group.
Definition: options.c:504
AV_STREAM_GROUP_PARAMS_TILE_GRID
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition: avformat.h:1182
options
const OptionDef options[]
AVDISCARD_NONKEY
@ AVDISCARD_NONKEY
discard all frames except keyframes
Definition: defs.h:218
AVIOContext
Bytestream IO Context.
Definition: avio.h:166
FFFormatContext::parse_pkt
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
Definition: internal.h:133
avformat_alloc_context
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
Definition: options.c:167
AVDISCARD_DEFAULT
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
Definition: defs.h:214
FFStream
Definition: internal.h:199
ff_free_stream
void ff_free_stream(AVStream **pst)
Frees a stream without modifying the corresponding AVFormatContext.
Definition: avformat.c:44
AVClass::category
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
Definition: log.h:114
ff_format_io_close_default
void ff_format_io_close_default(AVFormatContext *s, AVIOContext *pb)
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
AVStreamGroup::iamf_audio_element
struct AVIAMFAudioElement * iamf_audio_element
Definition: avformat.h:1221
av_iamf_mix_presentation_alloc
AVIAMFMixPresentation * av_iamf_mix_presentation_alloc(void)
Allocates a AVIAMFMixPresentation, and initializes its fields with default values.
Definition: iamf.c:520
av_demuxer_iterate
const AVInputFormat * av_demuxer_iterate(void **opaque)
Iterate over all registered demuxers.
Definition: allformats.c:601
AVOption::name
const char * name
Definition: opt.h:295
AVStream::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:919
FFStream::pts_wrap_behavior
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
Definition: internal.h:338
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:63
cffstreamgroup
static const av_always_inline FFStreamGroup * cffstreamgroup(const AVStreamGroup *stg)
Definition: internal.h:448
AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition: avformat.h:1180
FFStream::probe_packets
int probe_packets
Number of packets to buffer for codec probing.
Definition: internal.h:389
AVStreamGroup::streams
AVStream ** streams
A list of streams in the group.
Definition: avformat.h:1254
av_fmt_ctx_get_duration_estimation_method
enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext *ctx)
Returns the method used to set ctx->duration.
Definition: options.c:201
AVStreamGroup::iamf_mix_presentation
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition: avformat.h:1222
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
av_iamf_audio_element_get_class
const AVClass * av_iamf_audio_element_get_class(void)
Definition: iamf.c:317
avcodec_parameters_alloc
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
Definition: codec_par.c:56
get_category
static AVClassCategory get_category(void *ptr)
Definition: options.c:119
CHILD_CLASS_ITER_MUX
@ CHILD_CLASS_ITER_MUX
Definition: options.c:65
OFFSET
#define OFFSET(x)
Definition: options.c:345
AVClassCategory
AVClassCategory
Definition: log.h:28
AV_STREAM_GROUP_PARAMS_NONE
@ AV_STREAM_GROUP_PARAMS_NONE
Definition: avformat.h:1179
AVDISCARD_NONINTRA
@ AVDISCARD_NONINTRA
discard all non intra frames
Definition: defs.h:217
AVOutputFormat
Definition: avformat.h:510
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
tile_grid_class
static const AVClass tile_grid_class
Definition: options.c:360
avio_internal.h
av_opt_set_dict2
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:1719
internal.h
io_close2_default
static int io_close2_default(AVFormatContext *s, AVIOContext *pb)
Definition: options.c:162
AVStream::av_class
const AVClass * av_class
A class for AVOptions.
Definition: avformat.h:845
stream_class
static const AVClass stream_class
Definition: options.c:247
FFStream::pts_buffer
int64_t pts_buffer[MAX_REORDER_DELAY+1]
Definition: internal.h:353
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
demux.h
avcodec.h
AVStreamGroup::params
union AVStreamGroup::@295 params
Group type-specific parameters.
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:841
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
avformat.h
FFStreamGroup::pub
AVStreamGroup pub
The public context.
Definition: internal.h:437
AVOption::type
enum AVOptionType type
Definition: opt.h:308
av_iamf_mix_presentation_get_class
const AVClass * av_iamf_mix_presentation_get_class(void)
Definition: iamf.c:515
AVStreamGroup
Definition: avformat.h:1188
format_child_next
static void * format_child_next(void *obj, void *prev)
Definition: options.c:51
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:847
av_muxer_iterate
const AVOutputFormat * av_muxer_iterate(void **opaque)
Iterate over all registered muxers.
Definition: allformats.c:580
AV_CLASS_CATEGORY_MUXER
@ AV_CLASS_CATEGORY_MUXER
Definition: log.h:32
AVStreamGroup::nb_streams
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
Definition: avformat.h:1241
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avformat_free_context
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
Definition: avformat.c:141
stream_options
static const AVOption stream_options[]
Definition: options.c:233
FFStream::info
struct FFStreamInfo * info
Stream information used internally by avformat_find_stream_info()
Definition: internal.h:253
io_open_default
static int io_open_default(AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
Definition: options.c:137
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:255
AVStreamGroup::type
enum AVStreamGroupParamsType type
Group type.
Definition: avformat.h:1215
AVOption::unit
const char * unit
The logical unit to which the option belongs.
Definition: opt.h:333
FFFormatContext::pkt
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
Definition: internal.h:140
avformat_stream_group_create
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:431
codec_par.h
CHILD_CLASS_ITER_DONE
@ CHILD_CLASS_ITER_DONE
Definition: options.c:67
FFStream::cur_dts
int64_t cur_dts
Definition: internal.h:416
FFStream::need_context_update
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
Definition: internal.h:244
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
options_table.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
FFStream::fmtctx
AVFormatContext * fmtctx
Definition: internal.h:205
tile_grid_options
static const AVOption tile_grid_options[]
Definition: options.c:346
FFStreamGroup
Definition: internal.h:433
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:890
av_stream_get_class
const AVClass * av_stream_get_class(void)
Get the AVClass for AVStream.
Definition: options.c:254
AVDISCARD_NONREF
@ AVDISCARD_NONREF
discard all non reference
Definition: defs.h:215
FFFormatContext::pub
AVFormatContext pub
The public context.
Definition: internal.h:74
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
option_is_disposition
static int option_is_disposition(const AVOption *opt)
Definition: options.c:519
FFStream::pts_wrap_reference
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
Definition: internal.h:326
AVInputFormat::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:579
av_format_context_class
static const AVClass av_format_context_class
Definition: options.c:126
intmath.h