diff mbox series

[FFmpeg-devel,1/2] avutil/test/opt: test the AV_OPT_SERIALIZE_SKIP_DEFAULTS flag

Message ID 20240412231658.4625-1-jamrial@gmail.com
State Accepted
Commit a9df9f95c43992d60c99cbd2f6bd28a104ed5d0b
Headers show
Series [FFmpeg-devel,1/2] avutil/test/opt: test the AV_OPT_SERIALIZE_SKIP_DEFAULTS flag | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer April 12, 2024, 11:16 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
The floats are set to "1.0 / 3" and the serialization prints a value that's not
exact, hence them not being skipped.
array_int is weird, though. Although it's the only array that doesn't set
AVOption.arr

 libavutil/tests/opt.c | 5 +++++
 tests/ref/fate/opt    | 1 +
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index ccf3a54f96..32301ba842 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -279,6 +279,11 @@  int main(void)
             if (av_opt_serialize(&test_ctx, 0, 0, &buf, '=', ',') >= 0) {
                 printf("%s\n", buf);
                 av_free(buf);
+                if (av_opt_serialize(&test_ctx, 0, AV_OPT_SERIALIZE_SKIP_DEFAULTS, &buf, '=', ',') >= 0) {
+                    if (strlen(buf))
+                        printf("%s\n", buf);
+                    av_free(buf);
+                }
             }
         }
         av_opt_free(&test_ctx);
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index f4fce1bd49..43bf0929a3 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -179,6 +179,7 @@  Setting entry with key 'array_int' to value ''
 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,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=1,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
+flt=0.333333,dbl=0.333333,array_int=
 
 Testing av_set_options_string()
 Setting options string ''