FFmpeg
Macros | Enumerations | Functions | Variables
options.c File Reference
#include "avformat.h"
#include "avformat_internal.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/codec_par.h"
#include "libavutil/avassert.h"
#include "libavutil/iamf.h"
#include "libavutil/internal.h"
#include "libavutil/intmath.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "options_table.h"

Go to the source code of this file.

Macros

#define ITER_STATE_SHIFT   16
 
#define DISPOSITION_OPT(ctx)
 
#define FLAGS   AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 
#define OFFSET(x)   offsetof(AVStreamGroupTileGrid, x)
 
#define OFFSET(x)   offsetof(AVStreamGroupLCEVC, x)
 

Enumerations

enum  { CHILD_CLASS_ITER_AVIO = 0, CHILD_CLASS_ITER_MUX, CHILD_CLASS_ITER_DEMUX, CHILD_CLASS_ITER_DONE }
 

Functions

FF_DISABLE_DEPRECATION_WARNINGS static const FF_ENABLE_DEPRECATION_WARNINGS char * format_to_name (void *ptr)
 
static void * format_child_next (void *obj, void *prev)
 
static const AVClassformat_child_class_iterate (void **iter)
 
static AVClassCategory get_category (void *ptr)
 
static int io_open_default (AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
 
static int io_close2_default (AVFormatContext *s, AVIOContext *pb)
 
AVFormatContextavformat_alloc_context (void)
 Allocate an AVFormatContext. More...
 
const AVClassavformat_get_class (void)
 Get the AVClass for AVFormatContext. More...
 
const AVClassav_stream_get_class (void)
 Get the AVClass for AVStream. More...
 
AVStreamavformat_new_stream (AVFormatContext *s, const AVCodec *c)
 
static void * stream_group_child_next (void *obj, void *prev)
 
static const AVClassstream_group_child_iterate (void **opaque)
 
const AVClassav_stream_group_get_class (void)
 Get the AVClass for AVStreamGroup. More...
 
AVStreamGroupavformat_stream_group_create (AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
 Add a new empty stream group to a media file. More...
 
static int stream_group_add_stream (AVStreamGroup *stg, AVStream *st)
 
int avformat_stream_group_add_stream (AVStreamGroup *stg, AVStream *st)
 Add an already allocated stream to a stream group. More...
 
static int option_is_disposition (const AVOption *opt)
 
int av_disposition_from_string (const char *disp)
 
const char * av_disposition_to_string (int disposition)
 

Variables

static const AVClass av_format_context_class
 
static const AVOption stream_options []
 
static const AVClass stream_class
 
static const AVOption tile_grid_options []
 
static const AVClass tile_grid_class
 
static const AVOption lcevc_options []
 
static const AVClass lcevc_class
 
static const AVOption stream_group_options []
 
static const AVClass stream_group_class
 

Detailed Description

Options definition for AVFormatContext.

Definition in file options.c.

Macro Definition Documentation

◆ ITER_STATE_SHIFT

#define ITER_STATE_SHIFT   16

Definition at line 73 of file options.c.

◆ DISPOSITION_OPT

#define DISPOSITION_OPT (   ctx)
Value:
{ "disposition", NULL, offsetof(ctx, disposition), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, \
.flags = AV_OPT_FLAG_ENCODING_PARAM, .unit = "disposition" }, \
{ "default", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEFAULT }, .unit = "disposition" }, \
{ "dub", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DUB }, .unit = "disposition" }, \
{ "original", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ORIGINAL }, .unit = "disposition" }, \
{ "comment", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_COMMENT }, .unit = "disposition" }, \
{ "lyrics", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_LYRICS }, .unit = "disposition" }, \
{ "karaoke", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_KARAOKE }, .unit = "disposition" }, \
{ "forced", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_FORCED }, .unit = "disposition" }, \
{ "hearing_impaired", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "disposition" }, \
{ "visual_impaired", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "disposition" }, \
{ "clean_effects", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "disposition" }, \
{ "attached_pic", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ATTACHED_PIC }, .unit = "disposition" }, \
{ "timed_thumbnails", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_TIMED_THUMBNAILS }, .unit = "disposition" }, \
{ "non_diegetic", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_NON_DIEGETIC }, .unit = "disposition" }, \
{ "captions", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CAPTIONS }, .unit = "disposition" }, \
{ "descriptions", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DESCRIPTIONS }, .unit = "disposition" }, \
{ "metadata", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_METADATA }, .unit = "disposition" }, \
{ "dependent", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEPENDENT }, .unit = "disposition" }, \
{ "still_image", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_STILL_IMAGE }, .unit = "disposition" }, \
{ "multilayer", .type = AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_MULTILAYER }, .unit = "disposition" }

