1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

Meta: Consolidate checking for the system audio backend

The goal here is to ensure we check for audio backends in a way that
makes sense. On macOS, let's just always use Audio Unit (and thus avoid
any checks for Pulse, to reduce needless/confusing build log noise). We
will also only use the Qt audio backend if no other backend was found,
rather than only checking for Pulse.
This commit is contained in:
Timothy Flynn 2024-12-23 13:37:52 -05:00 committed by Andreas Kling
parent 33a1e38646
commit 79a2b96d1c
Notes: github-actions[bot] 2024-12-25 11:01:34 +00:00
5 changed files with 35 additions and 19 deletions

View file

@ -1,6 +1,7 @@
include(audio)
if (NOT ANDROID AND NOT WIN32)
include(ffmpeg)
include(pulseaudio)
endif()
set(SOURCES
@ -30,23 +31,20 @@ else()
target_sources(LibMedia PRIVATE FFmpeg/FFmpegVideoDecoderStub.cpp)
endif()
# Audio backend -- how we output audio to the speakers
if (HAVE_PULSEAUDIO)
if (LADYBIRD_AUDIO_BACKEND STREQUAL "PULSE")
target_sources(LibMedia PRIVATE
Audio/PlaybackStreamPulseAudio.cpp
Audio/PulseAudioWrappers.cpp
)
target_link_libraries(LibMedia PRIVATE PkgConfig::PULSEAUDIO)
target_compile_definitions(LibMedia PUBLIC HAVE_PULSEAUDIO=1)
elseif (APPLE AND NOT IOS)
elseif (LADYBIRD_AUDIO_BACKEND STREQUAL "AUDIO_UNIT")
target_sources(LibMedia PRIVATE Audio/PlaybackStreamAudioUnit.cpp)
find_library(AUDIO_UNIT AudioUnit REQUIRED)
target_link_libraries(LibMedia PRIVATE ${AUDIO_UNIT})
elseif (ANDROID)
elseif (LADYBIRD_AUDIO_BACKEND STREQUAL "OBOE")
target_sources(LibMedia PRIVATE Audio/PlaybackStreamOboe.cpp)
find_package(oboe REQUIRED CONFIG)
target_link_libraries(LibMedia PRIVATE log oboe::oboe)
else()
message(WARNING "No audio backend available")
elseif (DEFINED LADYBIRD_AUDIO_BACKEND)
message(FATAL_ERROR "Please update ${CMAKE_CURRENT_LIST_FILE} for audio backend ${LADYBIRD_AUDIO_BACKEND}")
endif()