summaryrefslogtreecommitdiffstats
path: root/demux/demux.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-30 14:26:54 +0100
committerwm4 <wm4@nowhere>2017-10-30 15:28:59 +0100
commit2d958dbf2bd918391f3b3f48fe131d3eb783463a (patch)
tree5bc3d3c0888afe734c8f6913bf691095aa5dc7c5 /demux/demux.h
parentd6ebb2df47fa2827aecdcf236a234cd2fe74fe2c (diff)
downloadmpv-2d958dbf2bd918391f3b3f48fe131d3eb783463a.tar.bz2
mpv-2d958dbf2bd918391f3b3f48fe131d3eb783463a.tar.xz
demux: refactor to export seek ranges
Even though only 1 seek range is supported at the time. Other than preparation for possibly future features, the main gain is actually that we finally separate the reporting for the buffering, and the seek ranges. These can be subtly different, so it's good to have a clear separation. This commit also fixes that the ts_reader wasn't rebased to the start time, which could make the player show "???" for buffered cache amount in some .ts files and others (especially at the end, when ts_reader could become higher than ts_max). It also fixes writing the cache-end field in the demuxer-cache-state property: it checked ts_start against NOPTS, which makes no sense. ts_start was never used (except for the bug mentioned above), so get rid of it completely. This also makes it convenient to move the segment check for last_ts to the demux_add_packet() function.
Diffstat (limited to 'demux/demux.h')
-rw-r--r--demux/demux.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/demux/demux.h b/demux/demux.h
index 64b9f9f561..81670fac6f 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -40,16 +40,21 @@ enum demux_ctrl {
DEMUXER_CTRL_REPLACE_STREAM,
};
+#define MAX_SEEK_RANGES 1
+
+struct demux_seek_range {
+ double start, end;
+};
+
struct demux_ctrl_reader_state {
- bool eof, underrun, idle, seekable;
+ bool eof, underrun, idle;
double ts_duration;
double ts_reader; // approx. timerstamp of decoder position
- double ts_start; // approx. timestamp for the earliest packet buffered
- double ts_min; // timestamp of the earliest packet in backward cache
- // that can be seeked to (i.e. all streams have such
- // a packet for which normal seeks can be executed)
- double ts_max; // timestamp of latest packet in forward cache that can be
- // seeked to
+ double ts_end; // approx. timestamp of end of buffered range
+ // Positions that can be seeked to without incurring the latency of a low
+ // level seek.
+ int num_seek_ranges;
+ struct demux_seek_range seek_ranges[MAX_SEEK_RANGES];
};
struct demux_ctrl_stream_ctrl {