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/nutdec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libavformat/nutdec.c') diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 50f8b64d10..0a8a700acf 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -1086,7 +1086,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) stc->skip_until_key_frame = 0; discard = s->streams[stream_id]->discard; - last_IP_pts = s->streams[stream_id]->internal->last_IP_pts; + last_IP_pts = ffstream(s->streams[stream_id])->last_IP_pts; if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || @@ -1225,6 +1225,7 @@ static int read_seek(AVFormatContext *s, int stream_index, { NUTContext *nut = s->priv_data; AVStream *st = s->streams[stream_index]; + FFStream *const sti = ffstream(st); Syncpoint dummy = { .ts = pts * av_q2d(st->time_base) * AV_TIME_BASE }; Syncpoint nopts_sp = { .ts = AV_NOPTS_VALUE, .back_ptr = AV_NOPTS_VALUE }; Syncpoint *sp, *next_node[2] = { &nopts_sp, &nopts_sp }; @@ -1235,15 +1236,15 @@ static int read_seek(AVFormatContext *s, int stream_index, return AVERROR(ENOSYS); } - if (st->internal->index_entries) { + if (sti->index_entries) { int index = av_index_search_timestamp(st, pts, flags); if (index < 0) index = av_index_search_timestamp(st, pts, flags ^ AVSEEK_FLAG_BACKWARD); if (index < 0) return -1; - pos2 = st->internal->index_entries[index].pos; - ts = st->internal->index_entries[index].timestamp; + pos2 = sti->index_entries[index].pos; + ts = sti->index_entries[index].timestamp; } else { av_tree_find(nut->syncpoints, &dummy, ff_nut_sp_pts_cmp, (void **) next_node); -- cgit v1.2.3