mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
swscale/tests/swscale: parse flags from string
We don't actually have an SwsContext yet at this point, so just use AV_OPT_SEARCH_FAKE_OBJ. For the actual evaluation, the signature only requires that we pass a "pointer to a struct that contains an AVClass as its first member", so passing a double pointer to the class itself is sufficient.
This commit is contained in:
@@ -509,6 +509,11 @@ int main(int argc, char **argv)
|
||||
AVLFG rand;
|
||||
int ret = -1;
|
||||
|
||||
const AVClass *sws_class = sws_get_class();
|
||||
const AVOption *flags_opt = av_opt_find(&sws_class, "sws_flags", NULL, 0,
|
||||
AV_OPT_SEARCH_FAKE_OBJ);
|
||||
av_assert0(flags_opt);
|
||||
|
||||
for (int i = 1; i < argc; i += 2) {
|
||||
if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
fprintf(stderr,
|
||||
@@ -576,7 +581,11 @@ int main(int argc, char **argv)
|
||||
opts.w = 1920;
|
||||
opts.h = 1080;
|
||||
} else if (!strcmp(argv[i], "-flags")) {
|
||||
opts.flags = strtol(argv[i + 1], NULL, 0);
|
||||
ret = av_opt_eval_flags(&sws_class, flags_opt, argv[i + 1], &opts.flags);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "invalid flags %s\n", argv[i + 1]);
|
||||
goto error;
|
||||
}
|
||||
} else if (!strcmp(argv[i], "-dither")) {
|
||||
opts.dither = atoi(argv[i + 1]);
|
||||
} else if (!strcmp(argv[i], "-unscaled")) {
|
||||
|
||||
@@ -34,7 +34,7 @@ fate-sws-yuv-range: CMD = framecrc \
|
||||
# This self-check currently fails for legacy swscale, so pass SWS_UNSTABLE to use the new code
|
||||
FATE_LIBSWSCALE-$(CONFIG_UNSTABLE) += fate-sws-unscaled
|
||||
fate-sws-unscaled: libswscale/tests/swscale$(EXESUF)
|
||||
fate-sws-unscaled: CMD = run libswscale/tests/swscale$(EXESUF) -unscaled 1 -flags 0x100000 -v 16
|
||||
fate-sws-unscaled: CMD = run libswscale/tests/swscale$(EXESUF) -unscaled 1 -flags unstable -v 16
|
||||
|
||||
FATE_LIBSWSCALE-$(CONFIG_UNSTABLE) += fate-sws-ops-list
|
||||
fate-sws-ops-list: libswscale/tests/sws_ops$(EXESUF)
|
||||
|
||||
Reference in New Issue
Block a user