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/rmdec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libavformat/rmdec.c') diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 0aaebb86d7..d4ba6622a6 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -122,6 +122,7 @@ void ff_rm_free_rmstream (RMStream *rms) static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int read_all) { + FFStream *const sti = ffstream(st); char buf[256]; uint32_t version; int ret; @@ -202,7 +203,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, switch (st->codecpar->codec_id) { case AV_CODEC_ID_AC3: - st->internal->need_parsing = AVSTREAM_PARSE_FULL; + sti->need_parsing = AVSTREAM_PARSE_FULL; break; case AV_CODEC_ID_RA_288: st->codecpar->extradata_size= 0; @@ -211,7 +212,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, st->codecpar->block_align = coded_framesize; break; case AV_CODEC_ID_COOK: - st->internal->need_parsing = AVSTREAM_PARSE_HEADERS; + sti->need_parsing = AVSTREAM_PARSE_HEADERS; case AV_CODEC_ID_ATRAC3: case AV_CODEC_ID_SIPR: if (read_all) { @@ -235,7 +236,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, return -1; } st->codecpar->block_align = ff_sipr_subpk_size[flavor]; - st->internal->need_parsing = AVSTREAM_PARSE_FULL_RAW; + sti->need_parsing = AVSTREAM_PARSE_FULL_RAW; } else { if(sub_packet_size <= 0){ av_log(s, AV_LOG_ERROR, "sub_packet_size is invalid\n"); @@ -388,7 +389,7 @@ int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb, avio_skip(pb, 2); // looks like bits per sample avio_skip(pb, 4); // always zero? st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; - st->internal->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; + ffstream(st)->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; fps = avio_rb32(pb); if ((ret = rm_read_extradata(s, pb, st->codecpar, codec_data_size - (avio_tell(pb) - codec_pos))) < 0) -- cgit v1.2.3