diff options
author | James Almer <jamrial@gmail.com> | 2021-02-08 19:04:05 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2021-02-13 13:05:26 -0300 |
commit | d5d6751a5505463824bf37e86a3a79010ba31d0b (patch) | |
tree | 928bdb278381b073204ab318d3862550c2e58196 /libavformat/movenc.c | |
parent | 93e2fa933f1625f488a2d88f9d50254ef13401d2 (diff) | |
download | ffmpeg-d5d6751a5505463824bf37e86a3a79010ba31d0b.tar.gz |
avformat/mux: return a pointer to the packet in ff_interleaved_peek()
And make it const, so the caller doesn't attempt to change it.
ff_get_muxer_ts_offset() should be used to get the muxer timestamp offset.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 62192e5c24..f97383fcfe 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5301,15 +5301,19 @@ static int mov_flush_fragment(AVFormatContext *s, int force) for (i = 0; i < s->nb_streams; i++) { MOVTrack *track = &mov->tracks[i]; if (!track->end_reliable) { - AVPacket pkt; - if (!ff_interleaved_peek(s, i, &pkt, 1)) { + const AVPacket *pkt = ff_interleaved_peek(s, i); + if (pkt) { + int64_t offset, dts, pts; + ff_get_muxer_ts_offset(s, i, &offset); + pts = pkt->pts + offset; + dts = pkt->dts + offset; if (track->dts_shift != AV_NOPTS_VALUE) - pkt.dts += track->dts_shift; - track->track_duration = pkt.dts - track->start_dts; - if (pkt.pts != AV_NOPTS_VALUE) - track->end_pts = pkt.pts; + dts += track->dts_shift; + track->track_duration = dts - track->start_dts; + if (pts != AV_NOPTS_VALUE) + track->end_pts = pts; else - track->end_pts = pkt.dts; + track->end_pts = dts; } } } |