mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-16 03:50:05 +01:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user