libavutil/opt.c File Reference

AVOptions. More...

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

Go to the source code of this file.

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)
static int av_set_number2 (void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out)
static const AVOptionav_set_number (void *obj, const char *name, double num, int den, int64_t intnum)
static int hexchar2int (char c)
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.
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)
const char * av_get_string (void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len)
static int av_get_number (void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum)
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)
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_defaults2 (void *s, int mask, int flags)
 Set the values of the AVCodecContext or AVFormatContext structure.
void av_opt_set_defaults (void *s)
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.

Variables

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


Detailed Description

AVOptions.

Author:
Michael Niedermayer <michaelni@gmx.at>

Definition in file opt.c.


Function Documentation

const AVOption* av_find_opt ( void *  obj,
const char *  name,
const char *  unit,
int  mask,
int  flags 
)

Look for an option in obj.

Look only for the options which have the flags set as specified in mask and flags (that is, for which it is the case that opt->flags & mask == flags).

Parameters:
[in] obj a pointer to a struct whose first element is a pointer to an AVClass
[in] name the name of the option to look for
[in] unit the unit of the option to look for, or any if NULL
Returns:
a pointer to the option found, or NULL if no option has been found

Definition at line 34 of file opt.c.

Referenced by av_get_number(), av_get_string(), av_set_number2(), av_set_string3(), ffserver_opt_default(), and opt_default().

double av_get_double ( void *  obj,
const char *  name,
const AVOption **  o_out 
)

Definition at line 287 of file opt.c.

Referenced by av_set_string3().

int64_t av_get_int ( void *  obj,
const char *  name,
const AVOption **  o_out 
)

Definition at line 310 of file opt.c.

Referenced by av_set_string3(), do_video_out(), opt_bitrate(), queue_picture(), and transcode().

static int av_get_number ( void *  obj,
const char *  name,
const AVOption **  o_out,
double *  num,
int *  den,
int64_t *  intnum 
) [static]

Definition at line 261 of file opt.c.

Referenced by av_get_double(), av_get_int(), and av_get_q().

AVRational av_get_q ( void *  obj,
const char *  name,
const AVOption **  o_out 
)

Definition at line 297 of file opt.c.

const char* av_get_string ( void *  obj,
const char *  name,
const AVOption **  o_out,
char *  buf,
int  buf_len 
)

Parameters:
buf a buffer which is used for returning non string values as strings, can be NULL
buf_len allocated length in bytes of buf

Definition at line 228 of file opt.c.

Referenced by set_context_opts().

const AVOption* av_next_option ( void *  obj,
const AVOption last 
)

Definition at line 46 of file opt.c.

Referenced by av_opt_set_defaults2(), and opt_list().

void av_opt_set_defaults ( void *  s  ) 

void av_opt_set_defaults2 ( void *  s,
int  mask,
int  flags 
)

Set the values of the AVCodecContext or AVFormatContext structure.

They are set to the defaults specified in the according AVOption options array default_val field.

Parameters:
s AVCodecContext or AVFormatContext for which the defaults will be set

Definition at line 407 of file opt.c.

Referenced by av_opt_set_defaults(), avcodec_get_context_defaults2(), and init().

int av_opt_show2 ( void *  obj,
void *  av_log_obj,
int  req_flags,
int  rej_flags 
)

Show the obj options.

Parameters:
req_flags requested flags for the options to show. Show only the options for which it is opt->flags & req_flags.
rej_flags rejected flags for the options to show. Show only the options for which it is !(opt->flags & req_flags).
av_log_obj log context to use for showing the options

Definition at line 389 of file opt.c.

Referenced by av_opt_show(), and show_help().

const AVOption* av_set_double ( void *  obj,
const char *  name,
double  n 
)

Definition at line 208 of file opt.c.

Referenced by av_opt_set_defaults2().

const AVOption* av_set_int ( void *  obj,
const char *  name,
int64_t  n 
)

Definition at line 218 of file opt.c.

Referenced by av_opt_set_defaults2().

static const AVOption* av_set_number ( void *  obj,
const char *  name,
double  num,
int  den,
int64_t  intnum 
) [static]

Definition at line 85 of file opt.c.

Referenced by av_set_double(), av_set_int(), and av_set_q().

static int av_set_number2 ( void *  obj,
const char *  name,
double  num,
int  den,
int64_t  intnum,
const AVOption **  o_out 
) [static]

Definition at line 53 of file opt.c.

Referenced by av_set_number(), and av_set_string3().

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.

For each key/value pair found, stores the value in the field in ctx that is named like the key. ctx must be an AVClass context, storing is done using AVOptions.

Parameters:
key_val_sep a 0-terminated list of characters used to separate key from value
pairs_sep a 0-terminated list of characters used to separate two pairs from each other
Returns:
the number of successfully set key/value pairs, or a negative value corresponding to an AVERROR code in case of error: AVERROR(EINVAL) if opts cannot be parsed, the error code issued by av_set_string3() if a key/value pair cannot be set

Definition at line 501 of file opt.c.

Referenced by init().

const AVOption* av_set_q ( void *  obj,
const char *  name,
AVRational  n 
)

Definition at line 213 of file opt.c.

Referenced by av_opt_set_defaults2().

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.

Parameters:
[in] obj A struct whose first element is a pointer to an AVClass.
[in] name the name of the field to set
[in] val The value to set. If the field is not of a string type, then the given string is parsed. SI postfixes and some named scalars are supported. If the field is of a numeric type, it has to be a numeric or named scalar. Behavior with more than one scalar and +- infix operators is undefined. If the field is of a flags type, it has to be a sequence of numeric scalars or named flags separated by '+' or '-'. Prefixing a flag with '+' causes it to be set without affecting the other flags; similarly, '-' unsets a flag.
[out] o_out if non-NULL put here a pointer to the AVOption found
alloc when 1 then the old value will be av_freed() and the new av_strduped() when 0 then no av_free() nor av_strdup() will be used
Returns:
0 if the value has been set, or an AVERROR code in case of error: AVERROR(ENOENT) if no matching option exists AVERROR(ERANGE) if the value is out of range AVERROR(EINVAL) if the value is not valid

Definition at line 115 of file opt.c.

Referenced by av_set_string(), av_set_string2(), ffserver_opt_default(), opt_default(), parse_key_value_pair(), and set_context_opts().

static int hexchar2int ( char  c  )  [static]

Definition at line 108 of file opt.c.

Referenced by av_set_string3().

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

Definition at line 320 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:
buf the string to parse, buf will be updated to point at the separator just after the parsed key/value pair
key_val_sep a 0-terminated list of characters used to separate key from value
pairs_sep a 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_set_string3() if the key/value pair cannot be set

Definition at line 474 of file opt.c.

Referenced by av_set_options_string().


Variable Documentation

const char* const const_names[] [static]

Initial value:

 {
    "PI",
    "E",
    "QP2LAMBDA",
    0
}

Definition at line 101 of file opt.c.

Referenced by av_set_string3(), and ff_rate_control_init().

const double const_values[] [static]

Initial value:

 {
    M_PI,
    M_E,
    FF_QP2LAMBDA,
    0
}

Definition at line 94 of file opt.c.

Referenced by av_set_string3(), and get_qscale().


Generated on Mon May 2 19:50:20 2011 for FFmpeg by  doxygen 1.5.6