Definition at line 206 of file options.c.

◆ FLAGS

Definition at line 342 of file options.c.

◆ OFFSET [1/2]

#define OFFSET (   x)    offsetof(AVStreamGroupTileGrid, x)

Definition at line 363 of file options.c.

◆ OFFSET [2/2]

#define OFFSET (   x)    offsetof(AVStreamGroupLCEVC, x)

Definition at line 363 of file options.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CHILD_CLASS_ITER_AVIO 
CHILD_CLASS_ITER_MUX 
CHILD_CLASS_ITER_DEMUX 
CHILD_CLASS_ITER_DONE 

Definition at line 65 of file options.c.

Function Documentation

◆ format_to_name()

FF_DISABLE_DEPRECATION_WARNINGS static const FF_ENABLE_DEPRECATION_WARNINGS char* format_to_name ( void *  ptr)
static

Definition at line 45 of file options.c.

◆ format_child_next()

static void* format_child_next ( void *  obj,
void *  prev 
)
static

Definition at line 53 of file options.c.

◆ format_child_class_iterate()

static const AVClass* format_child_class_iterate ( void **  iter)
static

Definition at line 75 of file options.c.

◆ get_category()

static AVClassCategory get_category ( void *  ptr)
static

Definition at line 121 of file options.c.

◆ io_open_default()

static int io_open_default ( AVFormatContext s,
AVIOContext **  pb,
const char *  url,
int  flags,
AVDictionary **  options 
)
static

Definition at line 139 of file options.c.

Referenced by avformat_alloc_context().

◆ io_close2_default()

static int io_close2_default ( AVFormatContext s,
AVIOContext pb 
)
static

Definition at line 157 of file options.c.

Referenced by avformat_alloc_context().

◆ avformat_new_stream()

AVStream* avformat_new_stream ( AVFormatContext s,
const AVCodec c 
)

Definition at line 255 of file options.c.

◆ stream_group_child_next()

static void* stream_group_child_next ( void *  obj,
void *  prev 
)
static

Definition at line 377 of file options.c.

◆ stream_group_child_iterate()

static const AVClass* stream_group_child_iterate ( void **  opaque)
static

Definition at line 399 of file options.c.

◆ stream_group_add_stream()

static int stream_group_add_stream ( AVStreamGroup stg,
AVStream st 
)
static

Definition at line 516 of file options.c.

Referenced by avformat_stream_group_add_stream().

◆ option_is_disposition()

static int option_is_disposition ( const AVOption opt)
static

Definition at line 544 of file options.c.

Referenced by av_disposition_from_string(), and av_disposition_to_string().

◆ av_disposition_from_string()

int av_disposition_from_string ( const char *  disp)
Returns
The AV_DISPOSITION_* flag corresponding to disp or a negative error code if disp does not correspond to a known stream disposition.

Definition at line 550 of file options.c.

◆ av_disposition_to_string()

const char* av_disposition_to_string ( int  disposition)
Parameters
dispositiona combination of AV_DISPOSITION_* values
Returns
The string description corresponding to the lowest set bit in disposition. NULL when the lowest set bit does not correspond to a known disposition or when disposition is 0.

Definition at line 558 of file options.c.

Referenced by print_dispositions(), and show_dispositions().

Variable Documentation

◆ av_format_context_class

const AVClass av_format_context_class
static
Initial value:
= {
.class_name = "AVFormatContext",
.item_name = format_to_name,
.option = avformat_options,
.child_next = format_child_next,
.child_class_iterate = format_child_class_iterate,
.get_category = get_category,
}

Definition at line 128 of file options.c.

Referenced by avformat_alloc_context(), and avformat_get_class().

◆ stream_options

