summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-18 21:13:14 +0200
committerwm4 <wm4@nowhere>2012-09-23 14:56:24 +0200
commit5a617d02d95d59fbf06e865489d75fdc1ce46203 (patch)
treed0e7d523bfed0972d84cf4549ee875540880ee5c
parenta70adbfe655804008578c1a17ecddcd770e0cf7c (diff)
downloadmpv-5a617d02d95d59fbf06e865489d75fdc1ce46203.tar.bz2
mpv-5a617d02d95d59fbf06e865489d75fdc1ce46203.tar.xz
mplayer: fix abort command handling
Now it actually aborts, even if the abort command is not the first command. Make a policy change: commands before the abort command are silently thrown away. Previously, normal commands were run after the abort command finished (so they were run out of order). I'm not sure which way is the best, all things considered, but the new way is simpler.
-rw-r--r--mplayer.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/mplayer.c b/mplayer.c
index 7fa37641fc..d4865831e7 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -919,22 +919,18 @@ static void load_per_file_options(m_config_t *conf,
* The function returns whether it was interrupted. */
static bool libmpdemux_was_interrupted(struct MPContext *mpctx)
{
- // Basically, give queued up user commands a chance to run, if the normal
- // play loop (which does run_command()) hasn't been executed for a while.
- mp_cmd_t *cmd = mp_input_get_cmd(mpctx->input, 0, 0);
- if (cmd) {
- // Only run "safe" commands. Consider the case someone queues up a
- // command to load a file, and immediately after that to select a
- // subtitle stream. This function can be called between opening the
- // file and opening the demuxer. We don't want the subtitle command to
- // be lost.
- if (mp_input_is_abort_cmd(cmd->id)) {
+ for (;;) {
+ if (mpctx->stop_play != KEEP_PLAYING
+ && mpctx->stop_play != AT_END_OF_FILE)
+ return true;
+ mp_cmd_t *cmd = mp_input_get_cmd(mpctx->input, 0, 0);
+ if (!cmd)
+ break;
+ if (mp_input_is_abort_cmd(cmd->id))
run_command(mpctx, cmd);
- mp_cmd_free(cmd);
- }
+ mp_cmd_free(cmd);
}
- return mpctx->stop_play != KEEP_PLAYING
- || mpctx->stop_play != AT_END_OF_FILE;
+ return false;
}
static int find_new_tid(struct MPContext *mpctx, enum stream_type t)