FFmpeg
Loading...
Searching...
No Matches
options.c File Reference

Options definition for AVFormatContext. More...

#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/attributes.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)
 
#define OFFSET(x)
 
#define OFFSET(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 FF_ENABLE_DEPRECATION_WARNINGS const 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.
 
const AVClassavformat_get_class (void)
 Get the AVClass for AVFormatContext.
 
const AVClassav_stream_get_class (void)
 Get the AVClass for AVStream.
 
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.
 
AVStreamGroupavformat_stream_group_create (AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
 Add a new empty stream group to a media file.
 
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.
 
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 tref_options []
 
static const AVClass tref_class
 
static const AVOption layered_video_options []
 
static const AVClass layered_video_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 75 of file options.c.

Referenced by format_child_class_iterate().

◆ 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" }
static AVFormatContext * ctx
#define AV_DISPOSITION_LYRICS
The stream contains song lyrics.
Definition avformat.h:661
#define AV_DISPOSITION_STILL_IMAGE
The video stream contains still images.
Definition avformat.h:731
#define AV_DISPOSITION_HEARING_IMPAIRED
The stream is intended for hearing impaired audiences.
Definition avformat.h:676
#define AV_DISPOSITION_COMMENT
The stream is a commentary track.
Definition avformat.h:657
#define AV_DISPOSITION_KARAOKE
The stream contains karaoke audio.
Definition avformat.h:665
#define AV_DISPOSITION_CAPTIONS
The subtitle stream contains captions, providing a transcription and possibly a translation of audio.
Definition avformat.h:710
#define AV_DISPOSITION_DUB
The stream is not in original language.
Definition avformat.h:647
#define AV_DISPOSITION_METADATA
The subtitle stream contains time-aligned metadata that is not intended to be directly presented to t...
Definition avformat.h:721
#define AV_DISPOSITION_MULTILAYER
The video stream contains multiple layers, e.g.
Definition avformat.h:736
#define AV_DISPOSITION_DEPENDENT
The stream is intended to be mixed with another stream before presentation.
Definition avformat.h:727
#define AV_DISPOSITION_NON_DIEGETIC
The stream is intended to be mixed with a spatial audio track.
Definition avformat.h:704
#define AV_DISPOSITION_CLEAN_EFFECTS
The audio stream contains music and sound effects without voice.
Definition avformat.h:684
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition avformat.h:672
#define AV_DISPOSITION_VISUAL_IMPAIRED
The stream is intended for visually impaired audiences.
Definition avformat.h:680
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition avformat.h:692
#define AV_DISPOSITION_DESCRIPTIONS
The subtitle stream contains a textual description of the video content.
Definition avformat.h:716
#define AV_DISPOSITION_ORIGINAL
The stream is in original language.
Definition avformat.h:653
#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:639
#define AV_DISPOSITION_TIMED_THUMBNAILS
The stream is sparse, and contains thumbnail images, often corresponding to chapter markers.
Definition avformat.h:697
#define NULL
Definition coverity.c:32
#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_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254

Definition at line 198 of file options.c.

◆ FLAGS

Definition at line 330 of file options.c.

◆ OFFSET [1/3]

#define OFFSET ( x)
Value:
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
Definition avformat.h:973

Definition at line 331 of file options.c.

◆ OFFSET [2/3]

#define OFFSET ( x)
Value:
offsetof(AVStreamGroupTREF, x)
AVStreamGroupTREF is meant to define the relation between video, audio, or subtitle streams,...
Definition avformat.h:1137

Definition at line 331 of file options.c.

◆ OFFSET [3/3]

#define OFFSET ( x)
Value:
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
Definition avformat.h:1093

Definition at line 331 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 67 of file options.c.

Function Documentation

◆ format_to_name()

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

Definition at line 46 of file options.c.

◆ format_child_next()

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

Definition at line 55 of file options.c.

◆ format_child_class_iterate()

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

Definition at line 77 of file options.c.

◆ get_category()

static AVClassCategory get_category ( void * ptr)
static

Definition at line 123 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 141 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 160 of file options.c.

Referenced by avformat_alloc_context().

◆ avformat_new_stream()

AVStream * avformat_new_stream ( AVFormatContext * s,
const AVCodec * c )

Definition at line 247 of file options.c.

◆ stream_group_child_next()

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

Definition at line 391 of file options.c.

◆ stream_group_child_iterate()

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

Definition at line 416 of file options.c.

◆ stream_group_add_stream()

static int stream_group_add_stream ( AVStreamGroup * stg,
AVStream * st )
static

Definition at line 545 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 573 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 579 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 587 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,
}
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
static AVClassCategory get_category(void *ptr)
Definition options.c:69
static const AVClass * format_child_class_iterate(void **iter)
Definition options.c:77
static void * format_child_next(void *obj, void *prev)
Definition options.c:55
FF_DISABLE_DEPRECATION_WARNINGS static FF_ENABLE_DEPRECATION_WARNINGS const char * format_to_name(void *ptr)
Definition options.c:46
static const AVOption avformat_options[]
@ AV_CLASS_CATEGORY_MUXER
Definition log.h:32

Definition at line 130 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 }
}
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition opt.h:355
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ 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
#define DISPOSITION_OPT(ctx)
Definition options.c:198
Stream structure.
Definition avformat.h:766

Definition at line 221 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,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
static const AVOption stream_options[]
Definition options.c:221

Definition at line 235 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 },
}
#define FLAGS
Definition cmdutils.c:598
#define OFFSET(x)
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition opt.h:302
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
Definition opt.h:322
#define width
Definition dsp.h:89

Definition at line 332 of file options.c.

◆ tile_grid_class

const AVClass tile_grid_class
static
Initial value:
= {
.class_name = "AVStreamGroupTileGrid",
.option = tile_grid_options,
}
static const AVOption tile_grid_options[]
Definition options.c:332

Definition at line 345 of file options.c.

Referenced by avformat_stream_group_create(), and stream_group_child_iterate().

◆ tref_options

const AVOption tref_options[]
static
Initial value:
= {
{ "metadata_index", "Index of the data stream within the group", OFFSET(metadata_index),
AV_OPT_TYPE_UINT, { .i64 = 0 }, 0, UINT_MAX, FLAGS },
{ NULL },
}
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
Definition opt.h:334

Definition at line 352 of file options.c.

◆ tref_class

const AVClass tref_class
static
Initial value:
= {
.class_name = "AVStreamGroupTREF",
.option = tref_options,
}
static const AVOption tref_options[]
Definition options.c:352

Definition at line 359 of file options.c.

Referenced by avformat_stream_group_create(), and stream_group_child_iterate().

◆ layered_video_options

const AVOption layered_video_options[]
static
Initial value:
= {
{ "el_index", "Index of the enhancement layer stream within the group", OFFSET(el_index),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "video_size", "size of the final layered video presentation", OFFSET(width),
AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
{ NULL },
}

Definition at line 369 of file options.c.

◆ layered_video_class

const AVClass layered_video_class
static
Initial value:
= {
.class_name = "AVStreamGroupLayeredVideo",
}
static const AVOption layered_video_options[]
Definition options.c:369

Definition at line 385 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 }
}
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition opt.h:262

Definition at line 450 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,
}
static const AVOption stream_group_options[]
Definition options.c:450
static void * stream_group_child_next(void *obj, void *prev)
Definition options.c:391
static const AVClass * stream_group_child_iterate(void **opaque)
Definition options.c:416

Definition at line 456 of file options.c.

Referenced by av_stream_group_get_class(), and avformat_stream_group_create().