From 12d1404b04e90f5357882e5c1048d92305248cb9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 18 May 2018 21:38:17 +0200 Subject: player: make various commands for managing external tracks abortable Until now, they could be aborted only by ending playback, and calling mpv_abort_async_command didn't do anything. This requires furthering the mess how playback abort is done. The main reason why mp_cancel exists at all is to avoid that a "frozen" demuxer (blocked on network I/O or whatever) cannot freeze the core. The core should always get its way. Previously, there was a single mp_cancel handle, that could be signaled, and all demuxers would unfreeze. With external files, we might want to abort loading of a certain external file, which automatically means they need a separate mp_cancel. So give every demuxer its own mp_cancel, and "slave" it to whatever parent mp_cancel handles aborting. Since the mpv demuxer API conflates creating the demuxer and reading the file headers, mp_cancel strictly need to be created before the demuxer is created (or we couldn't abort loading). Although we give every demuxer its own mp_cancel (as "enforced" by cancel_and_free_demuxer), it's still rather messy to create/destroy it along with the demuxer. --- input/cmd.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'input') diff --git a/input/cmd.h b/input/cmd.h index 0f74424f87..a2cbaae510 100644 --- a/input/cmd.h +++ b/input/cmd.h @@ -58,6 +58,9 @@ struct mp_cmd_def { // asynchronous abort of the command, and explicitly uses mp_cmd_ctx.abort. // (Not setting it when it's not needed can save resources.) bool can_abort; + // If playback ends, and the command is still running, an abort is + // automatically triggered. + bool abort_on_playback_end; }; enum mp_cmd_flags { -- cgit v1.2.3