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/nutdec.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/nutdec.c')
-rw-r--r-- | libavformat/nutdec.c | 9 |
1 files changed, 5 insertions, 4 deletions
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); |