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...
 
#define AV_OPT_SERIALIZE_SEARCH_CHILDREN   0x00000004
 Serialize options in possible children of the given object. More...
 

Functions

attribute_deprecated 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 1125 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 1126 of file opt.h.

◆ AV_OPT_SERIALIZE_SEARCH_CHILDREN

#define AV_OPT_SERIALIZE_SEARCH_CHILDREN   0x00000004

Serialize options in possible children of the given object.

Definition at line 1127 of file opt.h.

Function Documentation

◆ av_opt_ptr()

attribute_deprecated 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.
Deprecated:
direct access to AVOption-exported fields is not supported

Definition at line 2050 of file opt.c.

◆ 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 2571 of file opt.c.

Referenced by av_opt_is_set_to_default_by_name(), and 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 2707 of file opt.c.

Referenced by main(), and new_stream_video().

◆ 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 1391 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 2762 of file opt.c.

Referenced by main(), and of_serialize_options().