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

Git pushed a commit to branch master
in repository ffmpeg.

commit 99867ef095837e569959d2175709606033345b64
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Sep 19 23:39:01 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Oct 10 21:27:56 2026 +0000

    avutil/tests/opt: copy options into a memdup'ed object holding a custom 
channel layout
---
 libavutil/tests/opt.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 tests/ref/fate/opt    |  7 +++++++
 2 files changed, 50 insertions(+)

diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index 4c167e2e49..1f35d3dcb7 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -642,5 +642,48 @@ int main(void)
             printf("Error 'foo'\n");
     }
 
+    printf("\nTesting av_opt_copy() into a memdup'ed object\n");
+    {
+        TestContext test_ctx = { 0 };
+        TestContext *copy;
+        uint8_t *layout_name = NULL;
+
+        test_ctx.class = &test_class;
+        av_opt_set_defaults(&test_ctx);
+        av_opt_set(&test_ctx, "cl", "FL@Left+FR@Right", 0);
+
+        copy = av_memdup(&test_ctx, sizeof(test_ctx));
+        if (!copy)
+            return 1;
+        av_opt_copy(copy, &test_ctx);
+        av_opt_free(&test_ctx);
+
+        av_opt_get(copy, "cl", 0, &layout_name);
+        printf("cl=%s\n", layout_name);
+        av_free(layout_name);
+        av_opt_free(copy);
+        av_free(copy);
+    }
+
+    printf("\nTesting av_opt_copy() of a native layout into a custom 
layout\n");
+    {
+        TestContext src = { 0 }, dst = { 0 };
+        AVChannelLayout native = { AV_CHANNEL_ORDER_NATIVE };
+
+        src.class = dst.class = &test_class;
+        av_opt_set_defaults(&src);
+        av_opt_set_defaults(&dst);
+        av_opt_set(&dst, "cl", "FL@Left+FR@Right", 0);
+
+        native.u.mask      = (uintptr_t)dst.channel_layout.u.map;
+        native.nb_channels = av_popcount64(native.u.mask);
+        av_opt_set_chlayout(&src, "cl", &native, 0);
+
+        printf("copy: %d\n", av_opt_copy(&dst, &src));
+        printf("same layout: %d\n", 
!av_channel_layout_compare(&src.channel_layout, &dst.channel_layout));
+        av_opt_free(&src);
+        av_opt_free(&dst);
+    }
+
     return 0;
 }
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index d14245ee6a..90a7ba85e9 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -533,3 +533,10 @@ Error 'num64'
 Error 'child_num'
 OK    'child_num'
 Error 'foo'
+
+Testing av_opt_copy() into a memdup'ed object
+cl=2 channels (FL@Left+FR@Right)
+
+Testing av_opt_copy() of a native layout into a custom layout
+copy: 0
+same layout: 1

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to