From 39ae261cc59598426b6e6beea2c849a6c8a9d20f Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 7 Aug 2016 13:53:34 +0200 Subject: demux_timeline: enable refresh seeks in some situations Play a trick to make the packet pos field monotonically increasing over segment boundaries if the source demuxers return monotonically increasing pos values. This allows the demuxer to uniquely identify packets with the pos field, and can do refresh seeks using that. Normally, the packet pos field is used as a fallback for determining the playback position if the demuxer returns no proper duration. But demux_timeline.c always will, and the packet pos fields usually make no sense in relation to the returned file size anyway if the timeline source demuxers originate from separate streams. --- demux/demux_timeline.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c index 03d7ddd1a3..a7024fef16 100644 --- a/demux/demux_timeline.c +++ b/demux/demux_timeline.c @@ -197,6 +197,11 @@ static int d_fill_buffer(struct demuxer *demuxer) if (pkt->stream < 0) goto drop; + // for refresh seeks, demux.c prefers monotonically increasing packet pos + // since the packet pos is meaningless anyway for timeline, use it + if (pkt->pos >= 0) + pkt->pos |= (seg->index & 0x7FFFULL) << 48; + struct virtual_stream *vs = &p->streams[pkt->stream]; if (pkt->pts != MP_NOPTS_VALUE && pkt->pts >= seg->end) { -- cgit v1.2.3