Commit 3593b81b09 for ffmpeg

commit 3593b81b09668cf9222af58c47c8be668ac90aed
Author: James Almer <jamrial@gmail.com>
Date:   Tue Sep 29 00:15:56 2026 -0300

    avutil/tests/opt: add more tests for av_opt_serialize flags

    Signed-off-by: James Almer <jamrial@gmail.com>

diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index 8ab76c4690..04d5526dcd 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -130,14 +130,16 @@ typedef struct ChildContext {
     const AVClass *class;
     int64_t child_num64;
     int child_num;
+    unsigned int child_unum;
 } ChildContext;

 #undef OFFSET
 #define OFFSET(x) offsetof(ChildContext, x)

 static const AVOption child_options[]= {
-    {"child_num64", "set num 64bit", OFFSET(child_num64), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, 100, 1 },
+    {"child_num64", "set num 64bit", OFFSET(child_num64), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, 100, 1 | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
     {"child_num",   "set child_num", OFFSET(child_num),   AV_OPT_TYPE_INT,   { .i64 = 1 }, 0, 100, 1 },
+    {"child_unum",  "set child_unum", OFFSET(child_unum),  AV_OPT_TYPE_UINT,  { .i64 = 0 }, 0, 100, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
     { NULL },
 };

@@ -394,6 +396,38 @@ int main(void)
                     printf("%s\n", buf);
                     av_free(buf);
                 }
+                child_ctx.child_num64 = 1;
+                child_ctx.child_unum = 1;
+                printf("Include flag EXPORT:\n");
+                if (av_opt_serialize(&test_ctx, AV_OPT_FLAG_EXPORT,
+                                     AV_OPT_SERIALIZE_SKIP_DEFAULTS|AV_OPT_SERIALIZE_SEARCH_CHILDREN,
+                                     &buf, '=', ',') >= 0) {
+                    printf("%s\n", buf);
+                    av_free(buf);
+                }
+                printf("Include flag 1:\n");
+                if (av_opt_serialize(&test_ctx, 1,
+                                     AV_OPT_SERIALIZE_SKIP_DEFAULTS|AV_OPT_SERIALIZE_SEARCH_CHILDREN,
+                                     &buf, '=', ',') >= 0) {
+                    printf("%s\n", buf);
+                    av_free(buf);
+                }
+                printf("Include exact match flag 1:\n");
+                if (av_opt_serialize(&test_ctx, 1,
+                                     AV_OPT_SERIALIZE_SKIP_DEFAULTS|AV_OPT_SERIALIZE_SEARCH_CHILDREN|
+                                     AV_OPT_SERIALIZE_OPT_FLAGS_EXACT,
+                                     &buf, '=', ',') >= 0) {
+                    printf("%s\n", buf);
+                    av_free(buf);
+                }
+                printf("Include exact match flag EXPORT|READONLY:\n");
+                if (av_opt_serialize(&test_ctx, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY,
+                                     AV_OPT_SERIALIZE_SKIP_DEFAULTS|AV_OPT_SERIALIZE_SEARCH_CHILDREN|
+                                     AV_OPT_SERIALIZE_OPT_FLAGS_EXACT,
+                                     &buf, '=', ',') >= 0) {
+                    printf("%s\n", buf);
+                    av_free(buf);
+                }
                 av_opt_free(&child_ctx);
                 test_ctx.child = NULL;
             }
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index 04e787f01d..86f809c433 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -192,6 +192,14 @@ Setting entry with key 'array_str' to value 'str0|str\|1|str\\2'
 Setting entry with key 'array_dict' to value 'k00=v\\\\00:k01=v\,01,k10=v\\=1\\:0'
 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
 child_num=0,flt=0.333333,dbl=0.333333
+Include flag EXPORT:
+child_num64=1,child_unum=1
+Include flag 1:
+child_num64=1,child_num=0,flt=0.333333,dbl=0.333333
+Include exact match flag 1:
+child_num=0,flt=0.333333,dbl=0.333333
+Include exact match flag EXPORT|READONLY:
+child_unum=1

 Testing av_set_options_string()
 Setting options string ''