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 <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-24 14:58:07 +02:00
parent dfbf41775c
commit fed0282508
32 changed files with 135 additions and 138 deletions

View file

@ -258,7 +258,8 @@ static int flac_probe(const AVProbeData *p)
static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *ppos, int64_t pos_limit)
{
AVPacket *pkt = s->internal->parse_pkt;
FFFormatContext *const si = ffformatcontext(s);
AVPacket *const pkt = si->parse_pkt;
AVStream *st = s->streams[stream_index];
AVCodecParserContext *parser;
int ret;