From e50db698e2a581fef8ccea3d72e895198d79f1b8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 22 Feb 2025 09:48:25 -0800 Subject: [PATCH] Disable all camera drivers if SDL_CAMERA_DISABLED is defined Fixes https://github.com/libsdl-org/SDL/issues/12182 --- src/SDL_internal.h | 11 +++++++++++ src/camera/SDL_camera.c | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/SDL_internal.h b/src/SDL_internal.h index bcd99a6745..a345252f3a 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -203,6 +203,17 @@ #define SDL_HAVE_YUV 1 #endif +#ifdef SDL_CAMERA_DISABLED +#undef SDL_CAMERA_DRIVER_ANDROID +#undef SDL_CAMERA_DRIVER_COREMEDIA +#undef SDL_CAMERA_DRIVER_DUMMY +#undef SDL_CAMERA_DRIVER_EMSCRIPTEN +#undef SDL_CAMERA_DRIVER_MEDIAFOUNDATION +#undef SDL_CAMERA_DRIVER_PIPEWIRE +#undef SDL_CAMERA_DRIVER_V4L2 +#undef SDL_CAMERA_DRIVER_VITA +#endif + #ifdef SDL_RENDER_DISABLED #undef SDL_VIDEO_RENDER_SW #undef SDL_VIDEO_RENDER_D3D diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index 0640ea968a..bc723c70ed 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -32,7 +32,6 @@ // Available camera drivers static const CameraBootStrap *const bootstrap[] = { -#ifndef SDL_CAMERA_DISABLED #ifdef SDL_CAMERA_DRIVER_V4L2 &V4L2_bootstrap, #endif @@ -56,7 +55,6 @@ static const CameraBootStrap *const bootstrap[] = { #endif #ifdef SDL_CAMERA_DRIVER_DUMMY &DUMMYCAMERA_bootstrap, -#endif #endif NULL };