summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-08-04 23:14:44 +0300
committerUoti Urpala <uau@mplayer2.org>2011-08-04 23:19:11 +0300
commit35ef4d02d01a537357b35c3c3e5d729846777c5e (patch)
tree07f5255cc22b10203b4b420773e5f6cf3ac7b836 /mplayer.c
parent0ece360eeaf95f2c33df2c0177cb98ffd5fc0338 (diff)
downloadmpv-35ef4d02d01a537357b35c3c3e5d729846777c5e.tar.bz2
mpv-35ef4d02d01a537357b35c3c3e5d729846777c5e.tar.xz
core: fix detection of files with no chapters
Initialize mpctx->last_chapter_seek to -2 instead of -1. This changes get_current_chapter() return value to -2 for files which have no chapters. -2 is used by some commands related to chapters to recognize files without chapters and return failure without any effect in that case.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mplayer.c b/mplayer.c
index 345cf9d624..bc99557a58 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3200,7 +3200,7 @@ static int seek(MPContext *mpctx, struct seek_params seek,
|| seek.type == MPSEEK_ABSOLUTE
&& seek.amount < mpctx->last_chapter_pts
|| seek.amount < 0)
- mpctx->last_chapter_seek = -1;
+ mpctx->last_chapter_seek = -2;
if (mpctx->timeline && seek.type == MPSEEK_FACTOR) {
seek.amount *= mpctx->timeline[mpctx->num_timeline_parts].start;
seek.type = MPSEEK_ABSOLUTE;
@@ -3400,7 +3400,7 @@ char *chapter_display_name(struct MPContext *mpctx, int chapter)
int seek_chapter(struct MPContext *mpctx, int chapter, double *seek_pts,
char **chapter_name)
{
- mpctx->last_chapter_seek = -1;
+ mpctx->last_chapter_seek = -2;
if (!mpctx->chapters || !mpctx->sh_video) {
int res = demuxer_seek_chapter(mpctx->demuxer, chapter, seek_pts,
chapter_name);
@@ -4825,7 +4825,7 @@ if(play_n_frames==0){
mpctx->hrseek_framedrop = false;
mpctx->step_frames = 0;
mpctx->total_avsync_change = 0;
- mpctx->last_chapter_seek = -1;
+ mpctx->last_chapter_seek = -2;
// If there's a timeline force an absolute seek to initialize state
if (opts->seek_to_sec || mpctx->timeline) {