const AVOption stream_options[]
static
Initial value:
= {
{ "discard", NULL, 0x42, AV_OPT_TYPE_INT, { .i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX,
.flags = AV_OPT_FLAG_DECODING_PARAM, .unit = "avdiscard" },
{ "none", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONE }, .unit = "avdiscard" },
{ "default", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_DEFAULT }, .unit = "avdiscard" },
{ "noref", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONREF }, .unit = "avdiscard" },
{ "bidir", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_BIDIR }, .unit = "avdiscard" },
{ "nointra", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONINTRA }, .unit = "avdiscard" },
{ "nokey", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONKEY }, .unit = "avdiscard" },
{ "all", .type = AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_ALL }, .unit = "avdiscard" },
{ NULL }
}

Definition at line 229 of file options.c.

Referenced by av_disposition_from_string(), and av_disposition_to_string().

◆ stream_class

const AVClass stream_class
static
Initial value:
= {
.class_name = "AVStream",
.item_name = av_default_item_name,
.option = stream_options,
}

Definition at line 243 of file options.c.

Referenced by av_stream_get_class(), and avformat_new_stream().

◆ tile_grid_options

const AVOption tile_grid_options[]
static
Initial value:
= {
{ "grid_size", "size of the output canvas", OFFSET(coded_width),
AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
{ "output_size", "size of valid pixels in output image meant for presentation", OFFSET(width),
AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
{ "background_color", "set a background color for unused pixels",
OFFSET(background), AV_OPT_TYPE_COLOR, { .str = "black"}, 0, 0, FLAGS },
{ "horizontal_offset", NULL, OFFSET(horizontal_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "vertical_offset", NULL, OFFSET(vertical_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ NULL },
}

Definition at line 344 of file options.c.

◆ tile_grid_class

const AVClass tile_grid_class
static
Initial value:
= {
.class_name = "AVStreamGroupTileGrid",
.option = tile_grid_options,
}

Definition at line 357 of file options.c.

Referenced by avformat_stream_group_create(), and stream_group_child_iterate().

◆ lcevc_options

const AVOption lcevc_options[]
static
Initial value:
= {
{ "video_size", "size of video after LCEVC enhancement has been applied", OFFSET(width),
AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
{ NULL },
}

Definition at line 364 of file options.c.

◆ lcevc_class

const AVClass lcevc_class
static
Initial value:
= {
.class_name = "AVStreamGroupLCEVC",
.option = lcevc_options,
}

Definition at line 371 of file options.c.

Referenced by avformat_stream_group_create(), and stream_group_child_iterate().

◆ stream_group_options

const AVOption stream_group_options[]
static
Initial value:
= {
{"id", "Set group id", 0x42, AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
}

Definition at line 429 of file options.c.

◆ stream_group_class

const AVClass stream_group_class
static
Initial value:
= {
.class_name = "AVStreamGroup",
.item_name = av_default_item_name,
.child_next = stream_group_child_next,
.child_class_iterate = stream_group_child_iterate,
}

Definition at line 435 of file options.c.

Referenced by av_stream_group_get_class(), and avformat_stream_group_create().

DISPOSITION_OPT
#define DISPOSITION_OPT(ctx)
Definition: options.c:206
AV_DISPOSITION_ATTACHED_PIC
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition: avformat.h:674
format_child_class_iterate
static const AVClass * format_child_class_iterate(void **iter)
Definition: options.c:75
FLAGS
#define FLAGS
Definition: options.c:342
AV_DISPOSITION_DEFAULT
#define AV_DISPOSITION_DEFAULT
The stream should be chosen by default among other streams of the same type, unless the user has expl...
Definition: avformat.h:621
lcevc_options
static const AVOption lcevc_options[]
Definition: options.c:364
AV_DISPOSITION_STILL_IMAGE
#define AV_DISPOSITION_STILL_IMAGE
The video stream contains still images.
Definition: avformat.h:713
AVDISCARD_NONE
@ AVDISCARD_NONE
discard nothing
Definition: defs.h:215
AV_DISPOSITION_FORCED
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:654
AV_DISPOSITION_TIMED_THUMBNAILS
#define AV_DISPOSITION_TIMED_THUMBNAILS
The stream is sparse, and contains thumbnail images, often corresponding to chapter markers.
Definition: avformat.h:679
stream_group_child_next
static void * stream_group_child_next(void *obj, void *prev)
Definition: options.c:377
AV_DISPOSITION_CLEAN_EFFECTS
#define AV_DISPOSITION_CLEAN_EFFECTS
The audio stream contains music and sound effects without voice.
Definition: avformat.h:666
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition: opt.h:263
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AVDISCARD_BIDIR
@ AVDISCARD_BIDIR
discard all bidirectional frames
Definition: defs.h:218
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:221
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
avformat_options
static const AVOption avformat_options[]
Definition: options_table.h:36
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
Definition: opt.h:323
AV_DISPOSITION_COMMENT
#define AV_DISPOSITION_COMMENT
The stream is a commentary track.
Definition: avformat.h:639
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition: opt.h:303
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_DISPOSITION_METADATA
#define AV_DISPOSITION_METADATA
The subtitle stream contains time-aligned metadata that is not intended to be directly presented to t...
Definition: avformat.h:703
AV_DISPOSITION_ORIGINAL
#define AV_DISPOSITION_ORIGINAL
The stream is in original language.
Definition: avformat.h:635
AV_DISPOSITION_MULTILAYER
#define AV_DISPOSITION_MULTILAYER
The video stream contains multiple layers, e.g.
Definition: avformat.h:718
stream_group_options
static const AVOption stream_group_options[]
Definition: options.c:429
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:352
format_to_name
FF_DISABLE_DEPRECATION_WARNINGS static const FF_ENABLE_DEPRECATION_WARNINGS char * format_to_name(void *ptr)
Definition: options.c:45
stream_group_child_iterate
static const AVClass * stream_group_child_iterate(void **opaque)
Definition: options.c:399
AV_DISPOSITION_CAPTIONS
#define AV_DISPOSITION_CAPTIONS
The subtitle stream contains captions, providing a transcription and possibly a translation of audio.
Definition: avformat.h:692
AVDISCARD_NONKEY
@ AVDISCARD_NONKEY
discard all frames except keyframes
Definition: defs.h:220
AVDISCARD_DEFAULT
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
Definition: defs.h:216
AVClass::category
AVClassCategory category
Category used for visualization (like color).
Definition: log.h:132
AV_DISPOSITION_DUB
#define AV_DISPOSITION_DUB
The stream is not in original language.
Definition: avformat.h:629
AV_DISPOSITION_HEARING_IMPAIRED
#define AV_DISPOSITION_HEARING_IMPAIRED
The stream is intended for hearing impaired audiences.
Definition: avformat.h:658
get_category
static AVClassCategory get_category(void *ptr)
Definition: options.c:121
OFFSET
#define OFFSET(x)
Definition: options.c:363
AVDISCARD_NONINTRA
@ AVDISCARD_NONINTRA
discard all non intra frames
Definition: defs.h:219
AV_DISPOSITION_KARAOKE
#define AV_DISPOSITION_KARAOKE
The stream contains karaoke audio.
Definition: avformat.h:647
AV_DISPOSITION_DEPENDENT
#define AV_DISPOSITION_DEPENDENT
The stream is intended to be mixed with another stream before presentation.
Definition: avformat.h:709
AV_DISPOSITION_VISUAL_IMPAIRED
#define AV_DISPOSITION_VISUAL_IMPAIRED
The stream is intended for visually impaired audiences.
Definition: avformat.h:662
AVStream
Stream structure.
Definition: avformat.h:748
AV_DISPOSITION_DESCRIPTIONS
#define AV_DISPOSITION_DESCRIPTIONS
The subtitle stream contains a textual description of the video content.
Definition: avformat.h:698
AVStreamGroup
Definition: avformat.h:1134
format_child_next
static void * format_child_next(void *obj, void *prev)
Definition: options.c:53
AV_CLASS_CATEGORY_MUXER
@ AV_CLASS_CATEGORY_MUXER
Definition: log.h:32
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
stream_options
static const AVOption stream_options[]
Definition: options.c:229
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:356
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:255
tile_grid_options
static const AVOption tile_grid_options[]
Definition: options.c:344
width
#define width
Definition: dsp.h:85
AVDISCARD_NONREF
@ AVDISCARD_NONREF
discard all non reference
Definition: defs.h:217
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
AV_DISPOSITION_LYRICS
#define AV_DISPOSITION_LYRICS
The stream contains song lyrics.
Definition: avformat.h:643
AV_DISPOSITION_NON_DIEGETIC
#define AV_DISPOSITION_NON_DIEGETIC
The stream is intended to be mixed with a spatial audio track.
Definition: avformat.h:686