summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-24 20:46:54 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-25 22:48:10 +0300
commit05ae9dbd0dcc4fcce02a97011a46d89dab860021 (patch)
treef839629bcb07817af7b52f96fcd5d592b3b34c81 /mplayer.c
parentdd1760e697f38a13f05d2d8563598a2e6ed0a84f (diff)
downloadmpv-05ae9dbd0dcc4fcce02a97011a46d89dab860021.tar.bz2
mpv-05ae9dbd0dcc4fcce02a97011a46d89dab860021.tar.xz
Fix chapter handling with first chapter not at beginning of file
Before "-chapter 1" did nothing even if the first chapter didn't start at the beginning of file. Fix it. Before all chapter property commands (including chapter seek keys) failed if the current playback position was before the start of the first chapter. Now they'll work. Relative chapter seeks will go to the first chapter (even if that's in the wrong direction for backward seeks).
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mplayer.c b/mplayer.c
index f5544b8e57..4eec335b99 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2790,6 +2790,7 @@ static int seek(MPContext *mpctx, double amount, int style)
return 0;
}
+// -2 is no chapters, -1 is before first chapter
int get_current_chapter(struct MPContext *mpctx)
{
if (!mpctx->chapters || !mpctx->sh_video)
@@ -4058,7 +4059,7 @@ if (seek_to_sec || mpctx->timeline) {
seek(mpctx, seek_to_sec, SEEK_ABSOLUTE);
end_at.pos += seek_to_sec;
}
-if (opts->chapterrange[0] > 1) {
+if (opts->chapterrange[0] > 0) {
double pts;
if (seek_chapter(mpctx, opts->chapterrange[0]-1, &pts, NULL) >= 0
&& pts > -1.0)