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:
Wim Taymans
2024-05-07 18:26:00 +02:00
committed by Sam Lantinga
parent 890ceb4ac4
commit a340748c06
5 changed files with 1190 additions and 0 deletions

View File

@@ -139,13 +139,16 @@ macro(CheckPipewire)
if(PC_PIPEWIRE_FOUND)
set(HAVE_PIPEWIRE TRUE)
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_CAMERA_DRIVER_PIPEWIRE 1)
if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
message(WARNING "You must have SDL_LoadObject() support for dynamic PipeWire loading")
endif()
FindLibraryAndSONAME("pipewire-0.3" LIBDIRS ${PC_PIPEWIRE_LIBRARY_DIRS})
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_CAMERA_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
set(HAVE_PIPEWIRE_SHARED TRUE)
sdl_link_dependency(pipewire INCLUDES $<TARGET_PROPERTY:PkgConfig::PC_PIPEWIRE,INTERFACE_INCLUDE_DIRECTORIES>)
else()