This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6f4d952e6053693ce27621817c67e71935166f6a Author: James Almer <[email protected]> AuthorDate: Thu Oct 1 17:03:53 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Thu Oct 8 10:54:39 2026 -0300 avcodec: allow adding AVOption enabled but non-public fields to AVCodecContext Making AVCodecInternal fields AVOption enabled requires extra considerations in av_codec_context_class, and they will only be settable with an open context or by passing the options directly as part of avcodec_open2(). They also would require to allow searching children classes, which in the case of a fake object results in looking at every single underlying decoder/encoder option. Instead of that, extend AVCodecContext internally the same way we did for other contexts like AVFormatContext, and add fields outside the public part. Signed-off-by: James Almer <[email protected]> --- libavcodec/avcodec_internal.h | 13 ++++++++++++- libavcodec/options.c | 8 ++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libavcodec/avcodec_internal.h b/libavcodec/avcodec_internal.h index 06645e91a0..ebd9458120 100644 --- a/libavcodec/avcodec_internal.h +++ b/libavcodec/avcodec_internal.h @@ -27,9 +27,20 @@ #include "libavutil/frame.h" +#include "avcodec.h" #include "packet.h" -struct AVCodecContext; +typedef struct FFCodecContext { + /** + * The public context. + */ + AVCodecContext pub; +} FFCodecContext; + +static av_always_inline FFCodecContext *ffcodeccontext(AVCodecContext *avctx) +{ + return (FFCodecContext*)avctx; +} typedef struct SideDataMap { enum AVPacketSideDataType packet; diff --git a/libavcodec/options.c b/libavcodec/options.c index 834beb5757..d85137a99e 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -148,11 +148,15 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec) AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) { - AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); + FFCodecContext *ffavc; + AVCodecContext *avctx; - if (!avctx) + ffavc = av_mallocz(sizeof(*ffavc)); + if (!ffavc) return NULL; + avctx = &ffavc->pub; + if (init_context_defaults(avctx, codec) < 0) { av_free(avctx); return NULL; -- 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]
