mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-02 16:08:30 +00:00
camera: add PipeWire camera support
The PipeWire camera will enumerate the pipewire Video/Source nodes with their formats. When capturing is started, a stream to the node will be created and frames will be captured.
This commit is contained in:

committed by
Sam Lantinga

parent
890ceb4ac4
commit
a340748c06
@@ -139,13 +139,16 @@ macro(CheckPipewire)
|
|||||||
if(PC_PIPEWIRE_FOUND)
|
if(PC_PIPEWIRE_FOUND)
|
||||||
set(HAVE_PIPEWIRE TRUE)
|
set(HAVE_PIPEWIRE TRUE)
|
||||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/pipewire/*.c")
|
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/pipewire/*.c")
|
||||||
|
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/camera/pipewire/*.c")
|
||||||
set(SDL_AUDIO_DRIVER_PIPEWIRE 1)
|
set(SDL_AUDIO_DRIVER_PIPEWIRE 1)
|
||||||
|
set(SDL_CAMERA_DRIVER_PIPEWIRE 1)
|
||||||
if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
|
if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||||
message(WARNING "You must have SDL_LoadObject() support for dynamic PipeWire loading")
|
message(WARNING "You must have SDL_LoadObject() support for dynamic PipeWire loading")
|
||||||
endif()
|
endif()
|
||||||
FindLibraryAndSONAME("pipewire-0.3" LIBDIRS ${PC_PIPEWIRE_LIBRARY_DIRS})
|
FindLibraryAndSONAME("pipewire-0.3" LIBDIRS ${PC_PIPEWIRE_LIBRARY_DIRS})
|
||||||
if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO)
|
if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO)
|
||||||
set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
|
set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
|
||||||
|
set(SDL_CAMERA_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
|
||||||
set(HAVE_PIPEWIRE_SHARED TRUE)
|
set(HAVE_PIPEWIRE_SHARED TRUE)
|
||||||
sdl_link_dependency(pipewire INCLUDES $<TARGET_PROPERTY:PkgConfig::PC_PIPEWIRE,INTERFACE_INCLUDE_DIRECTORIES>)
|
sdl_link_dependency(pipewire INCLUDES $<TARGET_PROPERTY:PkgConfig::PC_PIPEWIRE,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
else()
|
else()
|
||||||
|
@@ -485,6 +485,8 @@
|
|||||||
#cmakedefine SDL_CAMERA_DRIVER_ANDROID @SDL_CAMERA_DRIVER_ANDROID@
|
#cmakedefine SDL_CAMERA_DRIVER_ANDROID @SDL_CAMERA_DRIVER_ANDROID@
|
||||||
#cmakedefine SDL_CAMERA_DRIVER_EMSCRIPTEN @SDL_CAMERA_DRIVER_EMSCRIPTEN@
|
#cmakedefine SDL_CAMERA_DRIVER_EMSCRIPTEN @SDL_CAMERA_DRIVER_EMSCRIPTEN@
|
||||||
#cmakedefine SDL_CAMERA_DRIVER_MEDIAFOUNDATION @SDL_CAMERA_DRIVER_MEDIAFOUNDATION@
|
#cmakedefine SDL_CAMERA_DRIVER_MEDIAFOUNDATION @SDL_CAMERA_DRIVER_MEDIAFOUNDATION@
|
||||||
|
#cmakedefine SDL_CAMERA_DRIVER_PIPEWIRE @SDL_CAMERA_DRIVER_PIPEWIRE@
|
||||||
|
#cmakedefine SDL_CAMERA_DRIVER_PIPEWIRE_DYNAMIC @SDL_CAMERA_DRIVER_PIPEWIRE_DYNAMIC@
|
||||||
|
|
||||||
/* Enable misc subsystem */
|
/* Enable misc subsystem */
|
||||||
#cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@
|
#cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@
|
||||||
|
@@ -34,6 +34,9 @@ static const CameraBootStrap *const bootstrap[] = {
|
|||||||
#ifdef SDL_CAMERA_DRIVER_V4L2
|
#ifdef SDL_CAMERA_DRIVER_V4L2
|
||||||
&V4L2_bootstrap,
|
&V4L2_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SDL_CAMERA_DRIVER_PIPEWIRE
|
||||||
|
&PIPEWIRECAMERA_bootstrap,
|
||||||
|
#endif
|
||||||
#ifdef SDL_CAMERA_DRIVER_COREMEDIA
|
#ifdef SDL_CAMERA_DRIVER_COREMEDIA
|
||||||
&COREMEDIA_bootstrap,
|
&COREMEDIA_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
@@ -205,6 +205,7 @@ typedef struct CameraBootStrap
|
|||||||
// Not all of these are available in a given build. Use #ifdefs, etc.
|
// Not all of these are available in a given build. Use #ifdefs, etc.
|
||||||
extern CameraBootStrap DUMMYCAMERA_bootstrap;
|
extern CameraBootStrap DUMMYCAMERA_bootstrap;
|
||||||
extern CameraBootStrap V4L2_bootstrap;
|
extern CameraBootStrap V4L2_bootstrap;
|
||||||
|
extern CameraBootStrap PIPEWIRECAMERA_bootstrap;
|
||||||
extern CameraBootStrap COREMEDIA_bootstrap;
|
extern CameraBootStrap COREMEDIA_bootstrap;
|
||||||
extern CameraBootStrap ANDROIDCAMERA_bootstrap;
|
extern CameraBootStrap ANDROIDCAMERA_bootstrap;
|
||||||
extern CameraBootStrap EMSCRIPTENCAMERA_bootstrap;
|
extern CameraBootStrap EMSCRIPTENCAMERA_bootstrap;
|
||||||
|
1181
src/camera/pipewire/SDL_camera_pipewire.c
Normal file
1181
src/camera/pipewire/SDL_camera_pipewire.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user