From fed02825081bd6441f865c9cfcf50e384b2392f5 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 24 Aug 2021 14:58:07 +0200 Subject: avformat: Avoid allocation for AVFormatInternal Do this by allocating AVFormatContext together with the data that is currently in AVFormatInternal; or rather: Put AVFormatContext at the beginning of a new structure called FFFormatContext (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVFormatInternal altogether. The biggest simplifications occured in avformat_alloc_context(), where one can now simply call avformat_free_context() in case of errors. Signed-off-by: Andreas Rheinhardt --- libavformat/codec2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libavformat/codec2.c') diff --git a/libavformat/codec2.c b/libavformat/codec2.c index 1ddba808dd..0b992836b3 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -177,7 +177,7 @@ static int codec2_read_header(AVFormatContext *s) return AVERROR_PATCHWELCOME; } - s->internal->data_offset = CODEC2_HEADER_SIZE; + ffformatcontext(s)->data_offset = CODEC2_HEADER_SIZE; return codec2_read_header_common(s, st); } @@ -255,7 +255,6 @@ static int codec2raw_read_header(AVFormatContext *s) return ret; } - s->internal->data_offset = 0; codec2_make_extradata(st->codecpar->extradata, c2->mode); return codec2_read_header_common(s, st); -- cgit v1.2.3