diff options
author | wm4 <wm4@nowhere> | 2013-03-01 13:20:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-03-01 14:44:53 +0100 |
commit | 8ddfabc5354c82e931334658b60f22ecdb3ebb1b (patch) | |
tree | 251eb0c5d0a1a13c7763e834b47d1aeaca0547b2 /core/mp_core.h | |
parent | c82a83d8afd98582e778cbf02a4ecc44e2d6399d (diff) | |
download | mpv-8ddfabc5354c82e931334658b60f22ecdb3ebb1b.tar.bz2 mpv-8ddfabc5354c82e931334658b60f22ecdb3ebb1b.tar.xz |
core: fix SEEK_FACTOR
Emulate percentage-seeks (SEEK_FACTOR) as normal time-seeks if possible.
This fixes some issues with (let's call it) low quality implementations
of SEEK_FACTOR (e.g. demux_mkv basically interprets this as byte-seek,
and also seeking to 99.9% makes it seek back to the start).
For weird MPEG formats the demuxer level SEEK_FACTOR is still used.
These formats, which can have timestamp resets, are identified by
setting demuxer->ts_resets_possible to true.
Also, have get_current_pos_ratio() follow the same rules, and calculate
the percentage position with the file position if timestamp resets are
possible.
This actually fixes percentage-seeks in .ts files with demux_lavf.c.
This kind of seek is not really used now, but it will be more important
when we add a progress bar.
Note: seeking in chained ogg files is still completely broken. The main
issue is that ffmpeg doesn't provide a sane API for dealing with
timestamp resets, and trying to do byte seeks with ogg confuses demuxer
and decoder (or something like this) and just does random things.
(Tested with two concatenated flac-in-ogg files).
Diffstat (limited to 'core/mp_core.h')
-rw-r--r-- | core/mp_core.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/mp_core.h b/core/mp_core.h index 25482ac3ef..58d6bb4791 100644 --- a/core/mp_core.h +++ b/core/mp_core.h @@ -280,6 +280,7 @@ void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount, int exact); int seek_chapter(struct MPContext *mpctx, int chapter, double *seek_pts); double get_time_length(struct MPContext *mpctx); +double get_start_time(struct MPContext *mpctx); double get_current_time(struct MPContext *mpctx); int get_percent_pos(struct MPContext *mpctx); double get_current_pos_ratio(struct MPContext *mpctx); |