On 2025-01-22 21:18 +0100, Nicolas George wrote:
> James Almer (12025-01-22):
> > Ok, will implement a new struct.
>
> Thanks.
>
> I think this code would work:
>
> typedef struct AVSideDataParamChange
>     …
>     intmax_t end_padding;
> } AVSideDataSomethingType;
>
> static const AVSideDataParamChange default = { ... };
>
>
>     AVSideDataParamChange pc;
>     av_assert0(sd->size > sizeof(pc.end_padding));
>     size_t s = FFMIN(sd->size - sizeof(pc.end_padding), sizeof(pc));
>     memcpy(&pc, sd->data, s);
>     memcpy((char *)&pc + s, (char *)&default + s, sizeof(pc) - s);
>
> After this code, pc contains the fields from the side data if they are
> present in the version known by the caller and the fields from default
> otherwise.
>
> I am rather sure this is valid C unless there we add a field with
> individual size greater than end_padding, hence intmax_t.

Sorry, couldn't really follow the problem and this solution idea yet.

Just think we shouldn't use intmax_t as I think it wasn't a good idea
to have it in the C standard at all.

Is it essential for your idea?


  Alexander
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to