Unified · Split
| @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | API changes, most recent first: |
| 4 | 4 | |
| 5 | +2024-05-04 - xxxxxxxxxx - lavu 59.17.100 - opt.h | |
| 6 | + Add AV_OPT_TYPE_UINT and av_opt_eval_uint(). | |
| 7 | + | |
| 5 | 8 | 2024-04-24 - 8616cfe0890 - lavu 59.16.100 - opt.h |
| 6 | 9 | Add AV_OPT_SERIALIZE_SEARCH_CHILDREN. |
| 7 | 10 | |
| @@ -62,6 +62,7 @@ static const size_t opt_elem_size[] = { · 61 unmodified lines | ||
| 62 | 62 | [AV_OPT_TYPE_FLAGS] = sizeof(unsigned), |
| 63 | 63 | [AV_OPT_TYPE_INT] = sizeof(int), |
| 64 | 64 | [AV_OPT_TYPE_INT64] = sizeof(int64_t), |
| 65 | + [AV_OPT_TYPE_UINT] = sizeof(unsigned), | |
| 65 | 66 | [AV_OPT_TYPE_UINT64] = sizeof(uint64_t), |
| 66 | 67 | [AV_OPT_TYPE_DOUBLE] = sizeof(double), |
| 67 | 68 | [AV_OPT_TYPE_FLOAT] = sizeof(float), |
| @@ -166,6 +167,9 @@ static int read_number(const AVOption *o, const void *dst, double *num, int *den · 98 unmodified lines | ||
| 166 | 167 | case AV_OPT_TYPE_INT: |
| 167 | 168 | *intnum = *(int *)dst; |
| 168 | 169 | return 0; |
| 170 | + case AV_OPT_TYPE_UINT: | |
| 171 | + *intnum = *(unsigned int *)dst; | |
| 172 | + return 0; | |
| 169 | 173 | case AV_OPT_TYPE_DURATION: |
| 170 | 174 | case AV_OPT_TYPE_INT64: |
| 171 | 175 | case AV_OPT_TYPE_UINT64: |
| @@ -219,6 +223,7 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int · 47 unmodified lines | ||
| 219 | 223 | case AV_OPT_TYPE_BOOL: |
| 220 | 224 | case AV_OPT_TYPE_FLAGS: |
| 221 | 225 | case AV_OPT_TYPE_INT: |
| 226 | + case AV_OPT_TYPE_UINT: | |
| 222 | 227 | *(int *)dst = llrint(num / den) * intnum; |
| 223 | 228 | break; |
| 224 | 229 | case AV_OPT_TYPE_DURATION: |
| @@ -319,6 +324,7 @@ static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **d · 94 unmodified lines | ||
| 319 | 324 | opt->type == AV_OPT_TYPE_UINT64 || \ |
| 320 | 325 | opt->type == AV_OPT_TYPE_CONST || \ |
| 321 | 326 | opt->type == AV_OPT_TYPE_FLAGS || \ |
| 327 | + opt->type == AV_OPT_TYPE_UINT || \ | |
| 322 | 328 | opt->type == AV_OPT_TYPE_INT) \ |
| 323 | 329 | ? opt->default_val.i64 \ |
| 324 | 330 | : opt->default_val.dbl) |
| @@ -605,6 +611,7 @@ static int opt_set_elem(void *obj, void *target_obj, const AVOption *o, · 280 unmodified lines | ||
| 605 | 611 | return set_string_binary(obj, o, val, dst); |
| 606 | 612 | case AV_OPT_TYPE_FLAGS: |
| 607 | 613 | case AV_OPT_TYPE_INT: |
| 614 | + case AV_OPT_TYPE_UINT: | |
| 608 | 615 | case AV_OPT_TYPE_INT64: |
| 609 | 616 | case AV_OPT_TYPE_UINT64: |
| 610 | 617 | case AV_OPT_TYPE_FLOAT: |
| @@ -767,6 +774,7 @@ int av_opt_eval_ ## name(void *obj, const AVOption *o, \ · 156 unmodified lines | ||
| 767 | 774 | |
| 768 | 775 | OPT_EVAL_NUMBER(flags, AV_OPT_TYPE_FLAGS, int) |
| 769 | 776 | OPT_EVAL_NUMBER(int, AV_OPT_TYPE_INT, int) |
| 777 | +OPT_EVAL_NUMBER(uint, AV_OPT_TYPE_UINT, unsigned) | |
| 770 | 778 | OPT_EVAL_NUMBER(int64, AV_OPT_TYPE_INT64, int64_t) |
| 771 | 779 | OPT_EVAL_NUMBER(float, AV_OPT_TYPE_FLOAT, float) |
| 772 | 780 | OPT_EVAL_NUMBER(double, AV_OPT_TYPE_DOUBLE, double) |
| @@ -997,6 +1005,9 @@ static int opt_get_elem(const AVOption *o, uint8_t **pbuf, size_t buf_len, · 224 unmodified lines | ||
| 997 | 1005 | case AV_OPT_TYPE_INT: |
| 998 | 1006 | ret = snprintf(*pbuf, buf_len, "%d", *(int *)dst); |
| 999 | 1007 | break; |
| 1008 | + case AV_OPT_TYPE_UINT: | |
| 1009 | + ret = snprintf(*pbuf, buf_len, "%u", *(unsigned *)dst); | |
| 1010 | + break; | |
| 1000 | 1011 | case AV_OPT_TYPE_INT64: |
| 1001 | 1012 | ret = snprintf(*pbuf, buf_len, "%"PRId64, *(int64_t *)dst); |
| 1002 | 1013 | break; |
| @@ -1444,6 +1455,7 @@ static void log_type(void *av_log_obj, const AVOption *o, · 441 unmodified lines | ||
| 1444 | 1455 | [AV_OPT_TYPE_FLAGS] = "<flags>", |
| 1445 | 1456 | [AV_OPT_TYPE_INT] = "<int>", |
| 1446 | 1457 | [AV_OPT_TYPE_INT64] = "<int64>", |
| 1458 | + [AV_OPT_TYPE_UINT] = "<unsigned>", | |
| 1447 | 1459 | [AV_OPT_TYPE_UINT64] = "<uint64>", |
| 1448 | 1460 | [AV_OPT_TYPE_DOUBLE] = "<double>", |
| 1449 | 1461 | [AV_OPT_TYPE_FLOAT] = "<float>", |
| @@ -1515,6 +1527,7 @@ static void log_default(void *obj, void *av_log_obj, const AVOption *opt) · 65 unmodified lines | ||
| 1515 | 1527 | av_log(av_log_obj, AV_LOG_INFO, "%s", buf); |
| 1516 | 1528 | break; |
| 1517 | 1529 | } |
| 1530 | + case AV_OPT_TYPE_UINT: | |
| 1518 | 1531 | case AV_OPT_TYPE_INT: |
| 1519 | 1532 | case AV_OPT_TYPE_UINT64: |
| 1520 | 1533 | case AV_OPT_TYPE_INT64: { |
| @@ -1600,6 +1613,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, · 79 unmodified lines | ||
| 1600 | 1613 | if (av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) { |
| 1601 | 1614 | switch (opt->type) { |
| 1602 | 1615 | case AV_OPT_TYPE_INT: |
| 1616 | + case AV_OPT_TYPE_UINT: | |
| 1603 | 1617 | case AV_OPT_TYPE_INT64: |
| 1604 | 1618 | case AV_OPT_TYPE_UINT64: |
| 1605 | 1619 | case AV_OPT_TYPE_DOUBLE: |
| @@ -1676,6 +1690,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) · 70 unmodified lines | ||
| 1676 | 1690 | case AV_OPT_TYPE_BOOL: |
| 1677 | 1691 | case AV_OPT_TYPE_FLAGS: |
| 1678 | 1692 | case AV_OPT_TYPE_INT: |
| 1693 | + case AV_OPT_TYPE_UINT: | |
| 1679 | 1694 | case AV_OPT_TYPE_INT64: |
| 1680 | 1695 | case AV_OPT_TYPE_UINT64: |
| 1681 | 1696 | case AV_OPT_TYPE_DURATION: |
| @@ -2177,6 +2192,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch · 495 unmodified lines | ||
| 2177 | 2192 | switch (field->type) { |
| 2178 | 2193 | case AV_OPT_TYPE_BOOL: |
| 2179 | 2194 | case AV_OPT_TYPE_INT: |
| 2195 | + case AV_OPT_TYPE_UINT: | |
| 2180 | 2196 | case AV_OPT_TYPE_INT64: |
| 2181 | 2197 | case AV_OPT_TYPE_UINT64: |
| 2182 | 2198 | case AV_OPT_TYPE_PIXEL_FMT: |
| @@ -2281,6 +2297,7 @@ int av_opt_is_set_to_default(void *obj, const AVOption *o) · 98 unmodified lines | ||
| 2281 | 2297 | case AV_OPT_TYPE_PIXEL_FMT: |
| 2282 | 2298 | case AV_OPT_TYPE_SAMPLE_FMT: |
| 2283 | 2299 | case AV_OPT_TYPE_INT: |
| 2300 | + case AV_OPT_TYPE_UINT: | |
| 2284 | 2301 | case AV_OPT_TYPE_DURATION: |
| 2285 | 2302 | case AV_OPT_TYPE_INT64: |
| 2286 | 2303 | case AV_OPT_TYPE_UINT64: |
| @@ -260,6 +260,7 @@ enum AVOptionType{ · 259 unmodified lines | ||
| 260 | 260 | AV_OPT_TYPE_COLOR, |
| 261 | 261 | AV_OPT_TYPE_BOOL, |
| 262 | 262 | AV_OPT_TYPE_CHLAYOUT, |
| 263 | + AV_OPT_TYPE_UINT, | |
| 263 | 264 | |
| 264 | 265 | /** |
| 265 | 266 | * May be combined with another regular option type to declare an array |
| @@ -883,6 +884,7 @@ int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDiction · 617 unmodified lines | ||
| 883 | 884 | */ |
| 884 | 885 | int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); |
| 885 | 886 | int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); |
| 887 | +int av_opt_eval_uint (void *obj, const AVOption *o, const char *val, unsigned *uint_out); | |
| 886 | 888 | int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); |
| 887 | 889 | int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); |
| 888 | 890 | int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); |
| @@ -32,6 +32,7 @@ typedef struct TestContext { · 31 unmodified lines | ||
| 32 | 32 | const AVClass *class; |
| 33 | 33 | struct ChildContext *child; |
| 34 | 34 | int num; |
| 35 | + int unum; | |
| 35 | 36 | int toggle; |
| 36 | 37 | char *string; |
| 37 | 38 | int flags; |
| @@ -87,6 +88,7 @@ static const AVOptionArrayDef array_dict = { · 49 unmodified lines | ||
| 87 | 88 | |
| 88 | 89 | static const AVOption test_options[]= { |
| 89 | 90 | {"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 100, 1 }, |
| 91 | + {"unum", "set unum", OFFSET(unum), AV_OPT_TYPE_UINT, { .i64 = 1U << 31 }, 0, 1U << 31, 1 }, | |
| 90 | 92 | {"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, 1 }, |
| 91 | 93 | {"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, 10, 1 }, |
| 92 | 94 | {"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, { .str = "default" }, CHAR_MIN, CHAR_MAX, 1 }, |
| @@ -186,6 +188,7 @@ int main(void) · 93 unmodified lines | ||
| 186 | 188 | av_opt_set_defaults(&test_ctx); |
| 187 | 189 | |
| 188 | 190 | printf("num=%d\n", test_ctx.num); |
| 191 | + printf("unum=%u\n", test_ctx.unum); | |
| 189 | 192 | printf("toggle=%d\n", test_ctx.toggle); |
| 190 | 193 | printf("string=%s\n", test_ctx.string); |
| 191 | 194 | printf("escape=%s\n", test_ctx.escape); |
| @@ -386,6 +389,12 @@ int main(void) · 194 unmodified lines | ||
| 386 | 389 | "num=-1", |
| 387 | 390 | "num=-2", |
| 388 | 391 | "num=101", |
| 392 | + "unum=bogus", | |
| 393 | + "unum=44", | |
| 394 | + "unum=44.4", | |
| 395 | + "unum=-1", | |
| 396 | + "unum=2147483648", | |
| 397 | + "unum=2147483649", | |
| 389 | 398 | "num64=bogus", |
| 390 | 399 | "num64=44", |
| 391 | 400 | "num64=44.4", |
| @@ -79,8 +79,8 @@ · 78 unmodified lines | ||
| 79 | 79 | */ |
| 80 | 80 | |
| 81 | 81 | #define LIBAVUTIL_VERSION_MAJOR 59 |
| 82 | −#define LIBAVUTIL_VERSION_MINOR 16 | |
| 83 | −#define LIBAVUTIL_VERSION_MICRO 101 | |
| 82 | +#define LIBAVUTIL_VERSION_MINOR 17 | |
| 83 | +#define LIBAVUTIL_VERSION_MICRO 100 | |
| 84 | 84 | |
| 85 | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| 86 | 86 | LIBAVUTIL_VERSION_MINOR, \ |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | Testing default values |
| 2 | 2 | num=0 |
| 3 | +unum=2147483648 | |
| 3 | 4 | toggle=1 |
| 4 | 5 | string=default |
| 5 | 6 | escape=\=, |
| @@ -25,6 +26,7 @@ array_dict[0]: k01 v,01 · 19 unmodified lines | ||
| 25 | 26 | array_dict[1]: k10 v=1:0 |
| 26 | 27 | TestContext AVOptions: |
| 27 | 28 | -num <int> E.......... set num (from -1 to 100) (default 0) |
| 29 | + -unum <unsigned> E.......... set unum (from 0 to 2.14748e+09) (default 2147483648) | |
| 28 | 30 | -toggle <int> E.......... set toggle (from 0 to 1) (default 1) |
| 29 | 31 | -rational <rational> E.......... set rational (from 0 to 10) (default 1/1) |
| 30 | 32 | -string <string> E.......... set string (default "default") |
| @@ -57,6 +59,7 @@ TestContext AVOptions: · 26 unmodified lines | ||
| 57 | 59 | |
| 58 | 60 | Testing av_opt_is_set_to_default() |
| 59 | 61 | name: num default:1 error: |
| 62 | +name: unum default:0 error: | |
| 60 | 63 | name: toggle default:0 error: |
| 61 | 64 | name: rational default:0 error: |
| 62 | 65 | name: string default:0 error: |
| @@ -87,6 +90,7 @@ name: array_int default:0 error: · 24 unmodified lines | ||
| 87 | 90 | name: array_str default:0 error: |
| 88 | 91 | name:array_dict default:0 error: |
| 89 | 92 | name: num default:1 error: |
| 93 | +name: unum default:1 error: | |
| 90 | 94 | name: toggle default:1 error: |
| 91 | 95 | name: rational default:1 error: |
| 92 | 96 | name: string default:1 error: |
| @@ -119,6 +123,7 @@ name:array_dict default:1 error: · 26 unmodified lines | ||
| 119 | 123 | |
| 120 | 124 | Testing av_opt_get/av_opt_set() |
| 121 | 125 | name: num get: 0 set: OK get: 0 OK |
| 126 | +name: unum get: 2147483648 set: OK get: 2147483648 OK | |
| 122 | 127 | name: toggle get: 1 set: OK get: 1 OK |
| 123 | 128 | name: rational get: 1/1 set: OK get: 1/1 OK |
| 124 | 129 | name: string get: default set: OK get: default OK |
| @@ -150,8 +155,9 @@ array_dict=NULL; nb_array_dict=0 · 25 unmodified lines | ||
| 150 | 155 | av_opt_get("array_dict") -> NULL |
| 151 | 156 | |
| 152 | 157 | Test av_opt_serialize() |
| 153 | −num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0 | |
| 158 | +num=0,unum=2147483648,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0 | |
| 154 | 159 | Setting entry with key 'num' to value '0' |
| 160 | +Setting entry with key 'unum' to value '2147483648' | |
| 155 | 161 | Setting entry with key 'toggle' to value '1' |
| 156 | 162 | Setting entry with key 'rational' to value '1/1' |
| 157 | 163 | Setting entry with key 'string' to value 'default' |
| @@ -178,7 +184,7 @@ Setting entry with key 'dict2' to value 'happy=\:-)' · 20 unmodified lines | ||
| 178 | 184 | Setting entry with key 'array_int' to value '' |
| 179 | 185 | Setting entry with key 'array_str' to value 'str0|str\|1|str\\2' |
| 180 | 186 | Setting entry with key 'array_dict' to value 'k00=v\\\\00:k01=v\,01,k10=v\\=1\\:0' |
| 181 | −num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0 | |
| 187 | +num=0,unum=2147483648,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0 | |
| 182 | 188 | child_num=0,flt=0.333333,dbl=0.333333,array_int= |
| 183 | 189 | |
| 184 | 190 | Testing av_set_options_string() |
| @@ -359,6 +365,28 @@ Setting options string 'num=101' · 174 unmodified lines | ||
| 359 | 365 | Setting entry with key 'num' to value '101' |
| 360 | 366 | Value 101.000000 for parameter 'num' out of range [-1 - 100] |
| 361 | 367 | Error 'num=101' |
| 368 | +Setting options string 'unum=bogus' | |
| 369 | +Setting entry with key 'unum' to value 'bogus' | |
| 370 | +Undefined constant or missing '(' in 'bogus' | |
| 371 | +Unable to parse option value "bogus" | |
| 372 | +Error 'unum=bogus' | |
| 373 | +Setting options string 'unum=44' | |
| 374 | +Setting entry with key 'unum' to value '44' | |
| 375 | +OK 'unum=44' | |
| 376 | +Setting options string 'unum=44.4' | |
| 377 | +Setting entry with key 'unum' to value '44.4' | |
| 378 | +OK 'unum=44.4' | |
| 379 | +Setting options string 'unum=-1' | |
| 380 | +Setting entry with key 'unum' to value '-1' | |
| 381 | +Value -1.000000 for parameter 'unum' out of range [0 - 2.14748e+09] | |
| 382 | +Error 'unum=-1' | |
| 383 | +Setting options string 'unum=2147483648' | |
| 384 | +Setting entry with key 'unum' to value '2147483648' | |
| 385 | +OK 'unum=2147483648' | |
| 386 | +Setting options string 'unum=2147483649' | |
| 387 | +Setting entry with key 'unum' to value '2147483649' | |
| 388 | +Value 2147483649.000000 for parameter 'unum' out of range [0 - 2.14748e+09] | |
| 389 | +Error 'unum=2147483649' | |
| 362 | 390 | Setting options string 'num64=bogus' |
| 363 | 391 | Setting entry with key 'num64' to value 'bogus' |
| 364 | 392 | Undefined constant or missing '(' in 'bogus' |