FFmpeg
Macros | Enumerations | Functions | Variables
options.c File Reference
#include "avformat.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/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)
 

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 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 71 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" }

Definition at line 201 of file options.c.

◆ FLAGS

Definition at line 334 of file options.c.

◆ OFFSET

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

Definition at line 335 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 63 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 43 of file options.c.

◆ format_child_next()

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

Definition at line 51 of file options.c.

◆ format_child_class_iterate()

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

Definition at line 73 of file options.c.

◆ get_category()

static AVClassCategory get_category ( void *  ptr)
static

Definition at line 119 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 137 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 155 of file options.c.

Referenced by avformat_alloc_context().

◆ avformat_new_stream()

AVStream* avformat_new_stream ( AVFormatContext s,
const AVCodec c 
)

Definition at line 249 of file options.c.

◆ stream_group_child_next()

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

Definition at line 356 of file options.c.

◆ stream_group_child_iterate()

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

Definition at line 374 of file options.c.

◆ stream_group_add_stream()

static int stream_group_add_stream ( AVStreamGroup stg,
AVStream st 
)
static

Definition at line 481 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 509 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 515 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 523 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 126 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 223 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 237 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 336 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 350 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 401 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 407 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:201
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:73
FLAGS
#define FLAGS
Definition: options.c:334
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
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:213
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:356
AV_DISPOSITION_CLEAN_EFFECTS
#define AV_DISPOSITION_CLEAN_EFFECTS
The audio stream contains music and sound effects without voice.
Definition: avformat.h:666
width
#define width
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:236
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AVDISCARD_BIDIR
@ AVDISCARD_BIDIR
discard all bidirectional frames
Definition: defs.h:216
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:219
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
Definition: opt.h:250
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
offset must point to two consecutive integers
Definition: opt.h:245
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
stream_group_options
static const AVOption stream_group_options[]
Definition: options.c:401
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:269
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:374
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:218
AVDISCARD_DEFAULT
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
Definition: defs.h:214
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
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:119
OFFSET
#define OFFSET(x)
Definition: options.c:335
AVDISCARD_NONINTRA
@ AVDISCARD_NONINTRA
discard all non intra frames
Definition: defs.h:217
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:743
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:1090
format_child_next
static void * format_child_next(void *obj, void *prev)
Definition: options.c:51
AV_CLASS_CATEGORY_MUXER
@ AV_CLASS_CATEGORY_MUXER
Definition: log.h:32
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
stream_options
static const AVOption stream_options[]
Definition: options.c:223
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:273
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:234
tile_grid_options
static const AVOption tile_grid_options[]
Definition: options.c:336
AVDISCARD_NONREF
@ AVDISCARD_NONREF
discard all non reference
Definition: defs.h:215
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
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