1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +00:00
mpv/input
wm4 2e91d44e20 stream: redo playback abort handling
This mechanism originates from MPlayer's way of dealing with blocking
network, but it's still useful. On opening and closing, mpv waits for
network synchronously, and also some obscure commands and use-cases can
lead to such blocking. In these situations, the stream is asynchronously
forced to stop by "interrupting" it.

The old design interrupting I/O was a bit broken: polling with a
callback, instead of actively interrupting it. Change the direction of
this. There is no callback anymore, and the player calls
mp_cancel_trigger() to force the stream to return.

libavformat (via stream_lavf.c) has the old broken design, and fixing it
would require fixing libavformat, which won't happen so quickly. So we
have to keep that part. But everything above the stream layer is
prepared for a better design, and more sophisticated methods than
mp_cancel_test() could be easily introduced.

There's still one problem: commands are still run in the central
playback loop, which we assume can block on I/O in the worst case.
That's not a problem yet, because we simply mark some commands as being
able to stop playback of the current file ("quit" etc.), so input.c
could abort playback as soon as such a command is queued. But there are
also commands abort playback only conditionally, and the logic for that
is in the playback core and thus "unreachable". For example,
"playlist_next" aborts playback only if there's a next file. We don't
want it to always abort playback.

As a quite ugly hack, abort playback only if at least 2 abort commands
are queued - this pretty much happens only if the core is frozen and
doesn't react to input.
2014-09-13 16:09:51 +02:00
..
cmd_list.c input: "quit_watch_later" and "stop" are abort commands 2014-09-13 14:10:10 +02:00
cmd_list.h command: redo ancient TV/DVB/PVR commands 2014-06-11 00:34:41 +02:00
cmd_parse.c input: fix use after free with legacy commands 2014-09-08 15:13:11 +02:00
cmd_parse.h input: split off some code from input.c to separate files 2013-12-26 17:13:25 +01:00
event.c input: change mp_input_run_cmd signature 2014-01-04 19:42:16 +01:00
event.h Move compat/ and bstr/ directory contents somewhere else 2014-08-29 12:31:52 +02:00
input.c stream: redo playback abort handling 2014-09-13 16:09:51 +02:00
input.h stream: redo playback abort handling 2014-09-13 16:09:51 +02:00
joystick.c input: remove useless joystick.h/lirc.h include files 2014-09-10 00:51:36 +02:00
keycodes.c Move compat/ and bstr/ directory contents somewhere else 2014-08-29 12:31:52 +02:00
keycodes.h input: make key bindings like "Shift+X" work (for ASCII) 2014-08-26 20:39:28 +02:00
lirc.c input: remove central select() call 2014-09-10 03:24:45 +02:00
pipe.c Move compat/ and bstr/ directory contents somewhere else 2014-08-29 12:31:52 +02:00