avutil/opt: don't set a channel layout if the option is flagged as read only

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-05-06 12:24:17 -03:00
parent 2987c65caa
commit 9614efc258
1 changed files with 2 additions and 0 deletions

View File

@ -949,6 +949,8 @@ int av_opt_set_chlayout(void *obj, const char *name,
if (!o || !target_obj) if (!o || !target_obj)
return AVERROR_OPTION_NOT_FOUND; return AVERROR_OPTION_NOT_FOUND;
if (o->flags & AV_OPT_FLAG_READONLY)
return AVERROR(EINVAL);
dst = (AVChannelLayout*)((uint8_t*)target_obj + o->offset); dst = (AVChannelLayout*)((uint8_t*)target_obj + o->offset);