44 #if FF_API_OLD_AVOPTIONS
57 if (!last &&
class &&
class->option &&
class->option[0].name)
59 if (last && last[1].
name)
87 (o->
max * den < num * intnum || o->
min * den > num * intnum)) {
88 num = den ? num*intnum/den : (num*intnum ?
INFINITY :
NAN);
94 double d = num*intnum/den;
95 if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (
llrint(d*256) & 255)) {
97 "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n",
98 num*intnum/den, o->
name);
124 if (c >=
'0' && c <=
'9')
return c -
'0';
125 if (c >=
'a' && c <=
'f')
return c -
'a' + 10;
126 if (c >=
'A' && c <=
'F')
return c -
'A' + 10;
132 int *lendst = (
int *)(dst + 1);
139 if (!val || !(len = strlen(val)))
152 if (a < 0 || b < 0) {
156 *ptr++ = (a << 4) | b;
168 return *dst ? 0 :
AVERROR(ENOMEM);
171 #define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
172 opt->type == AV_OPT_TYPE_CONST || \
173 opt->type == AV_OPT_TYPE_FLAGS || \
174 opt->type == AV_OPT_TYPE_INT) ? \
175 opt->default_val.i64 : opt->default_val.dbl)
183 if (sscanf(val,
"%d%*1[:/]%d%c", &num, &den, &c) == 2) {
184 if ((ret =
write_number(obj, o, dst, 1, den, num)) >= 0)
197 if (*val ==
'+' || *val ==
'-')
199 for (; i <
sizeof(
buf) - 1 && val[i] && val[i] !=
'+' && val[i] !=
'-'; i++)
208 double const_values[64];
209 const char * const_names[64];
222 const_names [ci ] = o_named->
name;
227 const_names [ci ] =
"default";
229 const_names [ci ] =
"max";
230 const_values[ci++] = o->
max;
231 const_names [ci ] =
"min";
232 const_values[ci++] = o->
min;
233 const_names [ci ] =
"none";
234 const_values[ci++] = 0;
235 const_names [ci ] =
"all";
236 const_values[ci++] = ~0;
237 const_names [ci] =
NULL;
238 const_values[ci] = 0;
250 if (cmd ==
'+') d = intnum | (int64_t)d;
251 else if (cmd ==
'-') d = intnum &~(int64_t)d;
268 if (!val || !strcmp(val,
"none")) {
275 av_log(obj,
AV_LOG_ERROR,
"Unable to parse option value \"%s\" as image size\n", val);
288 av_log(obj,
AV_LOG_ERROR,
"Unable to parse option value \"%s\" as video rate\n", val);
308 int fmt_nb,
int ((*get_fmt)(
const char *)),
const char *desc)
312 if (!val || !strcmp(val,
"none")) {
318 fmt = strtol(val, &tail, 0);
319 if (*tail || (
unsigned)fmt >= fmt_nb) {
321 "Unable to parse option value \"%s\" as %s\n", val, desc);
331 if(min == 0 && max == 0) {
336 if (fmt < min || fmt > max) {
338 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
339 fmt, o->
name, desc, min, max);
359 #if FF_API_OLD_AVOPTIONS
372 void *dst, *target_obj;
374 if (!o || !target_obj)
412 if (!val || !strcmp(val,
"none")) {
415 #if FF_API_GET_CHANNEL_LAYOUT_COMPAT
421 av_log(obj,
AV_LOG_ERROR,
"Unable to parse option value \"%s\" as channel layout\n", val);
424 *(int64_t *)dst = cl;
434 #define OPT_EVAL_NUMBER(name, opttype, vartype)\
435 int av_opt_eval_ ## name(void *obj, const AVOption *o, const char *val, vartype *name ## _out)\
437 if (!o || o->type != opttype || o->flags & AV_OPT_FLAG_READONLY)\
438 return AVERROR(EINVAL);\
439 return set_string_number(obj, obj, o, val, name ## _out);\
449 static
int set_number(
void *obj, const
char *
name,
double num,
int den, int64_t intnum,
452 void *dst, *target_obj;
455 if (!o || !target_obj)
465 #if FF_API_OLD_AVOPTIONS
493 return set_number(obj, name, 1, 1, val, search_flags);
498 return set_number(obj, name, val, 1, 1, search_flags);
514 if (!o || !target_obj)
525 lendst = (
int *)(dst + 1);
531 memcpy(ptr, val, len);
541 if (!o || !target_obj)
545 "The value set by option '%s' is not an image size.\n", o->
name);
550 "Invalid negative size value %dx%d for size '%s'\n", w, h, o->
name);
554 *(
int *)(((
uint8_t *)target_obj+
sizeof(int)) + o->
offset) = h;
563 if (!o || !target_obj)
567 "The value set by option '%s' is not a video rate.\n", o->
name);
570 if (val.
num <= 0 || val.
den <= 0)
580 search_flags, &target_obj);
583 if (!o || !target_obj)
585 if (o->
type != type) {
587 "The value set by option '%s' is not a %s format", name, desc);
594 if (fmt < min || fmt > max) {
596 "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
597 fmt, name, desc, min, max);
619 if (!o || !target_obj)
623 "The value set by option '%s' is not a channel layout.\n", o->
name);
630 #if FF_API_OLD_AVOPTIONS
648 if (o_out) *o_out= o;
661 if (len >= (buf_len + 1)/2)
return NULL;
663 for (i = 0; i <
len; i++)
snprintf(buf + i*2, 3,
"%02X", bin[i]);
665 default:
return NULL;
677 if (!o || !target_obj)
691 void *dst, *target_obj;
717 return *out_val ? 0 :
AVERROR(ENOMEM);
720 if ((uint64_t)len*2 + 1 > INT_MAX)
729 for (i = 0; i <
len; i++)
730 snprintf(*out_val + i*2, 3,
"%02X", bin[i]);
733 ret =
snprintf(buf,
sizeof(buf),
"%dx%d", ((
int *)dst)[0], ((
int *)dst)[1]);
742 i64 = *(int64_t *)dst;
743 ret =
snprintf(buf,
sizeof(buf),
"%"PRIi64
":%02d:%02d.%06d",
744 i64 / 3600000000, (
int)((i64 / 60000000) % 60),
745 (
int)((i64 / 1000000) % 60), (
int)(i64 % 1000000));
748 ret =
snprintf(buf,
sizeof(buf),
"0x%02x%02x%02x%02x",
753 i64 = *(int64_t *)dst;
754 ret =
snprintf(buf,
sizeof(buf),
"0x%"PRIx64, i64);
760 if (ret >=
sizeof(buf))
763 return *out_val ? 0 :
AVERROR(ENOMEM);
769 void *dst, *target_obj;
771 if (!o || !target_obj)
776 if (o_out) *o_out= o;
785 #if FF_API_OLD_AVOPTIONS
792 if (
get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0)
794 return num*intnum/den;
803 if (
get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0)
805 if (num == 1.0 && (
int)intnum == intnum)
808 return av_d2q(num*intnum/den, 1<<24);
817 if (
get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0)
819 return num*intnum/den;
829 if ((ret =
get_number(obj, name,
NULL, &num, &den, &intnum, search_flags)) < 0)
831 *out_val = num*intnum/den;
841 if ((ret =
get_number(obj, name,
NULL, &num, &den, &intnum, search_flags)) < 0)
843 *out_val = num*intnum/den;
853 if ((ret =
get_number(obj, name,
NULL, &num, &den, &intnum, search_flags)) < 0)
856 if (num == 1.0 && (
int)intnum == intnum)
859 *out_val =
av_d2q(num*intnum/den, 1<<24);
865 void *dst, *target_obj;
867 if (!o || !target_obj)
871 "The value for option '%s' is not an image size.\n", name);
876 if (w_out) *w_out = *(
int *)dst;
877 if (h_out) *h_out = *((
int *)dst+1);
887 if ((ret =
get_number(obj, name,
NULL, &num, &den, &intnum, search_flags)) < 0)
890 if (num == 1.0 && (
int)intnum == intnum)
893 *out_val =
av_d2q(num*intnum/den, 1<<24);
897 static int get_format(
void *obj,
const char *
name,
int search_flags,
int *out_fmt,
900 void *dst, *target_obj;
902 if (!o || !target_obj)
904 if (o->
type != type) {
906 "The value for option '%s' is not a %s format.\n", desc, name);
911 *out_fmt = *(
int *)dst;
927 void *dst, *target_obj;
929 if (!o || !target_obj)
933 "The value for option '%s' is not a channel layout.\n", name);
938 *cl = *(int64_t *)dst;
948 if (!o || !target_obj)
975 av_log(av_log_obj, level,
"INT_MAX");
976 }
else if (d == INT_MIN) {
977 av_log(av_log_obj, level,
"INT_MIN");
978 }
else if (d == UINT32_MAX) {
979 av_log(av_log_obj, level,
"UINT32_MAX");
980 }
else if (d == (
double)INT64_MAX) {
981 av_log(av_log_obj, level,
"I64_MAX");
982 }
else if (d == INT64_MIN) {
983 av_log(av_log_obj, level,
"I64_MIN");
984 }
else if (d == FLT_MAX) {
985 av_log(av_log_obj, level,
"FLT_MAX");
986 }
else if (d == FLT_MIN) {
987 av_log(av_log_obj, level,
"FLT_MIN");
988 }
else if (d == -FLT_MAX) {
989 av_log(av_log_obj, level,
"-FLT_MAX");
990 }
else if (d == -FLT_MIN) {
991 av_log(av_log_obj, level,
"-FLT_MIN");
992 }
else if (d == DBL_MAX) {
993 av_log(av_log_obj, level,
"DBL_MAX");
994 }
else if (d == DBL_MIN) {
995 av_log(av_log_obj, level,
"DBL_MIN");
996 }
else if (d == -DBL_MAX) {
997 av_log(av_log_obj, level,
"-DBL_MAX");
998 }
else if (d == -DBL_MIN) {
999 av_log(av_log_obj, level,
"-DBL_MIN");
1001 av_log(av_log_obj, level,
"%g", d);
1005 static void opt_list(
void *obj,
void *av_log_obj,
const char *unit,
1006 int req_flags,
int rej_flags)
1013 if (!(opt->
flags & req_flags) || (opt->
flags & rej_flags))
1033 switch (opt->
type) {
1097 switch (opt->
type) {
1123 switch (opt->
type) {
1161 opt_list(obj, av_log_obj, opt->
unit, req_flags, rej_flags);
1166 int av_opt_show2(
void *obj,
void *av_log_obj,
int req_flags,
int rej_flags)
1195 switch (opt->
type) {
1267 const char *key_val_sep,
const char *pairs_sep)
1276 if (*key && strspn(*buf, key_val_sep)) {
1284 av_log(ctx,
AV_LOG_ERROR,
"Missing key or no key/value separator found after key '%s'\n", key);
1301 const char *key_val_sep,
const char *pairs_sep)
1320 #define WHITESPACES " \n\t"
1324 return (
unsigned)((c | 32) -
'a') < 26 ||
1325 (unsigned)(c -
'0') < 10 ||
1326 c ==
'-' || c ==
'_' || c ==
'/' || c ==
'.';
1337 static int get_key(
const char **ropts,
const char *delim,
char **rkey)
1339 const char *opts = *ropts;
1340 const char *key_start, *key_end;
1347 if (!*opts || !strchr(delim, *opts))
1350 if (!(*rkey =
av_malloc(key_end - key_start + 1)))
1352 memcpy(*rkey, key_start, key_end - key_start);
1353 (*rkey)[key_end - key_start] = 0;
1359 const char *key_val_sep,
const char *pairs_sep,
1361 char **rkey,
char **rval)
1365 const char *opts = *ropts;
1367 if ((ret =
get_key(&opts, key_val_sep, &key)) < 0 &&
1381 const char *
const *shorthand,
1382 const char *key_val_sep,
const char *pairs_sep)
1385 const char *dummy_shorthand =
NULL;
1392 shorthand = &dummy_shorthand;
1397 &parsed_key, &
value);
1413 key = *(shorthand++);
1482 int opt_flags,
int search_flags)
1488 int opt_flags,
int search_flags,
void **target_obj)
1510 if (o =
av_opt_find2(child, name, unit, opt_flags, search_flags, target_obj))
1516 if (!strcmp(o->
name, name) && (o->
flags & opt_flags) == opt_flags &&
1596 if (*field_dst8 != *field_src8)
1599 if (*field_src8 && !*field_dst8)
1602 int len = *(
int*)(field_src8 + 1);
1603 if (*field_dst8 != *field_src8)
1605 *field_dst8 =
av_memdup(*field_src8, len);
1606 if (len && !*field_dst8) {
1610 *(
int*)(field_dst8 + 1) =
len;
1616 if (*sdict != *ddict)
1635 if (c->
version > (52 << 16 | 11 << 8))
1641 ret =
callback(ranges_arg, obj, key, flags);
1645 (*ranges_arg)->nb_components = ret;
1660 if (!ranges || !range || !range_array || !field) {
1665 ranges->
range = range_array;
1666 ranges->
range[0] = range;
1673 switch (field->
type) {
1711 *ranges_arg = ranges;
1767 str = *(
char **)dst;
1789 int opt_size = *(
int *)((
void **)dst + 1);
1790 void *opt_ptr = *(
void **)dst;
1799 ret = !memcmp(opt_ptr, tmp.data, tmp.size);
1805 return !!(*(
void **)dst);
1811 return (w == *(
int *)dst) && (h == *((
int *)dst+1));
1825 return !memcmp(color, dst,
sizeof(color));
1847 const char key_val_sep,
const char pairs_sep)
1853 const char special_chars[] = {pairs_sep, key_val_sep,
'\0'};
1855 if (pairs_sep ==
'\0' || key_val_sep ==
'\0' || pairs_sep == key_val_sep ||
1856 pairs_sep ==
'\\' || key_val_sep ==
'\\') {
1861 if (!obj || !buffer)
1872 else if (((o->
flags & opt_flags) != opt_flags))
1895 typedef struct TestContext
1909 int64_t channel_layout;
1922 #define OFFSET(x) offsetof(TestContext, x)
1924 #define TEST_FLAG_COOL 01
1925 #define TEST_FLAG_LAME 02
1926 #define TEST_FLAG_MU 04
1928 static const AVOption test_options[]= {
1935 {
"cool",
"set cool flag", 0,
AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_COOL}, INT_MIN, INT_MAX, 1,
"flags" },
1936 {
"lame",
"set lame flag", 0,
AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_LAME}, INT_MIN, INT_MAX, 1,
"flags" },
1937 {
"mu",
"set mu flag", 0,
AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_MU}, INT_MIN, INT_MAX, 1,
"flags" },
1954 static const char *test_get_name(
void *ctx)
1959 static const AVClass test_class = {
1967 vfprintf(stdout, fmt, vl);
1977 printf(
"Testing default values\n");
1979 TestContext test_ctx = { 0 };
1980 test_ctx.class = &test_class;
1983 printf(
"num=%d\n", test_ctx.num);
1984 printf(
"toggle=%d\n", test_ctx.toggle);
1985 printf(
"string=%s\n", test_ctx.string);
1986 printf(
"escape=%s\n", test_ctx.escape);
1987 printf(
"flags=%d\n", test_ctx.flags);
1988 printf(
"rational=%d/%d\n", test_ctx.rational.num, test_ctx.rational.den);
1989 printf(
"video_rate=%d/%d\n", test_ctx.video_rate.num, test_ctx.video_rate.den);
1990 printf(
"width=%d height=%d\n", test_ctx.w, test_ctx.h);
1993 printf(
"duration=%"PRId64
"\n", test_ctx.duration);
1994 printf(
"color=%d %d %d %d\n", test_ctx.color[0], test_ctx.color[1], test_ctx.color[2], test_ctx.color[3]);
1995 printf(
"channel_layout=%"PRId64
"=%"PRId64
"\n", test_ctx.channel_layout, (int64_t)
AV_CH_LAYOUT_HEXAGONAL);
1996 if (test_ctx.binary)
1997 printf(
"binary=%x %x %x %x\n", ((
uint8_t*)test_ctx.binary)[0], ((
uint8_t*)test_ctx.binary)[1], ((
uint8_t*)test_ctx.binary)[2], ((
uint8_t*)test_ctx.binary)[3]);
1998 printf(
"binary_size=%d\n", test_ctx.binary_size);
1999 printf(
"num64=%"PRId64
"\n", test_ctx.num64);
2000 printf(
"flt=%.6f\n", test_ctx.flt);
2001 printf(
"dbl=%.6f\n", test_ctx.dbl);
2008 printf(
"\nTesting av_opt_is_set_to_default()\n");
2011 TestContext test_ctx = { 0 };
2013 test_ctx.class = &test_class;
2019 printf(
"name:%10s default:%d error:%s\n", o->
name, !!ret, ret < 0 ?
av_err2str(ret) :
"");
2024 printf(
"name:%10s default:%d error:%s\n", o->
name, !!ret, ret < 0 ?
av_err2str(ret) :
"");
2029 printf(
"\nTest av_opt_serialize()\n");
2031 TestContext test_ctx = { 0 };
2033 test_ctx.class = &test_class;
2039 printf(
"%s\n", buf);
2041 memset(&test_ctx, 0,
sizeof(test_ctx));
2042 test_ctx.class = &test_class;
2046 printf(
"%s\n", buf);
2053 printf(
"\nTesting av_set_options_string()\n");
2055 TestContext test_ctx = { 0 };
2056 static const char *
const options[] = {
2072 "flags=+mu-lame : num=42: toggle=0",
2073 "num=42 : string=blahblah",
2074 "rational=0 : rational=1/2 : rational=1/-1",
2087 "video_rate=30000/1001",
2088 "video_rate=30/1.001",
2092 "duration=1\\:23\\:45.67",
2096 "cl=stereo+downmix",
2118 test_ctx.class = &test_class;
2124 int silence_log = !strcmp(options[i],
"rational=-1/0");
2129 printf(
"Error '%s'\n", options[i]);
2131 printf(
"OK '%s'\n", options[i]);
2137 printf(
"\nTesting av_opt_set_from_string()\n");
2139 TestContext test_ctx = { 0 };
2140 static const char *
const options[] = {
2148 " 5 : hello : size = pal ",
2149 "a_very_long_option_name_that_will_need_to_be_ellipsized_around_here=42"
2151 static const char *
const shorthand[] = {
"num",
"string",
NULL };
2153 test_ctx.class = &test_class;
2161 printf(
"Error '%s'\n", options[i]);
2163 printf(
"OK '%s'\n", options[i]);
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
const char const char void * val
A single allowed range of values, or a single allowed value.
const AVOption * av_set_int(void *obj, const char *name, int64_t n)
static enum AVPixelFormat pix_fmt
Number of sample formats. DO NOT USE if linking dynamically.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
ptrdiff_t const GLvoid * data
int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
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.
#define AV_OPT_FLAG_EXPORT
The option is inteded for exporting values to the caller.
#define AV_OPT_FLAG_SUBTITLE_PARAM
#define AV_LOG_WARNING
Something somehow does not look correct.
static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
void * av_opt_child_next(void *obj, void *prev)
Iterate over AVOptions-enabled children of obj.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
static int get_key(const char **ropts, const char *delim, char **rkey)
Read a key from a string.
void av_log_set_level(int level)
Set the log level.
const AVClass * av_opt_child_class_next(const AVClass *parent, const AVClass *prev)
Iterate over potential AVOptions-enabled children of parent.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
static int opt_size(enum AVOptionType type)
#define AV_OPT_FLAG_AUDIO_PARAM
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
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.
static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)
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 void opt_list(void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags)
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
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_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
const char * av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len)
int av_opt_is_set_to_default(void *obj, const AVOption *o)
Check if given option is set to its default value.
GLsizei const char ** string
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
#define AV_LOG_QUIET
Print no output.
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.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
static int get_format(void *obj, const char *name, int search_flags, int *out_fmt, enum AVOptionType type, const char *desc)
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
AVOptionRange ** range
Array of option ranges.
Accept to parse a value without a key; the key will then be returned as NULL.
const char * help
short English help text
AVS_FilterInfo AVS_Value child
static int read_number(const AVOption *o, const void *dst, double *num, int *den, int64_t *intnum)
const AVOption * av_set_double(void *obj, const char *name, double n)
#define AV_CH_LAYOUT_HEXAGONAL
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
const OptionDef options[]
void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum, int search_flags)
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
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.
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
static int hexchar2int(char c)
int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
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_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_BPRINT_SIZE_UNLIMITED
void * av_opt_ptr(const AVClass *class, void *obj, const char *name)
Gets a pointer to the requested field in a struct.
static const uint16_t mask[17]
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
double max
maximum valid value for the option
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
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.
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...
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 int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
const AVOption * av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
audio channel layout utility functions
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
int av_opt_copy(void *dst, FF_CONST_AVUTIL55 void *src)
Copy options from src object into dest object.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
GLsizei GLboolean const GLfloat * value
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const char * unit
The logical unit to which the option belongs.
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.
double component_min
Value's component range.
int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags)
double min
minimum valid value for the option
static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
void av_opt_set_defaults2(void *s, int mask, int flags)
Set the values of all AVOption fields to their default values.
static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
double av_get_double(void *obj, const char *name, const AVOption **o_out)
const AVOption * av_set_q(void *obj, const char *name, AVRational n)
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
const struct AVClass *(* child_class_next)(const struct AVClass *prev)
Return an AVClass corresponding to the next potential AVOptions-enabled child.
#define FF_ARRAY_ELEMS(a)
offset must point to a pointer immediately followed by an int for the length
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.
void * av_memdup(const void *p, size_t size)
Duplicate the buffer p.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
static void log_value(void *av_log_obj, int level, double d)
#define AV_LOG_INFO
Standard information.
static int set_format(void *obj, const char *name, int fmt, int search_flags, enum AVOptionType type, const char *desc, int nb_fmts)
void av_opt_freep_ranges(AVOptionRanges **rangesp)
Free an AVOptionRanges struct and set it to NULL.
int offset
The offset relative to the context structure where the option value is stored.
AVSampleFormat
Audio sample formats.
union AVOption::@192 default_val
the default value for scalar options
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
char * av_strdup(const char *s)
Duplicate the string s.
static int set_number(void *obj, const char *name, double num, int den, int64_t intnum, 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_VIDEO_PARAM
int64_t av_get_int(void *obj, const char *name, const AVOption **o_out)
#define OPT_EVAL_NUMBER(name, opttype, vartype)
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Describe the class of an AVClass context structure.
rational number numerator/denominator
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
offset must point to AVRational
offset must point to two consecutive integers
const AVOption * av_next_option(FF_CONST_AVUTIL55 void *obj, const AVOption *last)
int version
LIBAVUTIL_VERSION with which this structure was created.
static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
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.
void av_opt_free(void *obj)
Free all allocated objects in obj.
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.
double value_min
Value range.
common internal and external API header
#define DEFAULT_NUMVAL(opt)
int(* query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags)
Callback to return the supported/allowed ranges.
int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
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)
void *(* child_next)(void *obj, void *prev)
Return next AVOptions-enabled child or NULL.
#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...
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
int nb_ranges
Number of ranges per component.
List of AVOptionRange structs.
int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
Set the field of obj with the given name to value.
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS
Serialize options that are not set to default values only.
#define AVERROR_OPTION_NOT_FOUND
Option not found.
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.
uint64_t ff_get_channel_layout(const char *name, int compat)
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
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.
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
#define FF_CONST_AVUTIL55
static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT
Serialize options that exactly match opt_flags only.
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.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
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.
int main(int argc, char **argv)
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
#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...
AVPixelFormat
Pixel format.
int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int is_key_char(char c)
simple arithmetic expression evaluator
int nb_components
Number of componentes.
int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)