diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-24 14:58:07 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-17 04:58:34 +0200 |
commit | fed02825081bd6441f865c9cfcf50e384b2392f5 (patch) | |
tree | b42f4b433b1652e4ad65bc0b5066fe3e80d5662f /libavformat/matroskadec.c | |
parent | dfbf41775cb58a9218a8b39b0dc6fd8de3f1ab35 (diff) | |
download | ffmpeg-fed02825081bd6441f865c9cfcf50e384b2392f5.tar.gz |
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>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index c67a728737..b38b1b418b 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -382,7 +382,7 @@ typedef struct MatroskaDemuxContext { /* byte position of the segment inside the stream */ int64_t segment_start; - /* This packet coincides with AVFormatInternal.parse_pkt + /* This packet coincides with FFFormatContext.parse_pkt * and is not owned by us. */ AVPacket *pkt; @@ -2898,6 +2898,7 @@ static int matroska_parse_tracks(AVFormatContext *s) static int matroska_read_header(AVFormatContext *s) { + FFFormatContext *const si = ffformatcontext(s); MatroskaDemuxContext *matroska = s->priv_data; EbmlList *attachments_list = &matroska->attachments; EbmlList *chapters_list = &matroska->chapters; @@ -2944,7 +2945,7 @@ static int matroska_read_header(AVFormatContext *s) } ebml_free(ebml_syntax, &ebml); - matroska->pkt = s->internal->parse_pkt; + matroska->pkt = si->parse_pkt; /* The next thing is a segment. */ pos = avio_tell(matroska->ctx->pb); @@ -2961,7 +2962,7 @@ static int matroska_read_header(AVFormatContext *s) } /* Set data_offset as it might be needed later by seek_frame_generic. */ if (matroska->current_id == MATROSKA_ID_CLUSTER) - s->internal->data_offset = avio_tell(matroska->ctx->pb) - 4; + si->data_offset = avio_tell(matroska->ctx->pb) - 4; matroska_execute_seekhead(matroska); if (!matroska->time_scale) |