mirror of https://github.com/mpv-player/mpv
player: remove some duplication between normal looping and ab-loops
Not sure if this is better or worse. Some minor behavior changes.
This commit is contained in:
parent
7a0f112a44
commit
878d4ea2ee
|
@ -814,25 +814,30 @@ static void handle_loop_file(struct MPContext *mpctx)
|
||||||
{
|
{
|
||||||
struct MPOpts *opts = mpctx->opts;
|
struct MPOpts *opts = mpctx->opts;
|
||||||
|
|
||||||
double ab[2];
|
if (mpctx->stop_play != AT_END_OF_FILE)
|
||||||
if (mpctx->stop_play == AT_END_OF_FILE && get_ab_loop_times(mpctx, ab) &&
|
return;
|
||||||
mpctx->ab_loop_clip)
|
|
||||||
{
|
|
||||||
// Assumes execute_queued_seek() happens before next audio/video is
|
|
||||||
// attempted to be decoded or filtered.
|
|
||||||
mpctx->stop_play = KEEP_PLAYING;
|
|
||||||
mark_seek(mpctx);
|
|
||||||
queue_seek(mpctx, MPSEEK_ABSOLUTE, ab[0], MPSEEK_EXACT,
|
|
||||||
MPSEEK_FLAG_NOFLUSH);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not attempt to loop-file if --ab-loop is active.
|
double target = MP_NOPTS_VALUE;
|
||||||
else if (opts->loop_file && mpctx->stop_play == AT_END_OF_FILE) {
|
enum seek_precision prec = MPSEEK_DEFAULT;
|
||||||
mpctx->stop_play = KEEP_PLAYING;
|
|
||||||
set_osd_function(mpctx, OSD_FFW);
|
double ab[2];
|
||||||
queue_seek(mpctx, MPSEEK_ABSOLUTE, 0, MPSEEK_DEFAULT, MPSEEK_FLAG_NOFLUSH);
|
if (get_ab_loop_times(mpctx, ab) && mpctx->ab_loop_clip) {
|
||||||
|
target = ab[0];
|
||||||
|
prec = MPSEEK_EXACT;
|
||||||
|
} else if (opts->loop_file) {
|
||||||
if (opts->loop_file > 0)
|
if (opts->loop_file > 0)
|
||||||
opts->loop_file--;
|
opts->loop_file--;
|
||||||
|
target = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target != MP_NOPTS_VALUE) {
|
||||||
|
mpctx->stop_play = KEEP_PLAYING;
|
||||||
|
set_osd_function(mpctx, OSD_FFW);
|
||||||
|
mark_seek(mpctx);
|
||||||
|
|
||||||
|
// Assumes execute_queued_seek() happens before next audio/video is
|
||||||
|
// attempted to be decoded or filtered.
|
||||||
|
queue_seek(mpctx, MPSEEK_ABSOLUTE, target, prec, MPSEEK_FLAG_NOFLUSH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue