From 40bdd8cc05d9c98a18cf2b1c2a00c8a5a7b38113 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 24 Aug 2021 19:41:16 +0200 Subject: avformat: Avoid allocation for AVStreamInternal Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt --- libavformat/internal.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libavformat/internal.h') diff --git a/libavformat/internal.h b/libavformat/internal.h index 8625ab8258..13e0a3df30 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -185,7 +185,12 @@ static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s) return (FFFormatContext*)s; } -struct AVStreamInternal { +typedef struct FFStream { + /** + * The public context. + */ + AVStream pub; + /** * Set to 1 if the codec allows reordering, so pts can be different * from dts. @@ -416,7 +421,17 @@ struct AVStreamInternal { */ int64_t first_dts; int64_t cur_dts; -}; +} FFStream; + +static av_always_inline FFStream *ffstream(AVStream *st) +{ + return (FFStream*)st; +} + +static av_always_inline const FFStream *cffstream(const AVStream *st) +{ + return (FFStream*)st; +} void avpriv_stream_set_need_parsing(AVStream *st, enum AVStreamParseType type); -- cgit v1.2.3