FFmpeg
[フレーム]
Macros | Functions
Option setting functions
libavutil » Data Structures » AVOptions » Setting and modifying option values

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)
 
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)
 
int  av_opt_set_array (void *obj, const char *name, int search_flags, unsigned int start_elem, unsigned int nb_elems, enum AVOptionType val_type, const void *val)
  Add, replace, or remove elements for an array option. More...
 

Detailed Description

Those functions 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. 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_flags flags 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
obj AVClass object to set options on
name name of the binary option
val pointer to an integer list (must have the correct type with regard to the contents of the list)
term list terminator (usually 0 or -1)
flags search flags

Definition at line 900 of file opt.h.

Function Documentation

av_opt_set()

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

Definition at line 835 of file opt.c.

Referenced by av_opt_set_dict2(), av_opt_set_from_string(), avcodec_open2(), avtext_context_open(), configure_audio_filters(), configure_filtergraph(), dump_stream_format(), dump_stream_group(), ff_filter_process_command(), ff_parse_opts_from_query_string(), filter_frame(), filter_opt_apply(), hls_start(), hls_write_packet(), init(), init_context_defaults(), init_filter(), init_filter_graph(), init_filters(), ist_add(), LLVMFuzzerTestOneInput(), main(), mmsh_open_internal(), multiview_setup(), new_stream_video(), nppscale_init(), nppscale_parse_expr(), nppscale_scale(), open_track_resource_context(), parse_key_value_pair(), process_command(), rtmp_http_open(), scale_frame(), scale_parse_expr(), segment_start(), set_dispositions(), store_icy(), and url_alloc_for_protocol().

av_opt_set_int()

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

Definition at line 880 of file opt.c.

Referenced by av1_decode_init(), avformat_find_stream_info(), config_audio_output(), config_input(), config_output(), configure_filtergraph(), draw_qrcode(), estimate_timings_from_pts(), ff_parse_opts_from_query_string(), init_filter_graph(), insert_trim(), lavfi_read_header(), LLVMFuzzerTestOneInput(), main(), open_audio(), opus_decode_init(), opus_init_resample(), output_single_frame(), process_client(), query_formats(), swr_alloc_set_opts2(), swr_config_frame(), and vaapi_encode_av1_init().

av_opt_set_double()

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

Definition at line 885 of file opt.c.

Referenced by config_output().

av_opt_set_q()

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

Definition at line 890 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 
)

Definition at line 895 of file opt.c.

Referenced by filter_opt_apply(), init_filter(), lavfi_read_header(), rtmp_calc_swfhash(), rtmp_http_open(), and rtmp_http_send_cmd().

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 922 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 974 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 979 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 945 of file opt.c.

av_opt_set_chlayout()

int av_opt_set_chlayout ( void *  obj,
const char *  name,
const AVChannelLayoutlayout,
int  search_flags 
)
Note
Any old chlayout present is discarded and replaced with a copy of the new one. The caller still owns layout and is responsible for uninitializing it.

Definition at line 1000 of file opt.c.

Referenced by config_audio_output(), config_props(), main(), open_audio(), opus_decode_init(), 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 AVDictionaryval,
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 984 of file opt.c.

Referenced by read_frame_internal().

av_opt_set_array()

int av_opt_set_array ( void *  obj,
const char *  name,
int  search_flags,
unsigned int  start_elem,
unsigned int  nb_elems,
enum AVOptionType  val_type,
const void *  val 
)

Add, replace, or remove elements for an array option.

Which of these operations is performed depends on the values of val and search_flags.

Parameters
start_elem Index of the first array element to modify; must not be larger than array size as returned by av_opt_get_array_size().
nb_elems number of array elements to modify; when val is NULL, start_elem+nb_elems must not be larger than array size as returned by av_opt_get_array_size()
val_type Option type corresponding to the type of val, ignored when val is NULL.

The effect of this function will will be as if av_opt_setX() was called for each element, where X is specified by type. E.g. AV_OPT_TYPE_STRING corresponds to av_opt_set().

Typically this should be the same as the scalarized type of the AVOption being set, but certain conversions are also possible - the same as those done by the corresponding av_opt_set*() function. E.g. any option type can be set from a string, numeric types can be set from int64, double, or rational, etc.

Parameters
val Array with nb_elems elements or NULL.
 When NULL, nb_elems array elements starting at start_elem are
 removed from the array. Any array elements remaining at the end
 are shifted by nb_elems towards the first element in order to keep
 the array contiguous.
 Otherwise (val is non-NULL), the type of val must match the
 underlying C type as documented for val_type.
 When AV_OPT_ARRAY_REPLACE is not set in search_flags, the array is
 enlarged by nb_elems, and the contents of val are inserted at
 start_elem. Previously existing array elements from start_elem
 onwards (if present) are shifted by nb_elems away from the first
 element in order to make space for the new elements.
 When AV_OPT_ARRAY_REPLACE is set in search_flags, the contents
 of val replace existing array elements from start_elem to
 start_elem+nb_elems (if present). New array size is
 max(start_elem + nb_elems, old array size).

Definition at line 2283 of file opt.c.

Referenced by configure_audio_filters(), configure_video_filters(), init_filters(), and multiview_setup().

flags
const SwsFlags flags[]
Definition: swscale.c:61
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:336
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:895

Generated on Sat Oct 18 2025 19:24:22 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /