mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 19:52:14 +00:00
mplayer: make --length relative to actual start of file, instead of 0
We always use the file's timestamps, so the start time can be easily something different from 0. Make the --length option respect this.
This commit is contained in:
parent
2c6f6c9f4e
commit
607892b741
@ -240,7 +240,8 @@ static double get_play_end_pts(struct MPContext *mpctx)
|
|||||||
if (opts->play_end.type) {
|
if (opts->play_end.type) {
|
||||||
return rel_time_to_abs(mpctx, opts->play_end, MP_NOPTS_VALUE);
|
return rel_time_to_abs(mpctx, opts->play_end, MP_NOPTS_VALUE);
|
||||||
} else if (opts->play_length.type) {
|
} else if (opts->play_length.type) {
|
||||||
double start = rel_time_to_abs(mpctx, opts->play_start, 0);
|
double startpts = get_start_time(mpctx);
|
||||||
|
double start = rel_time_to_abs(mpctx, opts->play_start, startpts);
|
||||||
double length = rel_time_to_abs(mpctx, opts->play_length, -1);
|
double length = rel_time_to_abs(mpctx, opts->play_length, -1);
|
||||||
if (start != -1 && length != -1)
|
if (start != -1 && length != -1)
|
||||||
return start + length;
|
return start + length;
|
||||||
|
Loading…
Reference in New Issue
Block a user