45#define TYPE_BASE(type) ((type) & ~AV_OPT_TYPE_FLAG_ARRAY)
53 if (!last &&
class &&
class->option &&
class->option[0].name)
55 if (last && last[1].
name)
113 return (d && d->
sep) ? d->
sep :
',';
124 return (
unsigned *)((
const void *
const *)parray + 1);
150 for (
unsigned i = 0;
i < *count;
i++)
167 void **ptgt,
const AVOption **po,
void **pdst)
180 logctx = tgt ? obj :
NULL;
182 if (require_type && (o->
type != require_type)) {
184 "Tried to set option '%s' of type %s from value of type %s, "
191 unsigned *state_flags =
NULL;
196 if (
class->state_flags_offset)
197 state_flags = (
unsigned*)((uint8_t*)tgt +
class->state_flags_offset);
199 if (!state_flags && obj != tgt) {
201 if (
class->state_flags_offset)
202 state_flags = (
unsigned*)((uint8_t*)obj +
class->state_flags_offset);
207 "so cannot be set after the object has been initialized\n",
221 *pdst = tgt ? ((uint8_t *)tgt) + o->
offset :
NULL;
229 if ((!
r.num || !
r.den) && d)
238 *intnum = *(
unsigned int*)
dst;
248 *intnum = *(
int *)
dst;
251 *intnum = *(
unsigned int *)
dst;
259 *num = *(
float *)
dst;
262 *num = *(
double *)
dst;
276 double num,
int den,
int64_t intnum,
279 void *logctx =
dst ? obj :
NULL;
283 (!den || o->
max * den < num * intnum || o->
min * den > num * intnum)) {
284 num = den ? num * intnum / den : (num && intnum ?
INFINITY :
NAN);
290 double d = num*intnum/den;
291 if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (
llrint(d*256) & 255)) {
293 "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n",
294 num*intnum/den, o->
name);
313 *(
int *)
dst =
llrint(num / den) * intnum;
317 double d = num / den;
318 if (intnum == 1 && d == (
double)INT64_MAX) {
324 double d = num / den;
329 if (intnum == 1 && d == (
double)UINT64_MAX) {
330 *(uint64_t *)
dst = UINT64_MAX;
331 }
else if (d > INT64_MAX + 1ULL) {
332 *(uint64_t *)
dst = (
llrint(d - (INT64_MAX + 1ULL)) + (INT64_MAX + 1ULL))*intnum;
338 *(
float *)
dst = num * intnum / den;
341 *(
double *)
dst = num * intnum / den;
345 if ((
int) num == num)
357 if (
c >=
'0' &&
c <=
'9')
359 if (
c >=
'a' &&
c <=
'f')
361 if (
c >=
'A' &&
c <=
'F')
373 lendst = (
int *)(
dst + 1);
391 if (
a < 0 ||
b < 0) {
395 *ptr++ = (
a << 4) |
b;
419#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
420 opt->type == AV_OPT_TYPE_UINT64 || \
421 opt->type == AV_OPT_TYPE_CONST || \
422 opt->type == AV_OPT_TYPE_FLAGS || \
423 opt->type == AV_OPT_TYPE_UINT || \
424 opt->type == AV_OPT_TYPE_INT) \
425 ? opt->default_val.i64 \
426 : opt->default_val.dbl)
430 void *logctx =
dst ? obj :
NULL;
437 if (sscanf(
val,
"%d%*1[:/]%d%c", &num, &den, &
c) == 2) {
452 if (*
val ==
'+' || *
val ==
'-')
454 for (;
i <
sizeof(buf) - 1 &&
val[
i] &&
val[
i] !=
'+' &&
val[
i] !=
'-';
i++)
508 intnum = *(
unsigned int*)
dst;
525 void *logctx =
dst ? obj :
NULL;
529 if (!
val || !strcmp(
val,
"none")) {
546 void *logctx =
dst ? obj :
NULL;
558 void *logctx =
dst ? obj :
NULL;
579 return val ?
"true" :
"false";
584 void *logctx =
dst ? obj :
NULL;
590 if (!strcmp(
val,
"auto")) {
598 n = strtol(
val, &end, 10);
599 if (
val + strlen(
val) != end)
603 if (n < o->
min || n > o->
max)
616 int fmt_nb,
int ((*get_fmt)(
const char *)),
const char *
desc,
619 void *logctx =
dst ? obj :
NULL;
622 if (!
val || !strcmp(
val,
"none")) {
628 fmt = strtol(
val, &tail, 0);
629 if (*tail || (
unsigned)fmt >= fmt_nb) {
631 "Unable to parse \"%s\" option value \"%s\" as %s\n", o->
name,
val,
desc);
641 if(
min == 0 &&
max == 0) {
646 if (fmt < min || fmt >
max) {
648 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
657 default:
av_unreachable(
"set_string_fmt() is only called for pixel and sample formats");
710 const char *
val,
void *
dst)
718 channel_layout = &
tmp;
730 const char *
val,
void *
dst)
732 void *logctx =
dst ? obj :
NULL;
781 if (usecs < o->
min || usecs > o->
max) {
783 usecs / 1000000.0, o->
name, o->
min / 1000000.0, o->
max / 1000000.0);
808 const char *
val,
void *
dst)
815 void *logctx =
dst ? obj :
NULL;
817 unsigned nb_elems = 0;
833 "Cannot assign more than %u elements to array option %s\n",
839 for (; *
val;
val++, p++) {
840 if (*
val ==
'\\' &&
val[1])
842 else if (*
val == sep) {
858 memset(
tmp, 0, elem_size);
870 if (arr && nb_elems < arr->size_min) {
872 "Cannot assign fewer than %u elements to array option %s\n",
879 *((
void **)
dst) = elems;
893 void *
dst, *target_obj;
905#define OPT_EVAL_NUMBER(name, opttype, vartype) \
906int av_opt_eval_ ## name(void *obj, const AVOption *o, \
907 const char *val, vartype *name ## _out) \
909 if (!o || o->type != opttype || o->flags & AV_OPT_FLAG_READONLY) \
910 return AVERROR(EINVAL); \
911 return set_string_number(obj, obj, o, val, name ## _out); \
923 int search_flags,
int require_type)
970 lendst = (
int *)(
dst + 1);
998 "Invalid negative size value %dx%d for size '%s'\n",
w,
h, o->
name);
1032 if (fmt < min || fmt >
max) {
1034 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
1096 if (d < 0 && d != INT64_MIN) {
1102 snprintf(buf,
size,
"INT64_MAX");
1103 else if (d == INT64_MIN)
1104 snprintf(buf,
size,
"INT64_MIN");
1105 else if (d > (
int64_t)3600*1000000)
1106 snprintf(buf,
size,
"%"PRId64
":%02d:%02d.%06d", d / 3600000000,
1107 (
int)((d / 60000000) % 60),
1108 (
int)((d / 1000000) % 60),
1109 (
int)(d % 1000000));
1110 else if (d > 60*1000000)
1111 snprintf(buf,
size,
"%d:%02d.%06d",
1112 (
int)(d / 60000000),
1113 (
int)((d / 1000000) % 60),
1114 (
int)(d % 1000000));
1116 snprintf(buf,
size,
"%d.%06d",
1118 (
int)(d % 1000000));
1119 e = buf + strlen(buf);
1120 while (e > buf && e[-1] ==
'0')
1122 if (e > buf && e[-1] ==
'.')
1127 const void *
dst,
int search_flags)
1136 ret = snprintf(*pbuf, buf_len,
"0x%08X", *(
int *)
dst);
1139 ret = snprintf(*pbuf, buf_len,
"%d", *(
int *)
dst);
1142 ret = snprintf(*pbuf, buf_len,
"%u", *(
unsigned *)
dst);
1145 ret = snprintf(*pbuf, buf_len,
"%"PRId64, *(
int64_t *)
dst);
1148 ret = snprintf(*pbuf, buf_len,
"%"PRIu64, *(uint64_t *)
dst);
1151 ret = snprintf(*pbuf, buf_len,
"%f", *(
float *)
dst);
1154 ret = snprintf(*pbuf, buf_len,
"%f", *(
double *)
dst);
1164 if (*(uint8_t **)
dst) {
1172 return *pbuf ? 0 :
AVERROR(ENOMEM);
1181 len = *(
int *)(((uint8_t *)
dst) +
sizeof(uint8_t *));
1182 if ((uint64_t)
len * 2 + 1 > INT_MAX)
1190 bin = *(uint8_t **)
dst;
1191 for (
int i = 0;
i <
len;
i++)
1192 snprintf(*pbuf +
i * 2, 3,
"%02X", bin[
i]);
1196 ret = snprintf(*pbuf, buf_len,
"%dx%d", ((
int *)
dst)[0], ((
int *)
dst)[1]);
1207 ret = strlen(*pbuf);
1211 ret = snprintf(*pbuf, buf_len,
"0x%02x%02x%02x%02x",
1212 (
int)((uint8_t *)
dst)[0], (
int)((uint8_t *)
dst)[1],
1213 (
int)((uint8_t *)
dst)[2], (
int)((uint8_t *)
dst)[3]);
1236 uint8_t *str =
NULL;
1242 for (
unsigned i = 0;
i < count;
i++) {
1243 uint8_t buf[128], *
out = buf;
1251 out_len = strlen(
out);
1252 if (out_len > SIZE_MAX / 2 - !!
i ||
1253 !!
i + out_len * 2 > SIZE_MAX - str_len - 1) {
1260 ret =
av_reallocp(&str, str_len + 1 + out_len * 2 + !!
i);
1266 str[str_len++] = sep;
1269 for (
unsigned j = 0; j < out_len; j++) {
1271 if (
val == sep ||
val ==
'\\')
1272 str[str_len++] =
'\\';
1273 str[str_len++] =
val;
1293 void *
dst, *target_obj;
1295 uint8_t *
out, buf[128];
1304 dst = (uint8_t *)target_obj + o->
offset;
1328 if (ret >=
sizeof(buf))
1331 return *out_val ? 0 :
AVERROR(ENOMEM);
1337 void *
dst, *target_obj;
1339 if (!o || !target_obj)
1344 dst = ((uint8_t *)target_obj) + o->
offset;
1355 if ((ret =
get_number(obj,
name, &num, &den, &intnum, search_flags)) < 0)
1360 *out_val = num * intnum / den;
1370 if ((ret =
get_number(obj,
name, &num, &den, &intnum, search_flags)) < 0)
1372 *out_val = num * intnum / den;
1382 if ((ret =
get_number(obj,
name, &num, &den, &intnum, search_flags)) < 0)
1385 if (num == 1.0 && (
int)intnum == intnum)
1394 void *
dst, *target_obj;
1396 if (!o || !target_obj)
1400 "The value for option '%s' is not a image size.\n",
name);
1404 dst = ((uint8_t*)target_obj) + o->
offset;
1405 if (w_out) *w_out = *(
int *)
dst;
1406 if (h_out) *h_out = *((
int *)
dst+1);
1418 void *
dst, *target_obj;
1420 if (!o || !target_obj)
1424 "The value for option '%s' is not a %s format.\n",
desc,
name);
1428 dst = ((uint8_t*)target_obj) + o->
offset;
1449 void *
dst, *target_obj;
1451 if (!o || !target_obj)
1455 "The value for option '%s' is not a channel layout.\n",
name);
1459 dst = ((uint8_t*)target_obj) + o->
offset;
1469 if (!o || !target_obj)
1489 return res &
flag->default_val.i64;
1496 }
else if (
i == INT_MIN) {
1498 }
else if (
i == UINT32_MAX) {
1500 }
else if (
i == INT64_MAX) {
1502 }
else if (
i == INT64_MIN) {
1513 }
else if (d == INT_MIN) {
1515 }
else if (d == UINT32_MAX) {
1517 }
else if (d == (
double)INT64_MAX) {
1519 }
else if (d == INT64_MIN) {
1521 }
else if (d == FLT_MAX) {
1523 }
else if (d == FLT_MIN) {
1525 }
else if (d == -FLT_MAX) {
1527 }
else if (d == -FLT_MIN) {
1529 }
else if (d == DBL_MAX) {
1531 }
else if (d == DBL_MIN) {
1533 }
else if (d == -DBL_MAX) {
1535 }
else if (d == -DBL_MIN) {
1608 if (arr && arr->
def)
1614 switch (opt->
type) {
1671static void opt_list(
void *obj,
void *av_log_obj,
const char *unit,
1672 int req_flags,
int rej_flags,
enum AVOptionType parent_type)
1679 if (!(opt->
flags & req_flags) || (opt->
flags & rej_flags))
1699 log_type(av_log_obj, opt, parent_type);
1718 switch (opt->
type) {
1726 for (
i = 0;
i <
r->nb_ranges;
i++) {
1753 opt_list(obj, av_log_obj,
NULL, req_flags, rej_flags, -1);
1780 (sep <
'a' || sep >
'z') &&
1781 (sep <
'A' || sep >
'Z') &&
1782 (sep <
'0' || sep >
'9'));
1784 if (arr && arr->
def)
1790 switch (opt->
type) {
1864 const char *key_val_sep,
const char *pairs_sep)
1873 if (*
key && strspn(*buf, key_val_sep)) {
1898 const char *key_val_sep,
const char *pairs_sep)
1917#define WHITESPACES " \n\t\r"
1921 return (
unsigned)((
c | 32) -
'a') < 26 ||
1922 (
unsigned)(
c -
'0') < 10 ||
1923 c ==
'-' ||
c ==
'_' ||
c ==
'/' ||
c ==
'.';
1934static int get_key(
const char **ropts,
const char *delim,
char **rkey)
1936 const char *
opts = *ropts;
1937 const char *key_start, *key_end;
1944 if (!*
opts || !strchr(delim, *
opts))
1947 if (!(*rkey =
av_malloc(key_end - key_start + 1)))
1949 memcpy(*rkey, key_start, key_end - key_start);
1950 (*rkey)[key_end - key_start] = 0;
1956 const char *key_val_sep,
const char *pairs_sep,
1958 char **rkey,
char **rval)
1962 const char *
opts = *ropts;
1978 const char *
const *shorthand,
1979 const char *key_val_sep,
const char *pairs_sep)
1982 const char *dummy_shorthand =
NULL;
1988 shorthand = &dummy_shorthand;
1991 char *parsed_key, *
value;
1994 &parsed_key, &
value);
2010 key = *(shorthand++);
2033 void *pitem = (uint8_t *)obj + o->
offset;
2072 int opt_flags,
int search_flags)
2078 int opt_flags,
int search_flags,
void **target_obj)
2101 if (o =
av_opt_find2(child,
name, unit, opt_flags, search_flags, target_obj))
2107 if (!strcmp(o->
name,
name) && (o->
flags & opt_flags) == opt_flags &&
2126 return c->child_next(obj, prev);
2138 void *
dst,
const void *
src)
2141 const char *src_str = *(
const char *
const *)
src;
2142 char **dstp = (
char **)
dst;
2143 if (*dstp != src_str)
2151 const uint8_t *
const *src8 = (
const uint8_t *
const *)
src;
2152 uint8_t **dst8 = (uint8_t **)
dst;
2153 int len = *(
const int *)(src8 + 1);
2157 if (
len && !*dst8) {
2158 *(
int *)(dst8 + 1) = 0;
2161 *(
int *)(dst8 + 1) =
len;
2167 if (sdict != *ddictp)
2186 void **pdst,
const void *
const *psrc)
2192 if (*pdst == *psrc) {
2203 for (
unsigned i = 0;
i < nb_elems;
i++) {
2233 void *field_dst = (uint8_t *)
dst + o->
offset;
2234 void *field_src = (uint8_t *)
src + o->
offset;
2246 unsigned int *out_val)
2248 void *target_obj, *parray;
2252 if (!o || !target_obj)
2257 parray = (uint8_t *)target_obj + o->
offset;
2264 unsigned int start_elem,
unsigned int nb_elems,
2273 unsigned array_size;
2278 if (!o || !target_obj)
2284 parray = (uint8_t *)target_obj + o->
offset;
2287 if (start_elem >= array_size ||
2288 array_size - start_elem < nb_elems)
2291 for (
unsigned i = 0;
i < nb_elems;
i++) {
2293 void *
dst = (uint8_t*)out_val +
i * elem_size_out;
2300 uint8_t buf[128], *
out = buf;
2328 *(
int64_t*)
dst = (num == den) ? intnum : num * intnum / den;
2331 *(
double*)
dst = num * intnum / den;
2346 for (
unsigned i = 0;
i < nb_elems;
i++)
2352 unsigned int start_elem,
unsigned int nb_elems,
2363 unsigned *array_size, new_size;
2380 if (start_elem > *array_size)
2385 if (*array_size - start_elem < nb_elems)
2388 new_size = *array_size - nb_elems;
2390 if (start_elem >= UINT_MAX - nb_elems)
2393 new_size =
FFMAX(*array_size, start_elem + nb_elems);
2395 if (nb_elems >= UINT_MAX - *array_size)
2398 new_size = *array_size + nb_elems;
2403 (arr->
size_min && new_size < arr->size_min)))
2408 void *
array = *(
void**)parray;
2410 for (
unsigned i = 0;
i < nb_elems;
i++) {
2418 elem_size * (*array_size - start_elem - nb_elems));
2424 *(
void**)parray =
array;
2428 *array_size = new_size;
2436 new_elems =
av_calloc(nb_elems, elem_size);
2441 for (
unsigned i = 0;
i < nb_elems;
i++) {
2443 const void *
src = (uint8_t*)
val +
i * elem_size_val;
2459 (!den || o->
max * den < num * intnum || o->
min * den > num * intnum)) {
2460 num = den ? num * intnum / den : (num && intnum ?
INFINITY :
NAN);
2462 "parameter '%s': value %f out of range [%g - %g]\n",
2497 if (start_elem == 0 && nb_elems == new_size) {
2500 *(
void**)parray = new_elems;
2501 *array_size = nb_elems;
2514 for (
unsigned i = start_elem;
i <
FFMIN(start_elem + nb_elems, *array_size);
i++)
2520 elem_size * (*array_size - start_elem));
2523 memcpy((uint8_t*)
array + elem_size * start_elem, new_elems, elem_size * nb_elems);
2528 *(
void**)parray =
array;
2529 *array_size = new_size;
2551 (*ranges_arg)->nb_components = ret;
2566 if (!ranges || !
range || !range_array || !field) {
2571 ranges->
range = range_array;
2575 range->is_range = 1;
2579 switch (field->
type) {
2593 range->component_min = 0;
2594 range->component_max = 0x10FFFF;
2595 range->value_min = -1;
2596 range->value_max = INT_MAX;
2599 range->component_min = INT_MIN;
2600 range->component_max = INT_MAX;
2603 range->component_min = 0;
2604 range->component_max = INT_MAX/128/8;
2605 range->value_min = 0;
2606 range->value_max = INT_MAX/8;
2609 range->component_min = 1;
2610 range->component_max = INT_MAX;
2611 range->value_min = 1;
2612 range->value_max = INT_MAX;
2619 *ranges_arg = ranges;
2672 ret = !strcmp(
val, def);
2706 str = *(
char **)
dst;
2728 int opt_size = *(
int *)((
void **)
dst + 1);
2729 void *opt_ptr = *(
void **)
dst;
2738 ret = !memcmp(opt_ptr,
tmp.data,
tmp.size);
2755 }
while (en1 && en2 && !strcmp(en1->
key, en2->
key) && !strcmp(en1->
value, en2->
value));
2757 return (!en1 && !en2);
2764 return (
w == *(
int *)
dst) && (
h == *((
int *)
dst+1));
2773 uint8_t
color[4] = {0, 0, 0, 0};
2800 AVBPrint *bprint,
const char key_val_sep,
const char pairs_sep)
2806 const char special_chars[] = {pairs_sep, key_val_sep,
'\0'};
2811 key_val_sep, pairs_sep);
2821 else if (((o->
flags & opt_flags) != opt_flags))
2843 const char key_val_sep,
const char pairs_sep)
2848 if (pairs_sep ==
'\0' || key_val_sep ==
'\0' || pairs_sep == key_val_sep ||
2849 pairs_sep ==
'\\' || key_val_sep ==
'\\') {
2861 key_val_sep, pairs_sep);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
static AVFormatContext * ctx
static AVDictionary * opts
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Convenience header that includes libavutil's core.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
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.
simple arithmetic expression evaluator
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
#define AV_OPT_FLAG_BSF_PARAM
A generic parameter which can be set by the user for bit stream filtering.
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.
#define AV_OPT_FLAG_CHILD_CONSTS
Set if option constants can also reside in child objects.
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
#define AV_OPT_FLAG_DEPRECATED
Set if option is deprecated, users should refer to AVOption.help text for more information.
void av_opt_freep_ranges(AVOptionRanges **rangesp)
Free an AVOptionRanges struct and set it to NULL.
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.
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
#define AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
AVOptionType
An option type determines:
#define AV_OPT_FLAG_SUBTITLE_PARAM
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
#define AV_OPT_FLAG_RUNTIME_PARAM
A generic parameter which can be set by the user at runtime.
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_PIXEL_FMT
Underlying C type is enum AVPixelFormat.
@ AV_OPT_TYPE_BINARY
Underlying C type is a uint8_t* that is either NULL or points to an array allocated with the av_mallo...
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
@ AV_OPT_TYPE_FLAG_ARRAY
May be combined with another regular option type to declare an array option.
@ AV_OPT_TYPE_SAMPLE_FMT
Underlying C type is enum AVSampleFormat.
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
@ AV_OPT_TYPE_UINT64
Underlying C type is uint64_t.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
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_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
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.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
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.
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_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.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AVERROR_OPTION_NOT_FOUND
Option not found.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
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.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_NB
Number of sample formats. DO NOT USE if linking dynamically.
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
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...
@ AV_ESCAPE_MODE_BACKSLASH
Use backslash escaping.
int av_opt_get_array(void *obj, const char *name, int search_flags, unsigned int start_elem, unsigned int nb_elems, enum AVOptionType out_type, void *out_val)
For an array-type option, retrieve the values of one or more array elements.
int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
int av_opt_get_array_size(void *obj, const char *name, int search_flags, unsigned int *out_val)
For an array-type option, get the number of elements in the array.
int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
const AVClass * av_opt_child_class_iterate(const AVClass *parent, void **iter)
Iterate over potential AVOptions-enabled children of parent.
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.
#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...
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
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.
#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...
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.
#define AV_OPT_ARRAY_REPLACE
May be used with av_opt_set_array() to signal that new elements should replace the existing ones in t...
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() or av_opt_set() is fake – only a double pointer to AVClass instead of...
void av_opt_free(void *obj)
Free all allocated objects in obj.
void * av_opt_child_next(void *obj, void *prev)
Iterate over AVOptions-enabled children of obj.
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)
Set the values of all AVOption fields to their default values.
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
Show the obj options.
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
@ AV_OPT_FLAG_IMPLICIT_KEY
Accept to parse a value without a key; the key will then be returned as NULL.
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.
int av_opt_is_set_to_default(void *obj, const AVOption *o)
Check if given option is set to its default value.
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT
Serialize options that exactly match opt_flags only.
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.
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS
Serialize options that are not set to default values only.
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.
#define AV_OPT_SERIALIZE_SEARCH_CHILDREN
Serialize options in possible children of the given object.
int av_opt_set_double(void *obj, const char *name, double val, 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_int(void *obj, const char *name, int64_t val, int search_flags)
int av_opt_set_q(void *obj, const char *name, AVRational 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.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *channel_layout, int search_flags)
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
int av_opt_copy(void *dst, const void *src)
Copy options from src object into dest object.
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
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.
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.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
@ AV_CLASS_STATE_INITIALIZED
Object initialization has finished and it is now in the 'runtime' stage.
static const uint16_t mask[17]
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
#define OPT_EVAL_NUMBER(name, opttype, vartype)
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 opt_set_elem(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
static void log_type(void *av_log_obj, const AVOption *o, enum AVOptionType parent_type)
static int hexchar2int(char c)
static void format_duration(char *buf, size_t size, int64_t d)
static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
static int set_format(void *obj, const char *name, int fmt, int search_flags, enum AVOptionType type, const char *desc, int nb_fmts)
static int opt_set_array(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
static const struct @304073206145271053212042062205146224327011150156 opt_type_desc[]
static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
static int read_number(const AVOption *o, const void *dst, double *num, int *den, int64_t *intnum)
static int get_sample_fmt(const char *name)
static int opt_set_init(void *obj, const char *name, int search_flags, int require_type, void **ptgt, const AVOption **po, void **pdst)
Perform common setup for option-setting functions.
static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
static void log_int_value(void *av_log_obj, int level, int64_t i)
static void opt_free_array(const AVOption *o, void *parray, unsigned *count)
static const char * get_opt_const_name(void *obj, const char *unit, int64_t value)
static int is_key_char(char c)
#define DEFAULT_NUMVAL(opt)
static int get_pix_fmt(const char *name)
static int get_key(const char **ropts, const char *delim, char **rkey)
Read a key from a string.
static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
static int opt_get_elem(const AVOption *o, uint8_t **pbuf, size_t buf_len, const void *dst, int search_flags)
static int opt_copy_array(void *logctx, const AVOption *o, void **pdst, const void *const *psrc)
static void log_value(void *av_log_obj, int level, double d)
static char * get_opt_flags_string(void *obj, const char *unit, int64_t value)
static int set_number(void *obj, const char *name, double num, int den, int64_t intnum, int search_flags, int require_type)
static void log_default(void *obj, void *av_log_obj, const AVOption *opt)
static void opt_free_elem(enum AVOptionType type, void *ptr)
static const char * get_bool_name(int val)
static void * opt_array_pelem(const AVOption *o, void *array, unsigned idx)
static uint8_t opt_array_sep(const AVOption *o)
static int get_format(void *obj, const char *name, int search_flags, void *out_fmt, enum AVOptionType type, const char *desc)
static int opt_get_array(const AVOption *o, void *dst, uint8_t **out_val)
static AVRational double_to_rational(double d)
static void opt_list(void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags, enum AVOptionType parent_type)
static unsigned * opt_array_pcount(const void *parray)
static int opt_copy_elem(void *logctx, enum AVOptionType type, void *dst, const void *src)
static int get_number(void *obj, const char *name, double *num, int *den, int64_t *intnum, int search_flags)
static int opt_serialize(void *obj, int opt_flags, int flags, int *cnt, AVBPrint *bprint, const char key_val_sep, const char pairs_sep)
static int opt_is_pod(enum AVOptionType type)
static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_t **dst)
static int set_string_channel_layout(void *obj, const AVOption *o, const char *val, void *dst)
static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
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, enum AVOptionType type)
static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum, int ignore_range)
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.
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.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
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.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NB
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
Describe the class of an AVClass context structure.
const struct AVClass *(* child_class_iterate)(void **iter)
Iterate over the AVClasses corresponding to potential AVOptions-enabled children.
May be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
const char * def
Native access only.
unsigned size_min
Minimum number of elements in the array.
unsigned size_max
Maximum number of elements in the array, 0 when unlimited.
char sep
Separator between array elements in string representations of this option, used by av_opt_set() and a...
A single allowed range of values, or a single allowed value.
List of AVOptionRange structs.
int nb_ranges
Number of ranges per component.
AVOptionRange ** range
Array of option ranges.
int nb_components
Number of components.
double max
maximum valid value for the option
int offset
Native access only.
const char * unit
The logical unit to which the option belongs.
const char * help
short English help text
const AVOptionArrayDef * arr
Used for AV_OPT_TYPE_FLAG_ARRAY options.
double min
minimum valid value for the option
union AVOption::@264334322154243333237203365311152072005371076340 default_val
Native access only, except when documented otherwise.
int flags
A combination of AV_OPT_FLAG_*.
Rational number (pair of numerator and denominator).
static const double const_values[]
static const char *const const_names[]
static int array[MAX_W *MAX_W]