summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-08-15 21:07:32 +0200
committerwm4 <wm4@nowhere>2016-08-15 21:07:32 +0200
commit86fa1e6129b89a59492d7eb4b84e52dbec3d49ad (patch)
treecaae896c4f7812df4e276adaa0c9c6c1d7e19092 /player/playloop.c
parent795b65b2ffadcaa8d5a4e56340e9f70e0fac9e39 (diff)
downloadmpv-86fa1e6129b89a59492d7eb4b84e52dbec3d49ad.tar.bz2
mpv-86fa1e6129b89a59492d7eb4b84e52dbec3d49ad.tar.xz
player: allow passing flags to queue_seek()
Change the last parameter from a bool to an int, which is supposed to take bit-flags. The at this point only flag is MPSEEK_FLAG_DELAY, which replaces the previous bool parameter. The old false parameter becomes 0, the old true parameter becomes MPSEEK_FLAG_DELAY. Since the old "immediate" parameter is now essentially inverted, two coalesced immediate and delayed seeks end up as delayed instead of immediate. This change doesn't matter, since there are no relative immediate seeks anyway.
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 9b15ac3f50..abba107dc5 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -141,7 +141,7 @@ void add_step_frame(struct MPContext *mpctx, int dir)
unpause_player(mpctx);
} else if (dir < 0) {
if (!mpctx->hrseek_active) {
- queue_seek(mpctx, MPSEEK_BACKSTEP, 0, MPSEEK_VERY_EXACT, true);
+ queue_seek(mpctx, MPSEEK_BACKSTEP, 0, MPSEEK_VERY_EXACT, 0);
pause_player(mpctx);
}
}
@@ -305,7 +305,7 @@ static void mp_seek(MPContext *mpctx, struct seek_params seek)
// This combines consecutive seek requests.
void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount,
- enum seek_precision exact, bool immediate)
+ enum seek_precision exact, int flags)
{
struct seek_params *seek = &mpctx->seek;
@@ -314,7 +314,7 @@ void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount,
switch (type) {
case MPSEEK_RELATIVE:
- seek->immediate |= immediate;
+ seek->flags |= flags;
if (seek->type == MPSEEK_FACTOR)
return; // Well... not common enough to bother doing better
seek->amount += amount;
@@ -332,7 +332,7 @@ void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount,
.type = type,
.amount = amount,
.exact = exact,
- .immediate = immediate,
+ .flags = flags,
};
return;
case MPSEEK_NONE:
@@ -351,7 +351,8 @@ void execute_queued_seek(struct MPContext *mpctx)
/* If the user seeks continuously (keeps arrow key down)
* try to finish showing a frame from one location before doing
* another seek (which could lead to unchanging display). */
- if (!mpctx->seek.immediate && mpctx->video_status < STATUS_PLAYING &&
+ bool delay = mpctx->seek.flags & MPSEEK_FLAG_DELAY;
+ if (delay && mpctx->video_status < STATUS_PLAYING &&
mp_time_sec() - mpctx->start_timestamp < 0.3)
return;
mp_seek(mpctx, mpctx->seek);
@@ -682,7 +683,7 @@ static void handle_sstep(struct MPContext *mpctx)
if (opts->step_sec > 0 && !mpctx->paused) {
set_osd_function(mpctx, OSD_FFW);
- queue_seek(mpctx, MPSEEK_RELATIVE, opts->step_sec, MPSEEK_DEFAULT, true);
+ queue_seek(mpctx, MPSEEK_RELATIVE, opts->step_sec, MPSEEK_DEFAULT, 0);
}
if (mpctx->video_status >= STATUS_EOF) {
@@ -699,7 +700,7 @@ static void handle_loop_file(struct MPContext *mpctx)
if (opts->loop_file && mpctx->stop_play == AT_END_OF_FILE) {
mpctx->stop_play = KEEP_PLAYING;
set_osd_function(mpctx, OSD_FFW);
- queue_seek(mpctx, MPSEEK_ABSOLUTE, 0, MPSEEK_DEFAULT, true);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, 0, MPSEEK_DEFAULT, 0);
if (opts->loop_file > 0)
opts->loop_file--;
}