summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-02-08 19:04:05 -0300
committerJames Almer <jamrial@gmail.com>2021-02-13 13:05:26 -0300
commitd5d6751a5505463824bf37e86a3a79010ba31d0b (patch)
tree928bdb278381b073204ab318d3862550c2e58196 /libavformat/mux.c
parent93e2fa933f1625f488a2d88f9d50254ef13401d2 (diff)
downloadffmpeg-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/mux.c')
-rw-r--r--libavformat/mux.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index ae46844c66..062ba8d789 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1062,30 +1062,16 @@ int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset
return 0;
}
-int ff_interleaved_peek(AVFormatContext *s, int stream,
- AVPacket *pkt, int add_offset)
+const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream)
{
AVPacketList *pktl = s->internal->packet_buffer;
while (pktl) {
if (pktl->pkt.stream_index == stream) {
- *pkt = pktl->pkt;
- if (add_offset) {
- AVStream *st = s->streams[pkt->stream_index];
- int64_t offset = st->internal->mux_ts_offset;
-
- if (s->output_ts_offset)
- offset += av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, st->time_base);
-
- if (pkt->dts != AV_NOPTS_VALUE)
- pkt->dts += offset;
- if (pkt->pts != AV_NOPTS_VALUE)
- pkt->pts += offset;
- }
- return 0;
+ return &pktl->pkt;
}
pktl = pktl->next;
}
- return AVERROR(ENOENT);
+ return NULL;
}
/**