mirror of
https://github.com/mpv-player/mpv
synced 2025-01-09 08:29:36 +00:00
player: let chapter_start_time() return MP_NOPTS_VALUE for unknown times
This commit is contained in:
parent
5cae4a807c
commit
c19c777061
@ -490,7 +490,7 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
|
|||||||
chapter_start_time(mpctx, chapter);
|
chapter_start_time(mpctx, chapter);
|
||||||
// If we are far enough into a chapter, seek back to the
|
// If we are far enough into a chapter, seek back to the
|
||||||
// beginning of current chapter instead of previous one
|
// beginning of current chapter instead of previous one
|
||||||
if (current_chapter_start >= 0 &&
|
if (current_chapter_start != MP_NOPTS_VALUE &&
|
||||||
get_current_time(mpctx) - current_chapter_start >
|
get_current_time(mpctx) - current_chapter_start >
|
||||||
mpctx->opts->chapter_seek_threshold)
|
mpctx->opts->chapter_seek_threshold)
|
||||||
step_all++;
|
step_all++;
|
||||||
|
@ -66,7 +66,7 @@ double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t,
|
|||||||
return length * (t.pos / 100.0);
|
return length * (t.pos / 100.0);
|
||||||
break;
|
break;
|
||||||
case REL_TIME_CHAPTER:
|
case REL_TIME_CHAPTER:
|
||||||
if (chapter_start_time(mpctx, t.pos) >= 0)
|
if (chapter_start_time(mpctx, t.pos) != MP_NOPTS_VALUE)
|
||||||
return chapter_start_time(mpctx, t.pos);
|
return chapter_start_time(mpctx, t.pos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ double chapter_start_time(struct MPContext *mpctx, int chapter)
|
|||||||
return get_start_time(mpctx);
|
return get_start_time(mpctx);
|
||||||
if (chapter >= 0 && chapter < mpctx->num_chapters)
|
if (chapter >= 0 && chapter < mpctx->num_chapters)
|
||||||
return mpctx->chapters[chapter].start;
|
return mpctx->chapters[chapter].start;
|
||||||
return -1.0;
|
return MP_NOPTS_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_chapter_count(struct MPContext *mpctx)
|
int get_chapter_count(struct MPContext *mpctx)
|
||||||
@ -567,7 +567,7 @@ bool mp_seek_chapter(struct MPContext *mpctx, int chapter)
|
|||||||
mpctx->last_chapter_seek = -2;
|
mpctx->last_chapter_seek = -2;
|
||||||
|
|
||||||
double pts = chapter_start_time(mpctx, chapter);
|
double pts = chapter_start_time(mpctx, chapter);
|
||||||
if (pts == -1.0)
|
if (pts == MP_NOPTS_VALUE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
queue_seek(mpctx, MPSEEK_ABSOLUTE, pts, 0, true);
|
queue_seek(mpctx, MPSEEK_ABSOLUTE, pts, 0, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user