summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--input/sdl_gamepad.c8
-rw-r--r--video/out/vo_sdl.c4
2 files changed, 9 insertions, 3 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);
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index bd7e024585..9d21a87118 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -769,8 +769,8 @@ static int preinit(struct vo *vo)
{
struct priv *vc = vo->priv;
- if (SDL_WasInit(SDL_INIT_VIDEO)) {
- MP_ERR(vo, "already initialized\n");
+ if (SDL_WasInit(SDL_INIT_EVENTS)) {
+ MP_ERR(vo, "Another component is using SDL already.\n");
return -1;
}