FFmpeg
Modules | Macros | Functions
Reading option values

Modules

 Option getting functions
 Those functions get a value of the option with the given name from an object.
 
 Evaluating option strings
 This group of functions can be used to evaluate option strings and get numbers out of them. They do the same thing as av_opt_set(), except the result is written into the caller-supplied pointer.
 

Macros

#define AV_OPT_SERIALIZE_SKIP_DEFAULTS   0x00000001
 Serialize options that are not set to default values only. More...
 
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT   0x00000002
 Serialize options that exactly match opt_flags only. More...
 

Functions

void * av_opt_ptr (const AVClass *avclass, void *obj, const char *name)
 Gets a pointer to the requested field in a struct. More...
 
int av_opt_is_set_to_default (void *obj, const AVOption *o)
 Check if given option is set to its default value. More...
 
int av_opt_is_set_to_default_by_name (void *obj, const char *name, int search_flags)
 Check if given option is set to its default value. More...
 
int av_opt_flag_is_set (void *obj, const char *field_name, const char *flag_name)
 Check whether a particular flag is set in a flags field. More...
 
int av_opt_serialize (void *obj, int opt_flags, int flags, char **buffer, const char key_val_sep, const char pairs_sep)
 Serialize object's options. More...
 

Detailed Description

Macro Definition Documentation

◆ AV_OPT_SERIALIZE_SKIP_DEFAULTS

#define AV_OPT_SERIALIZE_SKIP_DEFAULTS   0x00000001

Serialize options that are not set to default values only.

Definition at line 930 of file opt.h.

◆ AV_OPT_SERIALIZE_OPT_FLAGS_EXACT

#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT   0x00000002

Serialize options that exactly match opt_flags only.

Definition at line 931 of file opt.h.

Function Documentation

◆ av_opt_ptr()

void* av_opt_ptr ( const AVClass avclass,
void *  obj,
const char *  name 
)

Gets a pointer to the requested field in a struct.

This function allows accessing a struct even when its fields are moved or renamed since the application making the access has been compiled,

Returns
a pointer to the field, it can be cast to the correct type and read or written to.

Definition at line 2016 of file opt.c.

Referenced by avformat_find_stream_info().

◆ av_opt_is_set_to_default()

int av_opt_is_set_to_default ( void *  obj,
const AVOption o 
)

Check if given option is set to its default value.

Options o must belong to the obj. This function must not be called to check child's options state.

See also
av_opt_is_set_to_default_by_name().
Parameters
objAVClass object to check option on
ooption to be checked
Returns
>0 when option is set to its default, 0 when option is not set its default, <0 on error

Definition at line 2239 of file opt.c.

Referenced by av_opt_is_set_to_default_by_name(), and av_opt_serialize().

◆ av_opt_is_set_to_default_by_name()

int av_opt_is_set_to_default_by_name ( void *  obj,
const char *  name,
int  search_flags 
)

Check if given option is set to its default value.

Parameters
objAVClass object to check option on
nameoption name
search_flagscombination of AV_OPT_SEARCH_*
Returns
>0 when option is set to its default, 0 when option is not set its default, <0 on error

Definition at line 2372 of file opt.c.

Referenced by main().

◆ av_opt_flag_is_set()

int av_opt_flag_is_set ( void *  obj,
const char *  field_name,
const char *  flag_name 
)

Check whether a particular flag is set in a flags field.

Parameters
field_namethe name of the flag field option
flag_namethe name of the flag to check
Returns
non-zero if the flag is set, zero if the flag isn't set, isn't of the right type, or the flags field doesn't exist.

Definition at line 1341 of file opt.c.

Referenced by ff_rtp_get_payload_type().

◆ av_opt_serialize()

int av_opt_serialize ( void *  obj,
int  opt_flags,
int  flags,
char **  buffer,
const char  key_val_sep,
const char  pairs_sep 
)

Serialize object's options.

Create a string containing object's serialized options. Such string may be passed back to av_opt_set_from_string() in order to restore option values. A key/value or pairs separator occurring in the serialized value or name string are escaped through the av_escape() function.

Parameters
[in]objAVClass object to serialize
[in]opt_flagsserialize options with all the specified flags set (AV_OPT_FLAG)
[in]flagscombination of AV_OPT_SERIALIZE_* flags
[out]bufferPointer to buffer that will be allocated with string containg serialized options. Buffer must be freed by the caller when is no longer needed.
[in]key_val_sepcharacter used to separate key from value
[in]pairs_sepcharacter used to separate two pairs from each other
Returns
>= 0 on success, negative on error
Warning
Separators cannot be neither '\' nor '\0'. They also cannot be the same.

Definition at line 2384 of file opt.c.

Referenced by main().