summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-07 22:29:50 +0100
committerwm4 <wm4@nowhere>2014-02-07 22:29:50 +0100
commit17ec073a1588ddf768e64775ee51c0c47f94bfc2 (patch)
treeec243b24799ee28ffcf23dd2ca9997b8c6e69be2 /player/command.c
parent67769db1a4e3a765c5f770f44f8b2b041a0246a9 (diff)
downloadmpv-17ec073a1588ddf768e64775ee51c0c47f94bfc2.tar.bz2
mpv-17ec073a1588ddf768e64775ee51c0c47f94bfc2.tar.xz
player: handle seek delays differently
The code removed from handle_input_and_seek_coalesce() did two things: 1. If there's a queued seek, stop accepting non-seek commands, and delay them to the next playloop iteration. 2. If a seek is executing (i.e. the seek was unqueued, and now it's trying to decode and display the first video frame), stop accepting seek commands (and in fact all commands that were queued after the first seek command). This logic is disabled if seeking started longer than 300ms ago. (To avoid starvation.) I'm not sure why 1. would be needed. It's still possible that a command immediately executed after a seek command sees a "seeking in progress" state, because it affects queued seeks only, and not seeks in progress. Drop this code, since it can easily lead to input starvation, and I'm not aware of any disadvantages. The logic in 2. is good to make seeking behave much better, as it guarantees that the video display is updated frequently. Keep the core idea, but implement it differently. Now this logic is applied to seeks only. Commands after the seek can execute freely, and like with 1., I don't see a reason why they couldn't. However, in some cases, seeks are supposed to be executed instantly, so queue_seek() needs an additional parameter to signal the need for immediate update. One nice thing is that commands like sub_seek automatically profit from the seek delay logic. On the other hand, hitting chapter seek multiple times still does not update the video on chapter boundaries (as it should be). Note that the main goal of this commit is actually simplification of the input processing logic and to allow all commands to be executed immediately.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/player/command.c b/player/command.c
index 4166d93550..1b2c6abab3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -358,7 +358,7 @@ static int mp_property_percent_pos(m_option_t *prop, int action,
switch (action) {
case M_PROPERTY_SET: {
double pos = *(double *)arg;
- queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, 0);
+ queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, 0, true);
return M_PROPERTY_OK;
}
case M_PROPERTY_GET: {
@@ -383,7 +383,7 @@ static int mp_property_time_pos(m_option_t *prop, int action,
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
- queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, 0);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, 0, true);
return M_PROPERTY_OK;
}
return property_time(prop, action, arg, get_current_time(mpctx));
@@ -2562,14 +2562,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
int exact = cmd->args[2].v.i;
mark_seek(mpctx);
if (abs == 2) { // Absolute seek to a timestamp in seconds
- queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact, false);
set_osd_function(mpctx,
v > get_current_time(mpctx) ? OSD_FFW : OSD_REW);
} else if (abs) { /* Absolute seek by percentage */
- queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact);
+ queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact, false);
set_osd_function(mpctx, OSD_FFW); // Direction isn't set correctly
} else {
- queue_seek(mpctx, MPSEEK_RELATIVE, v, exact);
+ queue_seek(mpctx, MPSEEK_RELATIVE, v, exact, false);
set_osd_function(mpctx, (v > 0) ? OSD_FFW : OSD_REW);
}
if (bar_osd)
@@ -2583,7 +2583,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
double oldpts = cmdctx->last_seek_pts;
if (oldpts != MP_NOPTS_VALUE) {
cmdctx->last_seek_pts = get_current_time(mpctx);
- queue_seek(mpctx, MPSEEK_ABSOLUTE, oldpts, 1);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, oldpts, 1, false);
set_osd_function(mpctx, OSD_REW);
if (bar_osd)
mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR;
@@ -2761,7 +2761,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
// 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], 1);
+ queue_seek(mpctx, MPSEEK_RELATIVE, a[0], 1, false);
set_osd_function(mpctx, (a[0] > 0) ? OSD_FFW : OSD_REW);
if (bar_osd)
mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR;