mpv/player
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
..
lua osc: Use osd-font for playlist buttons 2014-08-22 23:50:50 +02:00
timeline Move compat/ and bstr/ directory contents somewhere else 2014-08-29 12:31:52 +02:00
audio.c audio: fix initial sync with huge AO buffer 2014-09-06 13:33:29 +02:00
client.c lua: synchronously wait until scripts are loaded 2014-09-06 17:02:47 +02:00
client.h lua: synchronously wait until scripts are loaded 2014-09-06 17:02:47 +02:00
command.c video: rename VOCTRL_GET_WINDOW_SIZE 2014-09-05 01:52:16 +02:00
command.h
configfiles.c player: check for null in resume config search 2014-09-05 17:51:45 +02:00
core.h stream: redo playback abort handling 2014-09-13 16:09:51 +02:00
discnav.c video: get rid of video_next_pts field 2014-08-22 14:22:06 +02:00
loadfile.c stream: redo playback abort handling 2014-09-13 16:09:51 +02:00
lua.c lua: expose mp_getcwd through mp.utils 2014-08-31 00:58:27 +02:00
main.c stream: redo playback abort handling 2014-09-13 16:09:51 +02:00
main_fn.c cocoa: fix build by using the correct HAVE_* macro 2014-08-06 09:31:59 +02:00
misc.c player: some more input refactoring 2014-09-07 20:44:54 +02:00
osd.c player: better cache status on status line 2014-08-27 23:12:47 +02:00
playloop.c player: fix idle mode event handling 2014-09-13 01:14:07 +02:00
screenshot.c Move compat/ and bstr/ directory contents somewhere else 2014-08-29 12:31:52 +02:00
screenshot.h
scripting.c lua: synchronously wait until scripts are loaded 2014-09-06 17:02:47 +02:00
sub.c sub: fix possible deadlock with --no-sub-ass and similar 2014-09-06 00:16:15 +02:00
video.c video: initial Matroska 3D support 2014-08-30 23:24:46 +02:00