diff mbox series

[FFmpeg-devel,2/3] avutil/opt: don't set a channel layout if the option is flagged as read only

Message ID 20240506152704.1596-2-jamrial@gmail.com
State Accepted
Commit 9614efc2586edb82cec847598c5abca0ce79dd25
Headers show
Series [FFmpeg-devel,1/3] avutil/opt: add a note about the av_opt_set_chlayout() behavior | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer May 6, 2024, 3:27 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/opt.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavutil/opt.c b/libavutil/opt.c
index a892e056cb..60b0c2a946 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -949,6 +949,8 @@  int av_opt_set_chlayout(void *obj, const char *name,
 
     if (!o || !target_obj)
         return AVERROR_OPTION_NOT_FOUND;
+    if (o->flags & AV_OPT_FLAG_READONLY)
+        return AVERROR(EINVAL);
 
     dst = (AVChannelLayout*)((uint8_t*)target_obj + o->offset);