Loading...
Searching...
No Matches
Reading option values
libavutil » Data Structures » AVOptions

## 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.

## Macros

#define | AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001
| Serialize options that are not set to default values only.
#define | AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002
| Serialize options that exactly match opt_flags only.
#define | AV_OPT_SERIALIZE_SEARCH_CHILDREN 0x00000004
| Serialize options in possible children of the given object.

## Functions

void * | av_opt_ptr (const AVClass *avclass, void *obj, const char *name)
| Gets a pointer to the requested field in a struct.
int | av_opt_is_set_to_default (void *obj, const AVOption *o)
| Check if given option is set to its default value.
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.
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.
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.

## 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 1118 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 1119 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 1120 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.

## 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

  obj | AVClass object to check option on
  o | option to be checked

Returns
  >0 when option is set to its default, 0 when option is not set its default, <0 on error

## 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

  obj | AVClass object to check option on
  name | option name
  search_flags | combination of AV_OPT_SEARCH_*

Returns
  >0 when option is set to its default, 0 when option is not set its default, <0 on error

## 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_name | the name of the flag field option
  flag_name | the 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.

## 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] | obj | AVClass object to serialize
  [in] | opt_flags | serialize options with all the specified flags set (AV_OPT_FLAG)
  [in] | flags | combination of AV_OPT_SERIALIZE_* flags
  [out] | buffer | Pointer 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_sep | character used to separate key from value
  [in] | pairs_sep | character 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.