Go to the documentation of this file.
52 if (!last &&
class &&
class->option &&
class->option[0].name)
54 if (last && last[1].
name)
63 *intnum = *(
unsigned int*)dst;
73 *intnum = *(
int *)dst;
75 #if FF_API_OLD_CHANNEL_LAYOUT
83 *intnum = *(int64_t *)dst;
89 *num = *(
double *)dst;
105 (!den || o->
max * den < num * intnum || o->
min * den > num * intnum)) {
106 num = den ? num * intnum / den : (num && intnum ?
INFINITY :
NAN);
112 double d = num*intnum/den;
113 if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (
llrint(
d*256) & 255)) {
115 "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n",
116 num*intnum/den, o->
name);
131 *(
int *)dst =
llrint(num / den) * intnum;
134 #if FF_API_OLD_CHANNEL_LAYOUT
140 double d = num / den;
141 if (intnum == 1 &&
d == (
double)INT64_MAX) {
142 *(int64_t *)dst = INT64_MAX;
144 *(int64_t *)dst =
llrint(
d) * intnum;
147 double d = num / den;
152 if (intnum == 1 &&
d == (
double)UINT64_MAX) {
153 *(uint64_t *)dst = UINT64_MAX;
154 }
else if (
d > INT64_MAX + 1ULL) {
155 *(uint64_t *)dst = (
llrint(
d - (INT64_MAX + 1ULL)) + (INT64_MAX + 1ULL))*intnum;
157 *(uint64_t *)dst =
llrint(
d) * intnum;
161 *(
float *)dst = num * intnum / den;
164 *(
double *)dst = num * intnum / den;
168 if ((
int) num == num)
180 if (
c >=
'0' &&
c <=
'9')
182 if (
c >=
'a' &&
c <=
'f')
184 if (
c >=
'A' &&
c <=
'F')
191 int *lendst = (
int *)(dst + 1);
211 if (
a < 0 ||
b < 0) {
215 *ptr++ = (
a << 4) |
b;
227 return *dst ? 0 :
AVERROR(ENOMEM);
230 #define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
231 opt->type == AV_OPT_TYPE_UINT64 || \
232 opt->type == AV_OPT_TYPE_CONST || \
233 opt->type == AV_OPT_TYPE_FLAGS || \
234 opt->type == AV_OPT_TYPE_INT) \
235 ? opt->default_val.i64 \
236 : opt->default_val.dbl)
245 if (sscanf(
val,
"%d%*1[:/]%d%c", &num, &den, &
c) == 2) {
260 if (*
val ==
'+' || *
val ==
'-')
262 for (;
i <
sizeof(buf) - 1 &&
val[
i] &&
val[
i] !=
'+' &&
val[
i] !=
'-';
i++)
318 d = intnum | (int64_t)
d;
320 d = intnum &~(int64_t)
d;
335 if (!
val || !strcmp(
val,
"none")) {
373 return val ?
"true" :
"false";
383 if (!strcmp(
val,
"auto")) {
391 n = strtol(
val, &end, 10);
392 if (
val + strlen(
val) != end)
396 if (n < o->
min || n > o->
max)
408 int fmt_nb,
int ((*get_fmt)(
const char *)),
const char *
desc)
412 if (!
val || !strcmp(
val,
"none")) {
418 fmt = strtol(
val, &tail, 0);
419 if (*tail || (
unsigned)fmt >= fmt_nb) {
421 "Unable to parse option value \"%s\" as %s\n",
val,
desc);
431 if(
min == 0 &&
max == 0) {
436 if (fmt < min || fmt >
max) {
438 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
478 const char *
val,
void *dst)
490 void *dst, *target_obj;
492 if (!o || !target_obj)
512 dst = ((uint8_t *)target_obj) + o->
offset;
550 if (usecs < o->
min || usecs > o->
max) {
552 usecs / 1000000.0, o->
name, o->
min / 1000000.0, o->
max / 1000000.0);
555 *(int64_t *)dst = usecs;
560 #if FF_API_OLD_CHANNEL_LAYOUT
563 if (!
val || !strcmp(
val,
"none")) {
571 *(int64_t *)dst = cl;
592 #define OPT_EVAL_NUMBER(name, opttype, vartype) \
593 int av_opt_eval_ ## name(void *obj, const AVOption *o, \
594 const char *val, vartype *name ## _out) \
596 if (!o || o->type != opttype || o->flags & AV_OPT_FLAG_READONLY) \
597 return AVERROR(EINVAL); \
598 return set_string_number(obj, obj, o, val, name ## _out); \
608 static
int set_number(
void *obj, const
char *
name,
double num,
int den, int64_t intnum,
611 void *dst, *target_obj;
614 if (!o || !target_obj)
620 dst = ((uint8_t *)target_obj) + o->
offset;
647 if (!o || !target_obj)
657 dst = (uint8_t **)(((uint8_t *)target_obj) + o->
offset);
658 lendst = (
int *)(dst + 1);
674 if (!o || !target_obj)
678 "The value set by option '%s' is not an image size.\n", o->
name);
683 "Invalid negative size value %dx%d for size '%s'\n",
w,
h, o->
name);
686 *(
int *)(((uint8_t *)target_obj) + o->
offset) =
w;
687 *(
int *)(((uint8_t *)target_obj+
sizeof(
int)) + o->
offset) =
h;
696 if (!o || !target_obj)
700 "The value set by option '%s' is not a video rate.\n", o->
name);
703 if (
val.num <= 0 ||
val.den <= 0)
713 search_flags, &target_obj);
716 if (!o || !target_obj)
720 "The value set by option '%s' is not a %s format",
name,
desc);
727 if (fmt < min || fmt >
max) {
729 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
733 *(
int *)(((uint8_t *)target_obj) + o->
offset) = fmt;
747 #if FF_API_OLD_CHANNEL_LAYOUT
754 if (!o || !target_obj)
758 "The value set by option '%s' is not a channel layout.\n", o->
name);
761 *(int64_t *)(((uint8_t *)target_obj) + o->
offset) = cl;
774 if (!o || !target_obj)
794 if (!o || !target_obj)
807 if (
d < 0 &&
d != INT64_MIN) {
814 else if (
d == INT64_MIN)
816 else if (
d > (int64_t)3600*1000000)
817 snprintf(buf,
size,
"%"PRId64
":%02d:%02d.%06d",
d / 3600000000,
818 (
int)((
d / 60000000) % 60),
819 (
int)((
d / 1000000) % 60),
821 else if (
d > 60*1000000)
824 (
int)((
d / 1000000) % 60),
830 e = buf + strlen(buf);
831 while (e > buf && e[-1] ==
'0')
833 if (e > buf && e[-1] ==
'.')
839 void *dst, *target_obj;
841 uint8_t *bin, buf[128];
851 dst = (uint8_t *)target_obj + o->
offset;
859 ret =
snprintf(buf,
sizeof(buf),
"0x%08X", *(
int *)dst);
862 ret =
snprintf(buf,
sizeof(buf),
"%d", *(
int *)dst);
865 ret =
snprintf(buf,
sizeof(buf),
"%"PRId64, *(int64_t *)dst);
868 ret =
snprintf(buf,
sizeof(buf),
"%"PRIu64, *(uint64_t *)dst);
871 ret =
snprintf(buf,
sizeof(buf),
"%f", *(
float *)dst);
874 ret =
snprintf(buf,
sizeof(buf),
"%f", *(
double *)dst);
884 if (*(uint8_t **)dst) {
892 return *out_val ? 0 :
AVERROR(ENOMEM);
898 len = *(
int *)(((uint8_t *)dst) +
sizeof(uint8_t *));
899 if ((uint64_t)
len * 2 + 1 > INT_MAX)
907 bin = *(uint8_t **)dst;
909 snprintf(*out_val +
i * 2, 3,
"%02X", bin[
i]);
912 ret =
snprintf(buf,
sizeof(buf),
"%dx%d", ((
int *)dst)[0], ((
int *)dst)[1]);
921 i64 = *(int64_t *)dst;
926 ret =
snprintf(buf,
sizeof(buf),
"0x%02x%02x%02x%02x",
927 (
int)((uint8_t *)dst)[0], (
int)((uint8_t *)dst)[1],
928 (
int)((uint8_t *)dst)[2], (
int)((uint8_t *)dst)[3]);
930 #if FF_API_OLD_CHANNEL_LAYOUT
934 i64 = *(int64_t *)dst;
935 ret =
snprintf(buf,
sizeof(buf),
"0x%"PRIx64, i64);
952 if (
ret >=
sizeof(buf))
955 return *out_val ? 0 :
AVERROR(ENOMEM);
961 void *dst, *target_obj;
963 if (!o || !target_obj)
966 dst = ((uint8_t *)target_obj) + o->
offset;
968 if (o_out) *o_out= o;
989 *out_val = num * intnum / den;
1001 *out_val = num * intnum / den;
1014 if (num == 1.0 && (
int)intnum == intnum)
1017 *out_val =
av_d2q(num*intnum/den, 1<<24);
1023 void *dst, *target_obj;
1025 if (!o || !target_obj)
1029 "The value for option '%s' is not an image size.\n",
name);
1033 dst = ((uint8_t*)target_obj) + o->
offset;
1034 if (w_out) *w_out = *(
int *)dst;
1035 if (h_out) *h_out = *((
int *)dst+1);
1048 if (num == 1.0 && (
int)intnum == intnum)
1051 *out_val =
av_d2q(num * intnum / den, 1 << 24);
1058 void *dst, *target_obj;
1060 if (!o || !target_obj)
1064 "The value for option '%s' is not a %s format.\n",
desc,
name);
1068 dst = ((uint8_t*)target_obj) + o->
offset;
1069 *out_fmt = *(
int *)dst;
1083 #if FF_API_OLD_CHANNEL_LAYOUT
1087 void *dst, *target_obj;
1089 if (!o || !target_obj)
1093 "The value for option '%s' is not a channel layout.\n",
name);
1097 dst = ((uint8_t*)target_obj) + o->
offset;
1098 *cl = *(int64_t *)dst;
1106 void *dst, *target_obj;
1108 if (!o || !target_obj)
1112 "The value for option '%s' is not a channel layout.\n",
name);
1116 dst = ((uint8_t*)target_obj) + o->
offset;
1126 if (!o || !target_obj)
1147 return res &
flag->default_val.i64;
1154 }
else if (
i == INT_MIN) {
1156 }
else if (
i == UINT32_MAX) {
1158 }
else if (
i == INT64_MAX) {
1160 }
else if (
i == INT64_MIN) {
1171 }
else if (
d == INT_MIN) {
1173 }
else if (
d == UINT32_MAX) {
1175 }
else if (
d == (
double)INT64_MAX) {
1177 }
else if (
d == INT64_MIN) {
1179 }
else if (
d == FLT_MAX) {
1181 }
else if (
d == FLT_MIN) {
1183 }
else if (
d == -FLT_MAX) {
1185 }
else if (
d == -FLT_MIN) {
1187 }
else if (
d == DBL_MAX) {
1189 }
else if (
d == DBL_MIN) {
1191 }
else if (
d == -DBL_MAX) {
1193 }
else if (
d == -DBL_MIN) {
1234 static void opt_list(
void *obj,
void *av_log_obj,
const char *unit,
1235 int req_flags,
int rej_flags,
enum AVOptionType parent_type)
1242 if (!(opt->
flags & req_flags) || (opt->
flags & rej_flags))
1262 switch (opt->
type) {
1312 #if FF_API_OLD_CHANNEL_LAYOUT
1348 switch (opt->
type) {
1355 for (
i = 0;
i <
r->nb_ranges;
i++) {
1377 switch (opt->
type) {
1429 #if FF_API_OLD_CHANNEL_LAYOUT
1446 int av_opt_show2(
void *obj,
void *av_log_obj,
int req_flags,
int rej_flags)
1453 opt_list(obj, av_log_obj,
NULL, req_flags, rej_flags, -1);
1467 void *dst = ((uint8_t*)
s) + opt->
offset;
1475 switch (opt->
type) {
1485 #if FF_API_OLD_CHANNEL_LAYOUT
1553 const char *key_val_sep,
const char *pairs_sep)
1562 if (*
key && strspn(*buf, key_val_sep)) {
1587 const char *key_val_sep,
const char *pairs_sep)
1606 #define WHITESPACES " \n\t\r"
1610 return (
unsigned)((
c | 32) -
'a') < 26 ||
1611 (unsigned)(
c -
'0') < 10 ||
1612 c ==
'-' ||
c ==
'_' ||
c ==
'/' ||
c ==
'.';
1623 static int get_key(
const char **ropts,
const char *delim,
char **rkey)
1625 const char *
opts = *ropts;
1626 const char *key_start, *key_end;
1633 if (!*
opts || !strchr(delim, *
opts))
1636 if (!(*rkey =
av_malloc(key_end - key_start + 1)))
1638 memcpy(*rkey, key_start, key_end - key_start);
1639 (*rkey)[key_end - key_start] = 0;
1645 const char *key_val_sep,
const char *pairs_sep,
1647 char **rkey,
char **rval)
1651 const char *
opts = *ropts;
1667 const char *
const *shorthand,
1668 const char *key_val_sep,
const char *pairs_sep)
1671 const char *dummy_shorthand =
NULL;
1678 shorthand = &dummy_shorthand;
1683 &parsed_key, &
value);
1699 key = *(shorthand++);
1772 int opt_flags,
int search_flags)
1778 int opt_flags,
int search_flags,
void **target_obj)
1801 if (o =
av_opt_find2(child,
name, unit, opt_flags, search_flags, target_obj))
1807 if (!strcmp(o->
name,
name) && (o->
flags & opt_flags) == opt_flags &&
1826 return c->child_next(obj, prev);
1842 return (uint8_t*)obj + opt->
offset;
1853 #if FF_API_OLD_CHANNEL_LAYOUT
1860 return sizeof(int64_t);
1864 return sizeof(
float);
1866 return sizeof(uint8_t*);
1871 return sizeof(uint8_t*) +
sizeof(
int);
1873 return sizeof(
int[2]);
1898 void *field_dst = (uint8_t *)dst + o->
offset;
1899 void *field_src = (uint8_t *)
src + o->
offset;
1900 uint8_t **field_dst8 = (uint8_t **)field_dst;
1901 uint8_t **field_src8 = (uint8_t **)field_src;
1904 if (*field_dst8 != *field_src8)
1907 if (*field_src8 && !*field_dst8)
1910 int len = *(
int *)(field_src8 + 1);
1911 if (*field_dst8 != *field_src8)
1914 if (
len && !*field_dst8) {
1918 *(
int *)(field_dst8 + 1) =
len;
1925 if (*sdict != *ddict)
1932 if (field_dst != field_src)
1939 memcpy(field_dst, field_src,
size);
1958 (*ranges_arg)->nb_components =
ret;
1973 if (!ranges || !range || !range_array || !
field) {
1978 ranges->
range = range_array;
1979 ranges->
range[0] = range;
1986 switch (
field->type) {
1997 #if FF_API_OLD_CHANNEL_LAYOUT
2030 *ranges_arg = ranges;
2071 dst = ((uint8_t*)obj) + o->
offset;
2081 #if FF_API_OLD_CHANNEL_LAYOUT
2100 str = *(
char **)dst;
2122 int opt_size = *(
int *)((
void **)dst + 1);
2123 void *opt_ptr = *(
void **)dst;
2132 ret = !memcmp(opt_ptr,
tmp.data,
tmp.size);
2149 }
while (en1 && en2 && !strcmp(en1->
key, en2->
key) && !strcmp(en1->
value, en2->
value));
2151 return (!en1 && !en2);
2158 return (
w == *(
int *)dst) && (
h == *((
int *)dst+1));
2167 uint8_t
color[4] = {0, 0, 0, 0};
2194 const char key_val_sep,
const char pairs_sep)
2200 const char special_chars[] = {pairs_sep, key_val_sep,
'\0'};
2202 if (pairs_sep ==
'\0' || key_val_sep ==
'\0' || pairs_sep == key_val_sep ||
2203 pairs_sep ==
'\\' || key_val_sep ==
'\\') {
2219 else if (((o->
flags & opt_flags) != opt_flags))
static void error(const char *err)
static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
#define OPT_EVAL_NUMBER(name, opttype, vartype)
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
#define FF_ENABLE_DEPRECATION_WARNINGS
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags)
AVPixelFormat
Pixel format.
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
static void log_int_value(void *av_log_obj, int level, int64_t i)
int nb_components
Number of componentes.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
void * av_opt_ptr(const AVClass *class, void *obj, const char *name)
Gets a pointer to the requested field in a struct.
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
double value_min
Value range.
static const char * get_opt_const_name(void *obj, const char *unit, int64_t value)
int nb_ranges
Number of ranges per component.
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_set_double(void *obj, const char *name, double val, int search_flags)
static int is_key_char(char c)
static int set_string_channel_layout(void *obj, const AVOption *o, const char *val, void *dst)
#define AV_OPT_FLAG_RUNTIME_PARAM
a generic parameter which can be set by the user at runtime
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
int av_opt_is_set_to_default(void *obj, const AVOption *o)
Check if given option is set to its default value.
const char * help
short English help text
const struct AVClass *(* child_class_iterate)(void **iter)
Iterate over the AVClasses corresponding to potential AVOptions-enabled children.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
static const double const_values[]
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_PIX_FMT_NB
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
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.
@ AV_OPT_TYPE_BINARY
offset must point to a pointer immediately followed by an int for the length
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT
Serialize options that exactly match opt_flags only.
int offset
The offset relative to the context structure where the option value is stored.
static const char * get_bool_name(int val)
#define AVERROR_OPTION_NOT_FOUND
Option not found.
static double val(void *priv, double ch)
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 type
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
FF_DISABLE_DEPRECATION_WARNINGS int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static const uint16_t mask[17]
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
FF_ENABLE_DEPRECATION_WARNINGS int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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 field
#define AV_OPT_FLAG_BSF_PARAM
a generic parameter which can be set by the user for bit stream filtering
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
#define AV_OPT_FLAG_AUDIO_PARAM
int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
Describe the class of an AVClass context structure.
int av_opt_set_video_rate(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 len, int search_flags)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static void log_value(void *av_log_obj, int level, double d)
int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
Rational number (pair of numerator and denominator).
static int set_format(void *obj, const char *name, int fmt, int search_flags, enum AVOptionType type, const char *desc, int nb_fmts)
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
Parse the key-value pairs list in opts.
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
double component_min
Value's component range.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
static int set_number(void *obj, const char *name, double num, int den, int64_t intnum, int search_flags)
void av_opt_free(void *obj)
Free all allocated objects in obj.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
AVOptionRange ** range
Array of option ranges.
static void opt_list(void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags, enum AVOptionType parent_type)
double min
minimum valid value for the option
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() is fake – only a double pointer to AVClass instead of a required poin...
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
const OptionDef options[]
A single allowed range of values, or a single allowed value.
@ AV_SAMPLE_FMT_NB
Number of sample formats. DO NOT USE if linking dynamically.
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS
Serialize options that are not set to default values only.
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
An AVChannelLayout holds information about the channel layout of audio data.
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *channel_layout, int search_flags)
static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum, int search_flags)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define FF_API_OLD_CHANNEL_LAYOUT
static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst, int fmt_nb, int((*get_fmt)(const char *)), const char *desc)
static int read_number(const AVOption *o, const void *dst, double *num, int *den, int64_t *intnum)
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.
static int hexchar2int(char c)
#define AV_OPT_ALLOW_NULL
In av_opt_get, return NULL if the option has a pointer type and is set to NULL, rather than returning...
void av_opt_set_defaults2(void *s, int mask, int flags)
Set the values of all AVOption fields to their default values.
@ AV_OPT_TYPE_CHANNEL_LAYOUT
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
const AVOption * av_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.
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
#define AV_LOG_INFO
Standard information.
#define DEFAULT_NUMVAL(opt)
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
#define i(width, name, range_min, range_max)
static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
static char * get_opt_flags_string(void *obj, const char *unit, int64_t value)
#define AV_OPT_MULTI_COMPONENT_RANGE
Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than one component for cert...
AVSampleFormat
Audio sample formats.
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 value
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
List of AVOptionRange structs.
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
static int get_key(const char **ropts, const char *delim, char **rkey)
Read a key from a string.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
static int opt_size(enum AVOptionType type)
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
Extract a key-value pair from the beginning of a string.
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape the content in src and append it to dstbuf.
static const char *const const_names[]
static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_t **dst)
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
const AVClass * av_opt_child_class_iterate(const AVClass *parent, void **iter)
Iterate over potential AVOptions-enabled children of parent.
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
FF_ENABLE_DEPRECATION_WARNINGS int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
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.
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.
#define FF_DISABLE_DEPRECATION_WARNINGS
int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
Get a default list of allowed ranges for the given option.
int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
Get a list of allowed ranges for the given option.
char * av_strdup(const char *s)
Duplicate a string.
#define AV_OPT_FLAG_SUBTITLE_PARAM
const char * unit
The logical unit to which the option belongs.
@ AV_OPT_FLAG_IMPLICIT_KEY
Accept to parse a value without a key; the key will then be returned as NULL.
void av_opt_freep_ranges(AVOptionRanges **rangesp)
Free an AVOptionRanges struct and set it to NULL.
int av_opt_copy(void *dst, const void *src)
Copy options from src object into dest object.
static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_get_string(const AVDictionary *m, char **buffer, const char key_val_sep, const char pairs_sep)
Get dictionary entries as a string.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
static void format_duration(char *buf, size_t size, int64_t d)
@ AV_ESCAPE_MODE_BACKSLASH
Use backslash escaping.
#define flags(name, subs,...)
static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)
union AVOption::@318 default_val
the default value for scalar options
int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
Show the obj options.
#define AV_OPT_FLAG_CHILD_CONSTS
set if option constants can also reside in child objects
double max
maximum valid value for the option
void * av_opt_child_next(void *obj, void *prev)
Iterate over AVOptions-enabled children of obj.
FF_DISABLE_DEPRECATION_WARNINGS int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl)
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
static int get_format(void *obj, const char *name, int search_flags, int *out_fmt, enum AVOptionType type, const char *desc)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
#define AV_OPT_FLAG_DEPRECATED
set if option is deprecated, users should refer to AVOption.help text for more information
int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)