summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-08-07 13:53:34 +0200
committerwm4 <wm4@nowhere>2016-08-07 13:53:34 +0200
commit39ae261cc59598426b6e6beea2c849a6c8a9d20f (patch)
tree81c98e100e39288155928d0cd0fb51ebba07629f
parent78bcbe289e3c35696e193be16a547095c77c628a (diff)
downloadmpv-39ae261cc59598426b6e6beea2c849a6c8a9d20f.tar.bz2
mpv-39ae261cc59598426b6e6beea2c849a6c8a9d20f.tar.xz
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.
-rw-r--r--demux/demux_timeline.c5
1 files changed, 5 insertions, 0 deletions
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) {