summaryrefslogtreecommitdiffstats
path: root/input/sdl_gamepad.c
diff options
context:
space:
mode:
Diffstat (limited to 'input/sdl_gamepad.c')
-rw-r--r--input/sdl_gamepad.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/input/sdl_gamepad.c b/input/sdl_gamepad.c
index 96b8409b49..7045239fda 100644
--- a/input/sdl_gamepad.c
+++ b/input/sdl_gamepad.c
@@ -198,11 +198,17 @@ static void remove_gamepad(struct mp_input_src *src, int id)
static void read_gamepad_thread(struct mp_input_src *src, void *param)
{
+ if (SDL_WasInit(SDL_INIT_EVENTS)) {
+ MP_ERR(src, "Another component is using SDL already.\n");
+ mp_input_src_init_done(src);
+ return;
+ }
+
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)) {
MP_ERR(src, "SDL_Init failed\n");
mp_input_src_init_done(src);
return;
- };
+ }
pthread_once(&events_initialized, initialize_events);