diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-24 19:41:16 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-17 13:22:25 +0200 |
commit | 40bdd8cc05d9c98a18cf2b1c2a00c8a5a7b38113 (patch) | |
tree | 0fc408f78b9b6934ac351cd4499c07737f8f6a62 /libavformat/mxfdec.c | |
parent | 9f05b3ba604a30eeb6f5ff877b8b5b5c93a268d7 (diff) | |
download | ffmpeg-40bdd8cc05d9c98a18cf2b1c2a00c8a5a7b38113.tar.gz |
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 <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r-- | libavformat/mxfdec.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index ebe411b04d..062ae322b3 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1793,7 +1793,7 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta * 6: 5 5 * * We do this by bucket sorting x by x+TemporalOffset[x] into mxf->ptses, - * then settings mxf->internal->first_dts = -max(TemporalOffset[x]). + * then settings ffstream(mxf)->first_dts = -max(TemporalOffset[x]). * The latter makes DTS <= PTS. */ for (i = x = 0; i < index_table->nb_segments; i++) { @@ -2328,6 +2328,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) const MXFCodecUL *container_ul = NULL; const MXFCodecUL *pix_fmt_ul = NULL; AVStream *st; + FFStream *sti; AVTimecode tc; int flags; @@ -2435,6 +2436,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) ret = AVERROR(ENOMEM); goto fail_and_free; } + sti = ffstream(st); st->id = material_track->track_id; st->priv_data = source_track; @@ -2620,7 +2622,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) } } } - st->internal->need_parsing = AVSTREAM_PARSE_HEADERS; + sti->need_parsing = AVSTREAM_PARSE_HEADERS; if (material_track->sequence->origin) { av_dict_set_int(&st->metadata, "material_track_origin", material_track->sequence->origin, 0); } @@ -2628,7 +2630,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) av_dict_set_int(&st->metadata, "source_track_origin", source_track->sequence->origin, 0); } if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den) - st->internal->display_aspect_ratio = descriptor->aspect_ratio; + sti->display_aspect_ratio = descriptor->aspect_ratio; st->codecpar->color_range = mxf_get_color_range(mxf, descriptor); st->codecpar->color_primaries = mxf_get_codec_ul(ff_mxf_color_primaries_uls, &descriptor->color_primaries_ul)->id; st->codecpar->color_trc = mxf_get_codec_ul(ff_mxf_color_trc_uls, &descriptor->color_trc_ul)->id; @@ -2685,7 +2687,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) else if (descriptor->bits_per_sample == 32) st->codecpar->codec_id = AV_CODEC_ID_PCM_S32BE; } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) { - st->internal->need_parsing = AVSTREAM_PARSE_FULL; + sti->need_parsing = AVSTREAM_PARSE_FULL; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { @@ -2719,7 +2721,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) } if (st->codecpar->codec_type != AVMEDIA_TYPE_DATA && source_track->wrapping != FrameWrapped) { /* TODO: decode timestamps */ - st->internal->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; + sti->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; } } @@ -3680,7 +3682,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) if (next_ofs <= 0) { // If we have no way to packetize the data, then return it in chunks... if (klv.next_klv - klv.length == pos && max_data_size > MXF_MAX_CHUNK_SIZE) { - st->internal->need_parsing = AVSTREAM_PARSE_FULL; + ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL; avpriv_request_sample(s, "Huge KLV without proper index in non-frame wrapped essence"); } size = FFMIN(max_data_size, MXF_MAX_CHUNK_SIZE); |