This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new ea791a4ef1 swscale/tests/swscale: parse flags from string
ea791a4ef1 is described below

commit ea791a4ef17478693c231f04d8ba60985866f5bc
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Dec 8 17:26:09 2025 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Mon Feb 23 19:23:09 2026 +0100

    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.
---
 libswscale/tests/swscale.c | 11 ++++++++++-
 tests/fate/libswscale.mak  |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 373f031363..3e05c97bbf 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -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")) {
diff --git a/tests/fate/libswscale.mak b/tests/fate/libswscale.mak
index 8d87c39ebf..63e203dbf7 100644
--- a/tests/fate/libswscale.mak
+++ b/tests/fate/libswscale.mak
@@ -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)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to