opt.c File Reference

AVOptions. More...

#include "avutil.h"
#include "avstring.h"
#include "opt.h"
#include "eval.h"
#include "dict.h"
#include "log.h"

Go to the source code of this file.

Macros

#define OPT_EVAL_NUMBER(name, opttype, vartype)

Functions

const AVOptionav_find_opt (void *v, const char *name, const char *unit, int mask, int flags)
 Look for an option in obj.
const AVOptionav_next_option (void *obj, const AVOption *last)
const AVOptionav_opt_next (void *obj, const AVOption *last)
 Iterate over all AVOptions belonging to obj.
static int read_number (const AVOption *o, void *dst, double *num, int *den, int64_t *intnum)
static int write_number (void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
static int hexchar2int (char c)
static int set_string_binary (void *obj, const AVOption *o, const char *val, uint8_t **dst)
static int set_string (void *obj, const AVOption *o, const char *val, uint8_t **dst)
static int set_string_number (void *obj, const AVOption *o, const char *val, void *dst)
int av_set_string3 (void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
 Set the field of obj with the given name to value.
int av_opt_set (void *obj, const char *name, const char *val, int search_flags)
static int set_number (void *obj, const char *name, double num, int den, int64_t intnum, int search_flags)
const AVOptionav_set_double (void *obj, const char *name, double n)
const AVOptionav_set_q (void *obj, const char *name, AVRational n)
const AVOptionav_set_int (void *obj, const char *name, int64_t n)
int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags)
int av_opt_set_double (void *obj, const char *name, double val, int search_flags)
int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags)
const char * av_get_string (void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len)
int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val)
static int get_number (void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum, int search_flags)
double av_get_double (void *obj, const char *name, const AVOption **o_out)
AVRational av_get_q (void *obj, const char *name, const AVOption **o_out)
int64_t av_get_int (void *obj, const char *name, const AVOption **o_out)
int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val)
int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val)
int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val)
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.
static void opt_list (void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags)
int av_opt_show2 (void *obj, void *av_log_obj, int req_flags, int rej_flags)
 Show the obj options.
void av_opt_set_defaults (void *s)
 Set the values of all AVOption fields to their default values.
void av_opt_set_defaults2 (void *s, int mask, int flags)
static int parse_key_value_pair (void *ctx, const char **buf, const char *key_val_sep, const char *pairs_sep)
 Store the value in the field in ctx that is named like key.
int av_set_options_string (void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep)
 Parse the key/value pairs list in opts.
void av_opt_free (void *obj)
 Free all string and binary options in obj.
int av_opt_set_dict (void *obj, AVDictionary **options)
const AVOptionav_opt_find (void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
 Look for an option in an object.
const AVOptionav_opt_find2 (void *obj, const char *name, const char *unit, int opt_flags, int search_flags, void **target_obj)
 Look for an option in an object.
voidav_opt_child_next (void *obj, void *prev)
 Iterate over AVOptions-enabled children of obj.
const AVClassav_opt_child_class_next (const AVClass *parent, const AVClass *prev)
 Iterate over potential AVOptions-enabled children of parent.

Variables

static const double const_values []
static const char *const const_names []

Detailed Description

AVOptions.

Author
Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at

Definition in file opt.c.

Macro Definition Documentation

#define OPT_EVAL_NUMBER (   name,
  opttype,
  vartype 
)
Value:
int av_opt_eval_ ## name(void *obj, const AVOption *o, const char *val, vartype *name ## _out)\
{\
if (!o || o->type != opttype)\
return AVERROR(EINVAL);\
return set_string_number(obj, o, val, name ## _out);\
}

Definition at line 252 of file opt.c.

Function Documentation

static int get_number ( void obj,
const char *  name,
const AVOption **  o_out,
double *  num,
int *  den,
int64_t *  intnum,
int  search_flags 
)
static
static int hexchar2int ( char  c)
static

Definition at line 119 of file opt.c.

Referenced by set_string_binary().

static void opt_list ( void obj,
void av_log_obj,
const char *  unit,
int  req_flags,
int  rej_flags 
)
static

Definition at line 517 of file opt.c.

Referenced by av_opt_show2().

static int parse_key_value_pair ( void ctx,
const char **  buf,
const char *  key_val_sep,
const char *  pairs_sep 
)
static

Store the value in the field in ctx that is named like key.

ctx must be an AVClass context, storing is done using AVOptions.

Parameters
bufthe string to parse, buf will be updated to point at the separator just after the parsed key/value pair
key_val_sepa 0-terminated list of characters used to separate key from value
pairs_sepa 0-terminated list of characters used to separate two pairs from each other
Returns
0 if the key/value pair has been successfully parsed and set, or a negative value corresponding to an AVERROR code in case of error: AVERROR(EINVAL) if the key/value pair cannot be parsed, the error code issued by av_opt_set() if the key/value pair cannot be set

Definition at line 671 of file opt.c.

Referenced by av_set_options_string().

static int read_number ( const AVOption o,
void dst,
double *  num,
int *  den,
int64_t *  intnum 
)
static

Definition at line 67 of file opt.c.

Referenced by get_number(), and set_string_number().

static int set_number ( void obj,
const char *  name,
double  num,
int  den,
int64_t  intnum,
int  search_flags 
)
static
static int set_string ( void obj,
const AVOption o,
const char *  val,
uint8_t **  dst 
)
static

Definition at line 155 of file opt.c.

Referenced by av_opt_set().

static int set_string_binary ( void obj,
const AVOption o,
const char *  val,
uint8_t **  dst 
)
static

Definition at line 126 of file opt.c.

Referenced by av_opt_set().

static int set_string_number ( void obj,
const AVOption o,
const char *  val,
void dst 
)
static

Definition at line 162 of file opt.c.

Referenced by av_opt_set().

static int write_number ( void obj,
const AVOption o,
void dst,
double  num,
int  den,
int64_t  intnum 
)
static

Definition at line 82 of file opt.c.

Referenced by set_number(), and set_string_number().

Variable Documentation

const char* const const_names[]
static
Initial value:
{
"PI",
"E",
"QP2LAMBDA",
0
}

Definition at line 112 of file opt.c.

Referenced by av_expr_parse(), ff_rate_control_init(), and set_string_number().

const double const_values[]
static
Initial value:
{
M_E,
0
}

Definition at line 105 of file opt.c.

Referenced by av_expr_eval(), get_qscale(), and set_string_number().