mpv/input
wm4 c184e290b0 sdl: prevent concurrent use of SDL in different threads
sdl_gamepad.c and vo_sdl.c both have their own event loops and run in
separate threads. They don't know of each other (and shouldn't). Since
SDL only has one global event loop (why didn't they fix this in SDL2?),
these obviously clash. The actual behavior is relatively subtle, which
event being randomly dispatched to either of the threads.

This is very regrettable. Very.

Work this around. "Fortunately" SDL exposes its global state to some
degree. SDL_WasInit() returns whether a "subsystem" was initialized, and
you could say the one who initialized it owns it. Both SDL_INIT_VIDEO
and SDL_INIT_GAMECONTROLLER implicitly enable SDL_INIT_EVENTS, and the
event loop is indeed the resource that cannot be shared.

Unfortunately, this is still racy, since SDL_InitSubSystem is a second
call, and succeeds if the subsystem is already initialized (increases a
refcount I think). But good enough. Blame SDL for everything.

(I think I made this commit message too long. Nobody cares even.)

Fixes: #7085
2019-10-25 22:17:54 +02:00
..
cmd.c input: remove now unused "abort command" and cancel infrastructure 2018-05-24 19:56:35 +02:00
cmd.h cmd: do not use a random value for MP_CMD_OPT_ARG 2018-05-25 11:13:44 +02:00
event.c input: ignore empty lines on drag-drop mime data 2019-09-21 15:39:47 +02:00
event.h input/event.h: add include guard 2016-03-15 22:44:15 +01:00
input.c input: disable gamepad code by default 2019-10-25 21:54:35 +02:00
input.h input: add gamepad support through SDL2 2019-10-23 09:40:30 +02:00
ipc-dummy.c build: change how some OS specific source files are selected 2017-06-29 10:30:16 +02:00
ipc-unix.c Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into wm4-commits--merge-edition 2018-12-05 19:19:24 +01:00
ipc-win.c player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
ipc.c ipc: cosmetic: switch a negated if/else 2018-05-25 10:46:18 +02:00
keycodes.c input: add gamepad support through SDL2 2019-10-23 09:40:30 +02:00
keycodes.h input: add gamepad support through SDL2 2019-10-23 09:40:30 +02:00
pipe-win32.c osdep: rename atomics.h to atomic.h 2016-09-07 11:26:25 +02:00
sdl_gamepad.c sdl: prevent concurrent use of SDL in different threads 2019-10-25 22:17:54 +02:00