mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Ladybird: Do not require Qt6 Multimedia if PulseAudio is available
If PulseAudio is available, the Qt6 audio plugin will never be used. So let's remove it from the build. Note that on macOS, the Qt6 audio plugin will be used if the Qt chrome is enabled. Otherwise, Audio Unit will be used for the AppKit chrome.
This commit is contained in:
parent
b98864e022
commit
bbdd624d50
Notes:
sideshowbarker
2024-07-17 03:19:14 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/bbdd624d50 Pull-request: https://github.com/SerenityOS/serenity/pull/21750
4 changed files with 23 additions and 8 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
Qt6 development packages and a C++20 capable compiler are required. g++-12 or clang-15 are required at a minimum for c++20 support.
|
||||
|
||||
NOTE: In all of the below lists of packages, the Qt6 multimedia package is not needed if your Linux system supports PulseAudio.
|
||||
|
||||
On Debian/Ubuntu required packages include, but are not limited to:
|
||||
|
||||
```
|
||||
|
|
|
@ -95,7 +95,7 @@ if (ENABLE_QT)
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Network Multimedia)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Network)
|
||||
elseif (APPLE)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
endif()
|
||||
|
|
|
@ -16,8 +16,6 @@ set(WEBCONTENT_SOURCES
|
|||
if (ENABLE_QT)
|
||||
qt_add_executable(WebContent ${WEBCONTENT_SOURCES})
|
||||
target_sources(WebContent PRIVATE
|
||||
../Qt/AudioCodecPluginQt.cpp
|
||||
../Qt/AudioThread.cpp
|
||||
../Qt/EventLoopImplementationQt.cpp
|
||||
../Qt/EventLoopImplementationQtEventTarget.cpp
|
||||
../Qt/RequestManagerQt.cpp
|
||||
|
@ -27,8 +25,20 @@ if (ENABLE_QT)
|
|||
../Qt/WebSocketImplQt.cpp
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(WebContent PRIVATE Qt::Core Qt::Network Qt::Multimedia)
|
||||
target_link_libraries(WebContent PRIVATE Qt::Core Qt::Network)
|
||||
target_compile_definitions(WebContent PRIVATE HAVE_QT=1)
|
||||
|
||||
if (NOT HAVE_PULSEAUDIO)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
|
||||
|
||||
target_sources(WebContent PRIVATE
|
||||
../Qt/AudioCodecPluginQt.cpp
|
||||
../Qt/AudioThread.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(WebContent PRIVATE Qt::Multimedia)
|
||||
target_compile_definitions(WebContent PRIVATE HAVE_QT_MULTIMEDIA=1)
|
||||
endif()
|
||||
else()
|
||||
set(LIB_TYPE STATIC)
|
||||
if (ANDROID)
|
||||
|
|
|
@ -34,11 +34,14 @@
|
|||
#include <WebContent/WebDriverConnection.h>
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
# include <Ladybird/Qt/AudioCodecPluginQt.h>
|
||||
# include <Ladybird/Qt/EventLoopImplementationQt.h>
|
||||
# include <Ladybird/Qt/RequestManagerQt.h>
|
||||
# include <Ladybird/Qt/WebSocketClientManagerQt.h>
|
||||
# include <QCoreApplication>
|
||||
|
||||
# if defined(HAVE_QT_MULTIMEDIA)
|
||||
# include <Ladybird/Qt/AudioCodecPluginQt.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static ErrorOr<void> load_content_filters();
|
||||
|
@ -60,10 +63,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPlugin);
|
||||
|
||||
Web::Platform::AudioCodecPlugin::install_creation_hook([](auto loader) {
|
||||
#if defined(AK_OS_MACOS) || defined(HAVE_PULSEAUDIO)
|
||||
return Web::Platform::AudioCodecPluginAgnostic::create(move(loader));
|
||||
#elif defined(HAVE_QT)
|
||||
#if defined(HAVE_QT_MULTIMEDIA)
|
||||
return Ladybird::AudioCodecPluginQt::create(move(loader));
|
||||
#elif defined(AK_OS_MACOS) || defined(HAVE_PULSEAUDIO)
|
||||
return Web::Platform::AudioCodecPluginAgnostic::create(move(loader));
|
||||
#else
|
||||
(void)loader;
|
||||
return Error::from_string_literal("Don't know how to initialize audio in this configuration!");
|
||||
|
|
Loading…
Reference in a new issue