FFmpeg
Macros | Functions
Option setting functions

Those functions set the field of obj with the given name to value. More...

Macros

#define av_opt_set_int_list(obj, name, val, term, flags)
 Set a binary option to an integer list. More...
 

Functions

int av_opt_set (void *obj, const char *name, const char *val, int search_flags)
 
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)
 
int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags)
 
int av_opt_set_image_size (void *obj, const char *name, int w, int h, int search_flags)
 
int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
 
int av_opt_set_sample_fmt (void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
 
int av_opt_set_video_rate (void *obj, const char *name, AVRational val, int search_flags)
 
attribute_deprecated int av_opt_set_channel_layout (void *obj, const char *name, int64_t ch_layout, int search_flags)
 
int av_opt_set_chlayout (void *obj, const char *name, const AVChannelLayout *layout, int search_flags)
 
int av_opt_set_dict_val (void *obj, const char *name, const AVDictionary *val, int search_flags)
 

Detailed Description

Those functions set the field of obj with the given name to value.

Parameters
[in]objA struct whose first element is a pointer to an AVClass.
[in]namethe name of the field to set
[in]valThe value to set. In case of av_opt_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. If the field is of a dictionary type, it has to be a ':' separated list of key=value parameters. Values containing ':' special characters must be escaped.
search_flagsflags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN is passed here, then the option may be set on a child of obj.
Returns
0 if the value has been set, or an AVERROR code in case of error: AVERROR_OPTION_NOT_FOUND if no matching option exists AVERROR(ERANGE) if the value is out of range AVERROR(EINVAL) if the value is not valid

Macro Definition Documentation

◆ av_opt_set_int_list

#define av_opt_set_int_list (   obj,
  name,
  val,
  term,
  flags 
)
Value:
(av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \
AVERROR(EINVAL) : \
av_opt_set_bin(obj, name, (const uint8_t *)(val), \
av_int_list_length(val, term) * sizeof(*(val)), flags))

Set a binary option to an integer list.

Parameters
objAVClass object to set options on
namename of the binary option
valpointer to an integer list (must have the correct type with regard to the contents of the list)
termlist terminator (usually 0 or -1)
flagssearch flags
Examples
filtering_audio.c, and filtering_video.c.

Definition at line 721 of file opt.h.

Function Documentation

◆ av_opt_set()

int av_opt_set ( void *  obj,
const char *  name,
const char *  val,
int  search_flags 
)

◆ av_opt_set_int()

int av_opt_set_int ( void *  obj,
const char *  name,
int64_t  val,
int  search_flags 
)

◆ av_opt_set_double()

int av_opt_set_double ( void *  obj,
const char *  name,
double  val,
int  search_flags 
)

Definition at line 629 of file opt.c.

◆ av_opt_set_q()

int av_opt_set_q ( void *  obj,
const char *  name,
AVRational  val,
int  search_flags 
)

Definition at line 634 of file opt.c.

Referenced by init_filter_graph().

◆ av_opt_set_bin()

int av_opt_set_bin ( void *  obj,
const char *  name,
const uint8_t *  val,
int  size,
int  search_flags 
)

◆ av_opt_set_image_size()

int av_opt_set_image_size ( void *  obj,
const char *  name,
int  w,
int  h,
int  search_flags 
)

Definition at line 669 of file opt.c.

◆ av_opt_set_pixel_fmt()

int av_opt_set_pixel_fmt ( void *  obj,
const char *  name,
enum AVPixelFormat  fmt,
int  search_flags 
)

Definition at line 737 of file opt.c.

◆ av_opt_set_sample_fmt()

int av_opt_set_sample_fmt ( void *  obj,
const char *  name,
enum AVSampleFormat  fmt,
int  search_flags 
)

Definition at line 742 of file opt.c.

Referenced by config_audio_output(), main(), and open_audio().

◆ av_opt_set_video_rate()

int av_opt_set_video_rate ( void *  obj,
const char *  name,
AVRational  val,
int  search_flags 
)

Definition at line 691 of file opt.c.

◆ av_opt_set_channel_layout()

attribute_deprecated int av_opt_set_channel_layout ( void *  obj,
const char *  name,
int64_t  ch_layout,
int  search_flags 
)

Definition at line 749 of file opt.c.

◆ av_opt_set_chlayout()

int av_opt_set_chlayout ( void *  obj,
const char *  name,
const AVChannelLayout layout,
int  search_flags 
)

Definition at line 786 of file opt.c.

Referenced by config_audio_output(), main(), open_audio(), swr_alloc_set_opts2(), and swr_config_frame().

◆ av_opt_set_dict_val()

int av_opt_set_dict_val ( void *  obj,
const char *  name,
const AVDictionary val,
int  search_flags 
)
Note
Any old dictionary present is discarded and replaced with a copy of the new one. The caller still owns val is and responsible for freeing it.

Definition at line 767 of file opt.c.

Referenced by read_frame_internal().

name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
val
static double val(void *priv, double ch)
Definition: aeval.c:77
av_int_list_length
#define av_int_list_length(list, term)
Compute the length of an integer list.
Definition: avutil.h:331
av_opt_set_bin
int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int size, int search_flags)
Definition: opt.c:639
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561