summaryrefslogtreecommitdiffstats
path: root/player/command.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/command.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/command.c')
-rw-r--r--player/command.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/player/command.c b/player/command.c
index ac97e1022d..f941e864dc 100644
--- a/player/command.c
+++ b/player/command.c
@@ -649,7 +649,7 @@ static int mp_property_percent_pos(void *ctx, struct m_property *prop,
switch (action) {
case M_PROPERTY_SET: {
double pos = *(double *)arg;
- queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, MPSEEK_DEFAULT, true);
+ queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, MPSEEK_DEFAULT, 0);
return M_PROPERTY_OK;
}
case M_PROPERTY_GET: {
@@ -694,7 +694,7 @@ static int mp_property_time_pos(void *ctx, struct m_property *prop,
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
- queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, true);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, 0);
return M_PROPERTY_OK;
}
return property_time(action, arg, get_current_time(mpctx));
@@ -743,7 +743,7 @@ static int mp_property_playback_time(void *ctx, struct m_property *prop,
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
- queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, true);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, 0);
return M_PROPERTY_OK;
}
return property_time(action, arg, get_playback_time(mpctx));
@@ -844,7 +844,7 @@ static int mp_property_chapter(void *ctx, struct m_property *prop,
} else {
double pts = chapter_start_time(mpctx, chapter);
if (pts != MP_NOPTS_VALUE) {
- queue_seek(mpctx, MPSEEK_ABSOLUTE, pts, MPSEEK_DEFAULT, true);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, pts, MPSEEK_DEFAULT, 0);
mpctx->last_chapter_seek = chapter;
mpctx->last_chapter_pts = pts;
}
@@ -2210,7 +2210,7 @@ static int mp_property_hwdec(void *ctx, struct m_property *prop,
video_vd_control(vd, VDCTRL_REINIT, NULL);
double last_pts = mpctx->last_vo_pts;
if (last_pts != MP_NOPTS_VALUE)
- queue_seek(mpctx, MPSEEK_ABSOLUTE, last_pts, MPSEEK_EXACT, true);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, last_pts, MPSEEK_EXACT, 0);
}
return M_PROPERTY_OK;
}
@@ -4622,19 +4622,19 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
mark_seek(mpctx);
switch (abs) {
case 0: { // Relative seek
- queue_seek(mpctx, MPSEEK_RELATIVE, v, precision, false);
+ queue_seek(mpctx, MPSEEK_RELATIVE, v, precision, MPSEEK_FLAG_DELAY);
set_osd_function(mpctx, (v > 0) ? OSD_FFW : OSD_REW);
break;
}
case 1: { // Absolute seek by percentage
double ratio = v / 100.0;
double cur_pos = get_current_pos_ratio(mpctx, false);
- queue_seek(mpctx, MPSEEK_FACTOR, ratio, precision, false);
+ queue_seek(mpctx, MPSEEK_FACTOR, ratio, precision, MPSEEK_FLAG_DELAY);
set_osd_function(mpctx, cur_pos < ratio ? OSD_FFW : OSD_REW);
break;
}
case 2: { // Absolute seek to a timestamp in seconds
- queue_seek(mpctx, MPSEEK_ABSOLUTE, v, precision, false);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, v, precision, MPSEEK_FLAG_DELAY);
set_osd_function(mpctx,
v > get_current_time(mpctx) ? OSD_FFW : OSD_REW);
break;
@@ -4642,7 +4642,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
case 3: { // Relative seek by percentage
queue_seek(mpctx, MPSEEK_FACTOR,
get_current_pos_ratio(mpctx, false) + v / 100.0,
- precision, false);
+ precision, MPSEEK_FLAG_DELAY);
set_osd_function(mpctx, v > 0 ? OSD_FFW : OSD_REW);
break;
}}
@@ -4664,7 +4664,8 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
} else if (oldpts != MP_NOPTS_VALUE) {
cmdctx->last_seek_pts = get_current_time(mpctx);
cmdctx->marked_pts = MP_NOPTS_VALUE;
- queue_seek(mpctx, MPSEEK_ABSOLUTE, oldpts, MPSEEK_EXACT, false);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, oldpts, MPSEEK_EXACT,
+ MPSEEK_FLAG_DELAY);
set_osd_function(mpctx, OSD_REW);
if (bar_osd)
mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR;
@@ -4850,7 +4851,8 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
// rounding for the mess of it.
a[0] += 0.01 * (a[1] >= 0 ? 1 : -1);
mark_seek(mpctx);
- queue_seek(mpctx, MPSEEK_RELATIVE, a[0], MPSEEK_EXACT, false);
+ queue_seek(mpctx, MPSEEK_RELATIVE, a[0], MPSEEK_EXACT,
+ MPSEEK_FLAG_DELAY);
set_osd_function(mpctx, (a[0] > 0) ? OSD_FFW : OSD_REW);
if (bar_osd)
mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR;
@@ -5421,7 +5423,7 @@ void handle_ab_loop(struct MPContext *mpctx)
{
mark_seek(mpctx);
queue_seek(mpctx, MPSEEK_ABSOLUTE, start,
- MPSEEK_EXACT, false);
+ MPSEEK_EXACT, MPSEEK_FLAG_DELAY);
}
}
ctx->prev_pts = now;