Go to the documentation of this file.
46 #define TYPE_BASE(type) ((type) & ~AV_OPT_TYPE_FLAG_ARRAY)
54 if (!last &&
class &&
class->option &&
class->option[0].name)
56 if (last && last[1].
name)
111 return (d && d->
sep) ? d->
sep :
',';
122 return (
unsigned *)((
const void *
const *)parray + 1);
148 for (
unsigned i = 0;
i < *count;
i++)
159 *intnum = *(
unsigned int*)
dst;
169 *intnum = *(
int *)
dst;
172 *intnum = *(
unsigned int *)
dst;
180 *num = *(
float *)
dst;
183 *num = *(
double *)
dst;
201 (!den || o->
max * den < num * intnum || o->
min * den > num * intnum)) {
202 num = den ? num * intnum / den : (num && intnum ?
INFINITY :
NAN);
208 double d = num*intnum/den;
209 if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (
llrint(d*256) & 255)) {
211 "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n",
212 num*intnum/den, o->
name);
228 *(
int *)
dst =
llrint(num / den) * intnum;
232 double d = num / den;
233 if (intnum == 1 && d == (
double)INT64_MAX) {
239 double d = num / den;
244 if (intnum == 1 && d == (
double)UINT64_MAX) {
245 *(uint64_t *)
dst = UINT64_MAX;
246 }
else if (d > INT64_MAX + 1ULL) {
247 *(uint64_t *)
dst = (
llrint(d - (INT64_MAX + 1ULL)) + (INT64_MAX + 1ULL))*intnum;
253 *(
float *)
dst = num * intnum / den;
256 *(
double *)
dst = num * intnum / den;
260 if ((
int) num == num)
272 if (
c >=
'0' &&
c <=
'9')
274 if (
c >=
'a' &&
c <=
'f')
276 if (
c >=
'A' &&
c <=
'F')
283 int *lendst = (
int *)(
dst + 1);
303 if (
a < 0 ||
b < 0) {
307 *ptr++ = (
a << 4) |
b;
324 #define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
325 opt->type == AV_OPT_TYPE_UINT64 || \
326 opt->type == AV_OPT_TYPE_CONST || \
327 opt->type == AV_OPT_TYPE_FLAGS || \
328 opt->type == AV_OPT_TYPE_UINT || \
329 opt->type == AV_OPT_TYPE_INT) \
330 ? opt->default_val.i64 \
331 : opt->default_val.dbl)
341 if (sscanf(
val,
"%d%*1[:/]%d%c", &num, &den, &
c) == 2) {
356 if (*
val ==
'+' || *
val ==
'-')
358 for (;
i <
sizeof(buf) - 1 &&
val[
i] &&
val[
i] !=
'+' &&
val[
i] !=
'-';
i++)
412 intnum = *(
unsigned int*)
dst;
431 if (!
val || !strcmp(
val,
"none")) {
469 return val ?
"true" :
"false";
479 if (!strcmp(
val,
"auto")) {
487 n = strtol(
val, &end, 10);
488 if (
val + strlen(
val) != end)
492 if (n < o->
min || n > o->
max)
504 int fmt_nb,
int ((*get_fmt)(
const char *)),
const char *
desc)
508 if (!
val || !strcmp(
val,
"none")) {
514 fmt = strtol(
val, &tail, 0);
515 if (*tail || (
unsigned)fmt >= fmt_nb) {
517 "Unable to parse option value \"%s\" as %s\n",
val,
desc);
527 if(
min == 0 &&
max == 0) {
532 if (fmt < min || fmt >
max) {
534 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
584 const char *
val,
void *
dst)
594 const char *
val,
void *
dst)
644 if (usecs < o->
min || usecs > o->
max) {
646 usecs / 1000000.0, o->
name, o->
min / 1000000.0, o->
max / 1000000.0);
670 const char *
val,
void *
dst)
678 unsigned nb_elems = 0;
694 "Cannot assign more than %u elements to array option %s\n",
700 for (; *
val;
val++, p++) {
701 if (*
val ==
'\\' &&
val[1])
703 else if (*
val == sep) {
719 memset(
tmp, 0, elem_size);
730 if (arr && nb_elems < arr->size_min) {
732 "Cannot assign fewer than %u elements to array option %s\n",
738 *((
void **)
dst) = elems;
750 void *
dst, *target_obj;
752 if (!o || !target_obj)
761 dst = ((uint8_t *)target_obj) + o->
offset;
767 #define OPT_EVAL_NUMBER(name, opttype, vartype) \
768 int av_opt_eval_ ## name(void *obj, const AVOption *o, \
769 const char *val, vartype *name ## _out) \
771 if (!o || o->type != opttype || o->flags & AV_OPT_FLAG_READONLY) \
772 return AVERROR(EINVAL); \
773 return set_string_number(obj, obj, o, val, name ## _out); \
787 void *
dst, *target_obj;
790 if (!o || !target_obj)
796 dst = ((uint8_t *)target_obj) + o->
offset;
823 if (!o || !target_obj)
833 dst = (uint8_t **)(((uint8_t *)target_obj) + o->
offset);
834 lendst = (
int *)(
dst + 1);
850 if (!o || !target_obj)
854 "The value set by option '%s' is not an image size.\n", o->
name);
859 "Invalid negative size value %dx%d for size '%s'\n",
w,
h, o->
name);
862 *(
int *)(((uint8_t *)target_obj) + o->
offset) =
w;
863 *(
int *)(((uint8_t *)target_obj+
sizeof(int)) + o->
offset) =
h;
872 if (!o || !target_obj)
876 "The value set by option '%s' is not a video rate.\n",
880 if (
val.num <= 0 ||
val.den <= 0)
890 search_flags, &target_obj);
893 if (!o || !target_obj)
897 "The value set by option '%s' is not a %s format",
name,
desc);
904 if (fmt < min || fmt >
max) {
906 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
910 *(
int *)(((uint8_t *)target_obj) + o->
offset) = fmt;
931 if (!o || !target_obj)
950 if (!o || !target_obj)
965 if (d < 0 && d != INT64_MIN) {
972 else if (d == INT64_MIN)
974 else if (d > (
int64_t)3600*1000000)
975 snprintf(buf,
size,
"%"PRId64
":%02d:%02d.%06d", d / 3600000000,
976 (
int)((d / 60000000) % 60),
977 (
int)((d / 1000000) % 60),
979 else if (d > 60*1000000)
982 (
int)((d / 1000000) % 60),
988 e = buf + strlen(buf);
989 while (e > buf && e[-1] ==
'0')
991 if (e > buf && e[-1] ==
'.')
996 const void *
dst,
int search_flags)
1033 if (*(uint8_t **)
dst) {
1041 return *pbuf ? 0 :
AVERROR(ENOMEM);
1050 len = *(
int *)(((uint8_t *)
dst) +
sizeof(uint8_t *));
1051 if ((uint64_t)
len * 2 + 1 > INT_MAX)
1059 bin = *(uint8_t **)
dst;
1060 for (
int i = 0;
i <
len;
i++)
1076 ret = strlen(*pbuf);
1080 ret =
snprintf(*pbuf, buf_len,
"0x%02x%02x%02x%02x",
1081 (
int)((uint8_t *)
dst)[0], (
int)((uint8_t *)
dst)[1],
1082 (
int)((uint8_t *)
dst)[2], (
int)((uint8_t *)
dst)[3]);
1105 uint8_t *str =
NULL;
1111 for (
unsigned i = 0;
i < count;
i++) {
1112 uint8_t buf[128], *
out = buf;
1120 out_len = strlen(
out);
1121 if (out_len > SIZE_MAX / 2 - !!
i ||
1122 !!
i + out_len * 2 > SIZE_MAX - str_len - 1) {
1135 str[str_len++] = sep;
1138 for (
unsigned j = 0; j < out_len; j++) {
1140 if (
val == sep ||
val ==
'\\')
1141 str[str_len++] =
'\\';
1142 str[str_len++] =
val;
1162 void *
dst, *target_obj;
1164 uint8_t *
out, buf[128];
1173 dst = (uint8_t *)target_obj + o->
offset;
1197 if (
ret >=
sizeof(buf))
1200 return *out_val ? 0 :
AVERROR(ENOMEM);
1206 void *
dst, *target_obj;
1208 if (!o || !target_obj)
1213 dst = ((uint8_t *)target_obj) + o->
offset;
1229 *out_val = num * intnum / den;
1241 *out_val = num * intnum / den;
1254 if (num == 1.0 && (
int)intnum == intnum)
1257 *out_val =
av_d2q(num*intnum/den, 1<<24);
1263 void *
dst, *target_obj;
1265 if (!o || !target_obj)
1269 "The value for option '%s' is not a image size.\n",
name);
1273 dst = ((uint8_t*)target_obj) + o->
offset;
1274 if (w_out) *w_out = *(
int *)
dst;
1275 if (h_out) *h_out = *((
int *)
dst+1);
1287 void *
dst, *target_obj;
1289 if (!o || !target_obj)
1293 "The value for option '%s' is not a %s format.\n",
desc,
name);
1297 dst = ((uint8_t*)target_obj) + o->
offset;
1298 *out_fmt = *(
int *)
dst;
1314 void *
dst, *target_obj;
1316 if (!o || !target_obj)
1320 "The value for option '%s' is not a channel layout.\n",
name);
1324 dst = ((uint8_t*)target_obj) + o->
offset;
1334 if (!o || !target_obj)
1354 return res &
flag->default_val.i64;
1361 }
else if (
i == INT_MIN) {
1363 }
else if (
i == UINT32_MAX) {
1365 }
else if (
i == INT64_MAX) {
1367 }
else if (
i == INT64_MIN) {
1378 }
else if (d == INT_MIN) {
1380 }
else if (d == UINT32_MAX) {
1382 }
else if (d == (
double)INT64_MAX) {
1384 }
else if (d == INT64_MIN) {
1386 }
else if (d == FLT_MAX) {
1388 }
else if (d == FLT_MIN) {
1390 }
else if (d == -FLT_MAX) {
1392 }
else if (d == -FLT_MIN) {
1394 }
else if (d == DBL_MAX) {
1396 }
else if (d == DBL_MIN) {
1398 }
else if (d == -DBL_MAX) {
1400 }
else if (d == -DBL_MIN) {
1444 const char *
desc[] = {
1494 if (arr && arr->
def)
1500 switch (opt->
type) {
1557 static void opt_list(
void *obj,
void *av_log_obj,
const char *unit,
1558 int req_flags,
int rej_flags,
enum AVOptionType parent_type)
1565 if (!(opt->
flags & req_flags) || (opt->
flags & rej_flags))
1585 log_type(av_log_obj, opt, parent_type);
1604 switch (opt->
type) {
1612 for (
i = 0;
i <
r->nb_ranges;
i++) {
1632 int av_opt_show2(
void *obj,
void *av_log_obj,
int req_flags,
int rej_flags)
1639 opt_list(obj, av_log_obj,
NULL, req_flags, rej_flags, -1);
1666 (sep < 'a' || sep >
'z') &&
1667 (sep < 'A' || sep >
'Z') &&
1668 (sep < '0' || sep >
'9'));
1670 if (arr && arr->
def)
1676 switch (opt->
type) {
1750 const char *key_val_sep,
const char *pairs_sep)
1759 if (*
key && strspn(*buf, key_val_sep)) {
1784 const char *key_val_sep,
const char *pairs_sep)
1803 #define WHITESPACES " \n\t\r"
1807 return (
unsigned)((
c | 32) -
'a') < 26 ||
1808 (unsigned)(
c -
'0') < 10 ||
1809 c ==
'-' ||
c ==
'_' ||
c ==
'/' ||
c ==
'.';
1820 static int get_key(
const char **ropts,
const char *delim,
char **rkey)
1822 const char *
opts = *ropts;
1823 const char *key_start, *key_end;
1830 if (!*
opts || !strchr(delim, *
opts))
1833 if (!(*rkey =
av_malloc(key_end - key_start + 1)))
1835 memcpy(*rkey, key_start, key_end - key_start);
1836 (*rkey)[key_end - key_start] = 0;
1842 const char *key_val_sep,
const char *pairs_sep,
1844 char **rkey,
char **rval)
1848 const char *
opts = *ropts;
1864 const char *
const *shorthand,
1865 const char *key_val_sep,
const char *pairs_sep)
1868 const char *dummy_shorthand =
NULL;
1874 shorthand = &dummy_shorthand;
1877 char *parsed_key, *
value;
1880 &parsed_key, &
value);
1896 key = *(shorthand++);
1919 void *pitem = (uint8_t *)obj + o->
offset;
1958 int opt_flags,
int search_flags)
1964 int opt_flags,
int search_flags,
void **target_obj)
1987 if (o =
av_opt_find2(child,
name, unit, opt_flags, search_flags, target_obj))
1993 if (!strcmp(o->
name,
name) && (o->
flags & opt_flags) == opt_flags &&
2012 return c->child_next(obj, prev);
2030 return (uint8_t*)obj + opt->
offset;
2034 void *
dst,
const void *
src)
2037 const char *src_str = *(
const char *
const *)
src;
2038 char **dstp = (
char **)
dst;
2039 if (*dstp != src_str)
2047 const uint8_t *
const *src8 = (
const uint8_t *
const *)
src;
2048 uint8_t **dst8 = (uint8_t **)
dst;
2049 int len = *(
const int *)(src8 + 1);
2053 if (
len && !*dst8) {
2054 *(
int *)(dst8 + 1) = 0;
2057 *(
int *)(dst8 + 1) =
len;
2063 if (sdict != *ddictp)
2082 void **pdst,
const void *
const *psrc)
2088 if (*pdst == *psrc) {
2099 for (
unsigned i = 0;
i < nb_elems;
i++) {
2129 void *field_dst = (uint8_t *)
dst + o->
offset;
2130 void *field_src = (uint8_t *)
src + o->
offset;
2142 unsigned int *out_val)
2144 void *target_obj, *parray;
2148 if (!o || !target_obj)
2153 parray = (uint8_t *)target_obj + o->
offset;
2160 unsigned int start_elem,
unsigned int nb_elems,
2169 unsigned array_size;
2174 if (!o || !target_obj)
2180 parray = (uint8_t *)target_obj + o->
offset;
2183 if (start_elem >= array_size ||
2184 array_size - start_elem < nb_elems)
2187 for (
unsigned i = 0;
i < nb_elems;
i++) {
2189 void *
dst = (uint8_t*)out_val +
i * elem_size_out;
2196 uint8_t buf[128], *
out = buf;
2224 *(
int64_t*)
dst = (num == den) ? intnum : num * intnum / den;
2227 *(
double*)
dst = num * intnum / den;
2232 av_d2q(num * intnum / den, 1<<24);
2242 for (
unsigned i = 0;
i < nb_elems;
i++)
2248 unsigned int start_elem,
unsigned int nb_elems,
2259 unsigned *array_size, new_size;
2265 if (!o || !target_obj)
2272 parray = (uint8_t *)target_obj + o->
offset;
2276 if (start_elem > *array_size)
2281 if (*array_size - start_elem < nb_elems)
2284 new_size = *array_size - nb_elems;
2286 if (start_elem >= UINT_MAX - nb_elems)
2289 new_size =
FFMAX(*array_size, start_elem + nb_elems);
2291 if (nb_elems >= UINT_MAX - *array_size)
2294 new_size = *array_size + nb_elems;
2299 (arr->
size_min && new_size < arr->size_min)))
2304 void *
array = *(
void**)parray;
2306 for (
unsigned i = 0;
i < nb_elems;
i++) {
2314 elem_size * (*array_size - start_elem - nb_elems));
2320 *(
void**)parray =
array;
2324 *array_size = new_size;
2332 new_elems =
av_calloc(nb_elems, elem_size);
2337 for (
unsigned i = 0;
i < nb_elems;
i++) {
2339 const void *
src = (uint8_t*)
val +
i * elem_size_val;
2353 (!den || o->
max * den < num * intnum || o->
min * den > num * intnum)) {
2354 num = den ? num * intnum / den : (num && intnum ?
INFINITY :
NAN);
2356 "parameter '%s': value %f out of range [%g - %g]\n",
2391 if (start_elem == 0 && nb_elems == new_size) {
2394 *(
void**)parray = new_elems;
2395 *array_size = nb_elems;
2408 for (
unsigned i = start_elem;
i <
FFMIN(start_elem + nb_elems, *array_size);
i++)
2414 elem_size * (*array_size - start_elem));
2417 memcpy((uint8_t*)
array + elem_size * start_elem, new_elems, elem_size * nb_elems);
2422 *(
void**)parray =
array;
2423 *array_size = new_size;
2445 (*ranges_arg)->nb_components =
ret;
2460 if (!ranges || !
range || !range_array || !
field) {
2465 ranges->
range = range_array;
2469 range->is_range = 1;
2473 switch (
field->type) {
2487 range->component_min = 0;
2488 range->component_max = 0x10FFFF;
2489 range->value_min = -1;
2490 range->value_max = INT_MAX;
2493 range->component_min = INT_MIN;
2494 range->component_max = INT_MAX;
2497 range->component_min = 0;
2498 range->component_max = INT_MAX/128/8;
2499 range->value_min = 0;
2500 range->value_max = INT_MAX/8;
2503 range->component_min = 1;
2504 range->component_max = INT_MAX;
2505 range->value_min = 1;
2506 range->value_max = INT_MAX;
2513 *ranges_arg = ranges;
2598 str = *(
char **)
dst;
2618 int opt_size = *(
int *)((
void **)
dst + 1);
2619 void *opt_ptr = *(
void **)
dst;
2628 ret = !memcmp(opt_ptr,
tmp.data,
tmp.size);
2645 }
while (en1 && en2 && !strcmp(en1->
key, en2->
key) && !strcmp(en1->
value, en2->
value));
2647 return (!en1 && !en2);
2654 return (
w == *(
int *)
dst) && (
h == *((
int *)
dst+1));
2663 uint8_t
color[4] = {0, 0, 0, 0};
2690 AVBPrint *bprint,
const char key_val_sep,
const char pairs_sep)
2696 const char special_chars[] = {pairs_sep, key_val_sep,
'\0'};
2701 key_val_sep, pairs_sep);
2711 else if (((o->
flags & opt_flags) != opt_flags))
2733 const char key_val_sep,
const char pairs_sep)
2738 if (pairs_sep ==
'\0' || key_val_sep ==
'\0' || pairs_sep == key_val_sep ||
2739 pairs_sep ==
'\\' || key_val_sep ==
'\\') {
2751 key_val_sep, pairs_sep);
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
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 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.
static void log_default(void *obj, void *av_log_obj, const AVOption *opt)
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.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
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
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.
@ AV_OPT_TYPE_SAMPLE_FMT
Underlying C type is enum AVSampleFormat.
static int get_pix_fmt(const char *name)
const AVClass * av_opt_child_class_iterate(const AVClass *parent, void **iter)
Iterate over potential AVOptions-enabled children of parent.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
char sep
Separator between array elements in string representations of this option, used by av_opt_set() and a...
AVOptionType
An option type determines:
May be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
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
Underlying C type is AVRational.
const AVOptionArrayDef * arr
Used for AV_OPT_TYPE_FLAG_ARRAY options.
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_set_double(void *obj, const char *name, double val, int search_flags)
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.
static int is_key_char(char c)
static int set_string_channel_layout(void *obj, const AVOption *o, const char *val, void *dst)
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
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.
const char * help
short English help text
int flags
A combination of AV_OPT_FLAG_*.
const struct AVClass *(* child_class_iterate)(void **iter)
Iterate over the AVClasses corresponding to potential AVOptions-enabled children.
union AVOption::@442 default_val
Native access only, except when documented otherwise.
static int opt_copy_array(void *logctx, const AVOption *o, void **pdst, const void *const *psrc)
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
static unsigned * opt_array_pcount(const void *parray)
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
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.
static const double const_values[]
@ 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().
#define AV_OPT_SERIALIZE_SEARCH_CHILDREN
Serialize options in possible children of the given object.
@ 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...
int av_opt_is_set_to_default(void *obj, const AVOption *o)
Check if given option is set to its default value.
int offset
Native access only.
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.
static const char * get_bool_name(int val)
void av_opt_free(void *obj)
Free all allocated objects in obj.
#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)
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS
Serialize options that are not set to default values only.
#define AV_OPT_FLAG_AUDIO_PARAM
static void opt_free_array(const AVOption *o, void *parray, unsigned *count)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
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.
const char * def
Native access only.
#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...
static int opt_copy_elem(void *logctx, enum AVOptionType type, void *dst, const void *src)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
#define AV_OPT_FLAG_CHILD_CONSTS
Set if option constants can also reside in child objects.
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)
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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.
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
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.
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_BSF_PARAM
A generic parameter which can be set by the user for bit stream filtering.
int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
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)
unsigned size_max
Maximum number of elements in the array, 0 when unlimited.
static void log_type(void *av_log_obj, const AVOption *o, enum AVOptionType parent_type)
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.
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
static int opt_set_elem(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
static void log_value(void *av_log_obj, int level, double d)
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_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)
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
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)
#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...
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_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.
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
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)
int av_opt_copy(void *dst, const void *src)
Copy options from src object into dest object.
static int opt_is_pod(enum AVOptionType type)
const OptionDef options[]
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
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.
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.
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.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
An AVChannelLayout holds information about the channel layout of audio data.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
@ AV_OPT_TYPE_FLAG_ARRAY
May be combined with another regular option type to declare an array option.
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *channel_layout, int search_flags)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
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)
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
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
Show the obj options.
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)
static int get_sample_fmt(const char *name)
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
#define AV_LOG_INFO
Standard information.
#define DEFAULT_NUMVAL(opt)
void * av_opt_ptr(const AVClass *class, void *obj, const char *name)
Gets a pointer to the requested field in a struct.
static void * opt_array_pelem(const AVOption *o, void *array, unsigned idx)
static int get_number(void *obj, const char *name, double *num, int *den, int64_t *intnum, int search_flags)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
#define AV_OPT_FLAG_DEPRECATED
Set if option is deprecated, users should refer to AVOption.help text for more information.
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
#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)
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
#define AV_OPT_FLAG_SUBTITLE_PARAM
static char * get_opt_flags_string(void *obj, const char *unit, int64_t value)
static const size_t opt_elem_size[]
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
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
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
#define AV_OPT_FLAG_VIDEO_PARAM
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...
#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...
List of AVOptionRange structs.
void * av_calloc(size_t nmemb, size_t size)
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 array[MAX_W *MAX_W]
static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
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 uint8_t opt_array_sep(const AVOption *o)
static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
static int opt_serialize(void *obj, int opt_flags, int flags, int *cnt, AVBPrint *bprint, const char key_val_sep, const char pairs_sep)
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
#define AV_OPT_FLAG_RUNTIME_PARAM
A generic parameter which can be set by the user at runtime.
@ AV_OPT_TYPE_INT
Underlying C type is int.
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...
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_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.
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT
Serialize options that exactly match opt_flags only.
void * av_opt_child_next(void *obj, void *prev)
Iterate over AVOptions-enabled children of obj.
@ AV_OPT_TYPE_PIXEL_FMT
Underlying C type is enum AVPixelFormat.
void av_opt_set_defaults2(void *s, int mask, int flags)
Set the values of all AVOption fields to their default values.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
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_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
unsigned size_min
Minimum number of elements in the array.
@ AV_OPT_FLAG_IMPLICIT_KEY
Accept to parse a value without a key; the key will then be returned as NULL.
#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 char * unit
The logical unit to which the option belongs.
void av_opt_freep_ranges(AVOptionRanges **rangesp)
Free an AVOptionRanges struct and set it to NULL.
static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
static int opt_set_array(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
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.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
#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_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)
@ 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...
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)
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
double max
maximum valid value for the option
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
static void opt_free_elem(enum AVOptionType type, void *ptr)
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.
static int opt_get_elem(const AVOption *o, uint8_t **pbuf, size_t buf_len, const void *dst, int search_flags)
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 opt_get_array(const AVOption *o, void *dst, uint8_t **out_val)
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
@ AV_OPT_TYPE_UINT64
Underlying C type is uint64_t.
int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)