LibMedia: Absorb LibAudio

LibMedia will be responsible for both audio and video decoding.
This commit is contained in:
Jelle Raaijmakers 2024-08-28 12:08:38 +02:00 committed by Andreas Kling
parent 8b3bcf9c0f
commit 85fd2e281b
Notes: github-actions[bot] 2024-09-12 08:02:40 +00:00
101 changed files with 195 additions and 211 deletions

View file

@ -69,7 +69,7 @@ Nobody is perfect, and sometimes we mess things up. That said, here are some goo
* Make sure your commits are rebased on the master branch.
* Wrap your commit messages at 72 characters.
* The first line of the commit message is the subject line, and must have the format "Category: Brief description of what's being changed". The category should be the name of a library, application, service, utility, etc.
* Examples: `LibAudio`, `WebContent`, `CI`, `AK`, `RequestServer`, `js`
* Examples: `LibMedia`, `WebContent`, `CI`, `AK`, `RequestServer`, `js`
* Don't use a category like "`Userland`" or "`Utilities`", except for generic changes that affect a large portion of code within these directories.
* Don't use specific component names, e.g. C++ class names, as the category either - mention them in the summary instead. E.g. `LibGUI: Brief description of what's being changed in FooWidget` rather than `FooWidget: Brief description of what's being changed`
* Several categories may be combined with `+`, e.g. `LibJS+LibWeb+Browser: ...`

View file

@ -11,7 +11,6 @@
#include <Ladybird/HelperProcess.h>
#include <Ladybird/ImageCodecPlugin.h>
#include <Ladybird/Utilities.h>
#include <LibAudio/Loader.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
@ -19,6 +18,7 @@
#include <LibIPC/ConnectionFromClient.h>
#include <LibImageDecoderClient/Client.h>
#include <LibJS/Bytecode/Interpreter.h>
#include <LibMedia/Audio/Loader.h>
#include <LibRequests/RequestClient.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/HTML/Window.h>

View file

@ -6,7 +6,7 @@
#include "AudioCodecPluginQt.h"
#include "AudioThread.h"
#include <LibAudio/Loader.h>
#include <LibMedia/Audio/Loader.h>
namespace Ladybird {

View file

@ -9,7 +9,7 @@
#include <AK/Error.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <LibAudio/Forward.h>
#include <LibMedia/Audio/Forward.h>
#include <LibWeb/Platform/AudioCodecPlugin.h>
#include <QObject>

View file

@ -11,9 +11,9 @@
#include <AK/MemoryStream.h>
#include <AK/Optional.h>
#include <AK/Types.h>
#include <LibAudio/Loader.h>
#include <LibAudio/Sample.h>
#include <LibCore/SharedCircularQueue.h>
#include <LibMedia/Audio/Loader.h>
#include <LibMedia/Audio/Sample.h>
#include <QAudioFormat>
#include <QAudioSink>
#include <QByteArray>

View file

@ -34,7 +34,7 @@ target_include_directories(webcontent PUBLIC $<BUILD_INTERFACE:${LADYBIRD_SOURCE
target_include_directories(webcontent PUBLIC $<BUILD_INTERFACE:${LADYBIRD_SOURCE_DIR}/Userland/>)
target_include_directories(webcontent PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>)
target_link_libraries(webcontent PUBLIC LibAudio LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket LibRequests LibWebView LibImageDecoderClient)
target_link_libraries(webcontent PUBLIC LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibMedia LibWeb LibWebSocket LibRequests LibWebView LibImageDecoderClient)
if (HAVE_PULSEAUDIO)
target_compile_definitions(webcontent PUBLIC HAVE_PULSEAUDIO=1)

View file

@ -8,7 +8,6 @@
#include <Ladybird/FontPlugin.h>
#include <Ladybird/ImageCodecPlugin.h>
#include <Ladybird/Utilities.h>
#include <LibAudio/Loader.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
@ -19,6 +18,7 @@
#include <LibIPC/ConnectionFromClient.h>
#include <LibJS/Bytecode/Interpreter.h>
#include <LibMain/Main.h>
#include <LibMedia/Audio/Loader.h>
#include <LibRequests/RequestClient.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/HTML/Window.h>

View file

@ -8,7 +8,7 @@ if(INCLUDE_FLAC_SPEC_TESTS)
endif()
set(FLAC_SPEC_TEST_GZ_URL https://github.com/ietf-wg-cellar/flac-test-files/archive/refs/heads/main.tar.gz)
set(FLAC_TEST_PATH ${CMAKE_BINARY_DIR}/Tests/LibAudio/FLAC CACHE PATH "Location of FLAC tests")
set(FLAC_TEST_PATH ${CMAKE_BINARY_DIR}/Tests/LibMedia/FLAC CACHE PATH "Location of FLAC tests")
set(FLAC_SPEC_TEST_GZ_PATH ${FLAC_TEST_PATH}/flac-spec-testsuite.tar.gz)
set(FLAC_SPEC_TEST_PATH ${FLAC_TEST_PATH}/SpecTests)

View file

@ -382,7 +382,6 @@ endif()
# Lagom Libraries
set(lagom_standard_libraries
Archive
Audio
Compress
Crypto
Diff
@ -449,8 +448,8 @@ if (ENABLE_FUZZERS OR ENABLE_COMPILER_EXPLORER_BUILD OR ANDROID OR IOS)
endif()
# Lagom Utilities
lagom_utility(abench SOURCES ../../Userland/Utilities/abench.cpp LIBS LibMain LibFileSystem LibAudio)
lagom_utility(aconv SOURCES ../../Userland/Utilities/aconv.cpp LIBS LibMain LibFileSystem LibAudio)
lagom_utility(abench SOURCES ../../Userland/Utilities/abench.cpp LIBS LibMain LibFileSystem LibMedia)
lagom_utility(aconv SOURCES ../../Userland/Utilities/aconv.cpp LIBS LibMain LibFileSystem LibMedia)
if (ENABLE_GUI_TARGETS)
lagom_utility(animation SOURCES ../../Userland/Utilities/animation.cpp LIBS LibGfx LibMain)
@ -540,14 +539,6 @@ if (BUILD_TESTING)
lagom_test(../../Tests/LibTLS/TestTLSHandshake.cpp LibTLS LIBS LibTLS LibCrypto)
lagom_test(../../Tests/LibTLS/TestTLSCertificateParser.cpp LibTLS LIBS LibTLS LibCrypto)
# The FLAC tests need a special working directory to find the test files
lagom_test(../../Tests/LibAudio/TestFLACSpec.cpp LIBS LibAudio WORKING_DIRECTORY "${FLAC_TEST_PATH}/..")
lagom_test(../../Tests/LibAudio/TestPlaybackStream.cpp LIBS LibAudio)
if (HAVE_PULSEAUDIO)
target_compile_definitions(TestPlaybackStream PRIVATE HAVE_PULSEAUDIO=1)
endif()
# LibCore
lagom_test(../../Tests/LibCore/TestLibCoreArgsParser.cpp)

View file

@ -10,7 +10,7 @@
#include <AK/Concepts.h>
#include <AK/MemoryStream.h>
#include <LibAudio/Loader.h>
#include <LibMedia/Audio/Loader.h>
#include <stddef.h>
#include <stdint.h>

View file

@ -5,7 +5,7 @@
*/
#include "AudioFuzzerCommon.h"
#include <LibAudio/FlacLoader.h>
#include <LibMedia/Audio/FlacLoader.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{

View file

@ -5,7 +5,7 @@
*/
#include "AudioFuzzerCommon.h"
#include <LibAudio/MP3Loader.h>
#include <LibMedia/Audio/MP3Loader.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{

View file

@ -5,7 +5,7 @@
*/
#include "AudioFuzzerCommon.h"
#include <LibAudio/QOALoader.h>
#include <LibMedia/Audio/QOALoader.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{

View file

@ -5,7 +5,7 @@
*/
#include "AudioFuzzerCommon.h"
#include <LibAudio/WavLoader.h>
#include <LibMedia/Audio/WavLoader.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{

View file

@ -60,7 +60,7 @@ set(FUZZER_DEPENDENCIES_CSSParser LibWeb)
set(FUZZER_DEPENDENCIES_DeflateCompression LibCompress)
set(FUZZER_DEPENDENCIES_DeflateDecompression LibCompress)
set(FUZZER_DEPENDENCIES_ELF LibELF)
set(FUZZER_DEPENDENCIES_FlacLoader LibAudio)
set(FUZZER_DEPENDENCIES_FlacLoader LibMedia)
set(FUZZER_DEPENDENCIES_GIFLoader LibGfx)
set(FUZZER_DEPENDENCIES_GzipDecompression LibCompress)
set(FUZZER_DEPENDENCIES_GzipRoundtrip LibCompress)
@ -73,11 +73,11 @@ set(FUZZER_DEPENDENCIES_LzmaDecompression LibArchive LibCompress)
set(FUZZER_DEPENDENCIES_LzmaRoundtrip LibCompress)
set(FUZZER_DEPENDENCIES_MatroskaReader LibMedia)
set(FUZZER_DEPENDENCIES_MD5 LibCrypto)
set(FUZZER_DEPENDENCIES_MP3Loader LibAudio)
set(FUZZER_DEPENDENCIES_MP3Loader LibMedia)
set(FUZZER_DEPENDENCIES_PEM LibCrypto)
set(FUZZER_DEPENDENCIES_PNGLoader LibGfx)
set(FUZZER_DEPENDENCIES_Poly1305 LibCrypto)
set(FUZZER_DEPENDENCIES_QOALoader LibAudio)
set(FUZZER_DEPENDENCIES_QOALoader LibMedia)
set(FUZZER_DEPENDENCIES_RegexECMA262 LibRegex)
set(FUZZER_DEPENDENCIES_RegexPosixBasic LibRegex)
set(FUZZER_DEPENDENCIES_RegexPosixExtended LibRegex)
@ -93,7 +93,7 @@ set(FUZZER_DEPENDENCIES_TTF LibGfx)
set(FUZZER_DEPENDENCIES_TinyVGLoader LibGfx)
set(FUZZER_DEPENDENCIES_URL LibURL)
set(FUZZER_DEPENDENCIES_WasmParser LibWasm)
set(FUZZER_DEPENDENCIES_WAVLoader LibAudio)
set(FUZZER_DEPENDENCIES_WAVLoader LibMedia)
set(FUZZER_DEPENDENCIES_WebPLoader LibGfx)
set(FUZZER_DEPENDENCIES_WOFF LibGfx)
set(FUZZER_DEPENDENCIES_WOFF2 LibGfx)

View file

@ -1,4 +1,4 @@
declare_args() {
# Select whether to build with PulseAudio support in LibAudio
# Select whether to build with PulseAudio support in LibMedia
enable_pulseaudio = current_os == "linux"
}

View file

@ -384,7 +384,6 @@ if (current_os != "mac") {
bundle_data("ladybird_bundle_libs") {
public_deps = [
"//AK",
"//Userland/Libraries/LibAudio",
"//Userland/Libraries/LibCompress",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibCrypto",
@ -397,6 +396,7 @@ if (current_os != "mac") {
"//Userland/Libraries/LibImageDecoderClient",
"//Userland/Libraries/LibJS",
"//Userland/Libraries/LibLine",
"//Userland/Libraries/LibMedia",
"//Userland/Libraries/LibProtocol",
"//Userland/Libraries/LibRIFF",
"//Userland/Libraries/LibRegex",
@ -414,7 +414,6 @@ if (current_os != "mac") {
]
sources = [
"$root_out_dir/lib/liblagom-ak.dylib",
"$root_out_dir/lib/liblagom-audio.dylib",
"$root_out_dir/lib/liblagom-compress.dylib",
"$root_out_dir/lib/liblagom-core-minimal.dylib",
"$root_out_dir/lib/liblagom-core.dylib",
@ -428,6 +427,7 @@ if (current_os != "mac") {
"$root_out_dir/lib/liblagom-ipc.dylib",
"$root_out_dir/lib/liblagom-js.dylib",
"$root_out_dir/lib/liblagom-line.dylib",
"$root_out_dir/lib/liblagom-media.dylib",
"$root_out_dir/lib/liblagom-protocol.dylib",
"$root_out_dir/lib/liblagom-regex.dylib",
"$root_out_dir/lib/liblagom-riff.dylib",

View file

@ -1,41 +0,0 @@
import("//Meta/gn/build/libs/pulse/enable.gni")
shared_library("LibAudio") {
include_dirs = [ "//Userland/Libraries" ]
sources = [
"FlacLoader.cpp",
"GenericTypes.cpp",
"Loader.cpp",
"MP3Loader.cpp",
"Metadata.cpp",
"PlaybackStream.cpp",
"QOALoader.cpp",
"QOATypes.cpp",
"SampleFormats.cpp",
"UserSampleQueue.cpp",
"VorbisComment.cpp",
"WavLoader.cpp",
"WavWriter.cpp",
]
if (enable_pulseaudio) {
sources += [
"PlaybackStreamPulseAudio.cpp",
"PulseAudioWrappers.cpp",
]
}
if (current_os == "mac") {
sources += [ "PlaybackStreamAudioUnit.cpp" ]
frameworks = [ "AudioUnit.framework" ]
}
deps = [
"//AK",
"//Meta/gn/build/libs/pulse",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibCrypto",
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibRIFF",
"//Userland/Libraries/LibThreading",
"//Userland/Libraries/LibUnicode",
]
output_name = "audio"
}

View file

@ -0,0 +1,40 @@
import("//Meta/gn/build/libs/pulse/enable.gni")
shared_library("LibMedia") {
include_dirs = [ "//Userland/Libraries" ]
sources = [
"Audio/FlacLoader.cpp",
"Audio/GenericTypes.cpp",
"Audio/Loader.cpp",
"Audio/MP3Loader.cpp",
"Audio/Metadata.cpp",
"Audio/PlaybackStream.cpp",
"Audio/QOALoader.cpp",
"Audio/QOATypes.cpp",
"Audio/SampleFormats.cpp",
"Audio/UserSampleQueue.cpp",
"Audio/VorbisComment.cpp",
"Audio/WavLoader.cpp",
"Audio/WavWriter.cpp",
]
if (enable_pulseaudio) {
sources += [
"Audio/PlaybackStreamPulseAudio.cpp",
"Audio/PulseAudioWrappers.cpp",
]
}
if (current_os == "mac") {
sources += [ "Audio/PlaybackStreamAudioUnit.cpp" ]
frameworks = [ "AudioUnit.framework" ]
}
deps = [
"//AK",
"//Meta/gn/build/libs/pulse",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibCrypto",
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibRIFF",
"//Userland/Libraries/LibThreading",
]
output_name = "media"
}

View file

@ -4,10 +4,10 @@ shared_library("LibVideo") {
deps = [
"//AK",
"//Userland/Libraries/LibAudio",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibGfx",
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibMedia",
"//Userland/Libraries/LibThreading",
]
sources = [

View file

@ -344,7 +344,6 @@ shared_library("LibWeb") {
"XLink",
"XML",
"//AK",
"//Userland/Libraries/LibAudio",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibCrypto",
"//Userland/Libraries/LibGfx",
@ -353,6 +352,7 @@ shared_library("LibWeb") {
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibJS",
"//Userland/Libraries/LibLocale",
"//Userland/Libraries/LibMedia",
"//Userland/Libraries/LibRegex",
"//Userland/Libraries/LibSyntax",
"//Userland/Libraries/LibTLS",

View file

@ -26,7 +26,7 @@ At the moment, many core library support components are inherited from SerenityO
- LibGfx: 2D Graphics Library, Image Decoding and Rendering
- LibArchive: Archive file format support
- LibUnicode: Unicode and locale support
- LibAudio, LibMedia: Audio and video playback
- LibMedia: Audio and video playback
- LibCore: Event loop, OS abstraction layer
- LibIPC: Inter-process communication

View file

@ -1,5 +1,4 @@
add_subdirectory(AK)
add_subdirectory(LibAudio)
add_subdirectory(LibCompress)
add_subdirectory(LibCore)
add_subdirectory(LibDiff)

View file

@ -1,9 +0,0 @@
set(TEST_SOURCES
TestWav.cpp
TestFLACSpec.cpp
TestPlaybackStream.cpp
)
foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibAudio LIBS LibAudio LibFileSystem)
endforeach()

View file

@ -1,9 +1,18 @@
set(TEST_SOURCES
TestH264Decode.cpp
TestParseMatroska.cpp
TestPlaybackStream.cpp
TestVP9Decode.cpp
TestWav.cpp
)
foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibMedia LIBS LibMedia)
lagom_test("${source}" LibMedia LIBS LibMedia LibFileSystem WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endforeach()
# The FLAC tests need a special working directory to find the test files
lagom_test(TestFLACSpec.cpp LIBS LibMedia WORKING_DIRECTORY "${FLAC_TEST_PATH}/..")
if (HAVE_PULSEAUDIO)
target_compile_definitions(TestPlaybackStream PRIVATE HAVE_PULSEAUDIO=1)
endif()

View file

@ -5,8 +5,8 @@
*/
#include <AK/LexicalPath.h>
#include <LibAudio/FlacLoader.h>
#include <LibCore/Directory.h>
#include <LibMedia/Audio/FlacLoader.h>
#include <LibTest/TestCase.h>
struct DiscoverFLACTestsHack {

View file

@ -7,13 +7,13 @@
#include <AK/Math.h>
#include <AK/MemoryStream.h>
#include <AK/WeakPtr.h>
#include <LibAudio/PlaybackStream.h>
#include <LibCore/EventLoop.h>
#include <LibMedia/Audio/PlaybackStream.h>
#include <LibTest/TestSuite.h>
#include <unistd.h>
#if defined(HAVE_PULSEAUDIO)
# include <LibAudio/PulseAudioWrappers.h>
# include <LibMedia/Audio/PulseAudioWrappers.h>
#endif
// FIXME: CI doesn't run an AudioServer currently. Creating one in /etc/SystemServer.ini does not

View file

@ -6,12 +6,12 @@
#include <AK/ByteString.h>
#include <AK/LexicalPath.h>
#include <LibAudio/WavLoader.h>
#include <LibAudio/WavWriter.h>
#include <LibCore/Directory.h>
#include <LibCore/File.h>
#include <LibFileSystem/FileSystem.h>
#include <LibFileSystem/TempFile.h>
#include <LibMedia/Audio/WavLoader.h>
#include <LibMedia/Audio/WavWriter.h>
#include <LibTest/TestCase.h>
static void compare_files(StringView const& in_path, StringView const& out_path)

View file

@ -1,44 +0,0 @@
set(SOURCES
GenericTypes.cpp
SampleFormats.cpp
Loader.cpp
WavLoader.cpp
FlacLoader.cpp
FlacWriter.cpp
WavWriter.cpp
Metadata.cpp
MP3Loader.cpp
PlaybackStream.cpp
QOALoader.cpp
QOATypes.cpp
UserSampleQueue.cpp
VorbisComment.cpp
)
if (HAVE_PULSEAUDIO)
list(APPEND SOURCES
PlaybackStreamPulseAudio.cpp
PulseAudioWrappers.cpp
)
endif()
serenity_lib(LibAudio audio)
target_link_libraries(LibAudio PRIVATE LibCore LibRIFF LibIPC LibThreading LibUnicode LibCrypto)
if (HAVE_PULSEAUDIO)
target_link_libraries(LibAudio PRIVATE pulse)
target_compile_definitions(LibAudio PRIVATE HAVE_PULSEAUDIO=1)
endif()
if (APPLE AND NOT IOS)
target_sources(LibAudio PRIVATE PlaybackStreamAudioUnit.cpp)
find_library(AUDIO_UNIT AudioUnit REQUIRED)
target_link_libraries(LibAudio PRIVATE ${AUDIO_UNIT})
endif()
if (ANDROID)
target_sources(LibAudio PRIVATE PlaybackStreamOboe.cpp)
find_package(oboe REQUIRED CONFIG)
target_link_libraries(LibAudio PRIVATE log oboe::oboe)
endif()

View file

@ -6,10 +6,10 @@
#pragma once
#include "Forward.h"
#include "Sample.h"
#include <AK/Error.h>
#include <AK/Span.h>
#include <LibAudio/Forward.h>
#include <LibAudio/Sample.h>
namespace Audio {

View file

@ -4,6 +4,13 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "FlacLoader.h"
#include "FlacTypes.h"
#include "GenericTypes.h"
#include "LoaderError.h"
#include "MultiChannel.h"
#include "Resampler.h"
#include "VorbisComment.h"
#include <AK/ByteString.h>
#include <AK/Debug.h>
#include <AK/DeprecatedFlyString.h>
@ -18,13 +25,6 @@
#include <AK/Try.h>
#include <AK/TypedTransfer.h>
#include <AK/UFixedBigInt.h>
#include <LibAudio/FlacLoader.h>
#include <LibAudio/FlacTypes.h>
#include <LibAudio/GenericTypes.h>
#include <LibAudio/LoaderError.h>
#include <LibAudio/MultiChannel.h>
#include <LibAudio/Resampler.h>
#include <LibAudio/VorbisComment.h>
#include <LibCore/File.h>
#include <LibCrypto/Checksum/ChecksumFunction.h>
#include <LibCrypto/Checksum/ChecksummingStream.h>

View file

@ -5,14 +5,14 @@
*/
#include "FlacWriter.h"
#include "Metadata.h"
#include "VorbisComment.h"
#include <AK/BitStream.h>
#include <AK/DisjointChunks.h>
#include <AK/Endian.h>
#include <AK/IntegralMath.h>
#include <AK/MemoryStream.h>
#include <AK/Statistics.h>
#include <LibAudio/Metadata.h>
#include <LibAudio/VorbisComment.h>
#include <LibCrypto/Checksum/ChecksummingStream.h>
namespace Audio {

View file

@ -6,17 +6,17 @@
#pragma once
#include "Encoder.h"
#include "FlacTypes.h"
#include "Forward.h"
#include "GenericTypes.h"
#include "Sample.h"
#include "SampleFormats.h"
#include <AK/MaybeOwned.h>
#include <AK/Noncopyable.h>
#include <AK/RefPtr.h>
#include <AK/Stream.h>
#include <AK/StringView.h>
#include <LibAudio/Encoder.h>
#include <LibAudio/FlacTypes.h>
#include <LibAudio/Forward.h>
#include <LibAudio/GenericTypes.h>
#include <LibAudio/Sample.h>
#include <LibAudio/SampleFormats.h>
#include <LibCore/Forward.h>
namespace Audio {

View file

@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "FlacLoader.h"
#include "Loader.h"
#include "MP3Loader.h"
#include "QOALoader.h"
#include "WavLoader.h"
#include <AK/TypedTransfer.h>
#include <LibAudio/FlacLoader.h>
#include <LibAudio/Loader.h>
#include <LibAudio/MP3Loader.h>
#include <LibAudio/QOALoader.h>
#include <LibAudio/WavLoader.h>
#include <LibCore/MappedFile.h>
namespace Audio {

View file

@ -6,6 +6,11 @@
#pragma once
#include "GenericTypes.h"
#include "LoaderError.h"
#include "Metadata.h"
#include "Sample.h"
#include "SampleFormats.h"
#include <AK/Error.h>
#include <AK/FixedArray.h>
#include <AK/NonnullOwnPtr.h>
@ -16,11 +21,6 @@
#include <AK/Stream.h>
#include <AK/StringView.h>
#include <AK/Try.h>
#include <LibAudio/GenericTypes.h>
#include <LibAudio/LoaderError.h>
#include <LibAudio/Metadata.h>
#include <LibAudio/Sample.h>
#include <LibAudio/SampleFormats.h>
namespace Audio {

View file

@ -7,10 +7,10 @@
#pragma once
#include "Loader.h"
#include "MDCT.h"
#include "MP3Types.h"
#include <AK/BitStream.h>
#include <AK/MemoryStream.h>
#include <LibAudio/MDCT.h>
namespace Audio {

View file

@ -45,7 +45,7 @@ void Metadata::replace_encoder_with_serenity()
// Unset the encoder field in this case; we definitely want to replace the existing encoder field.
if (version_or_error.is_error())
encoder = {};
auto encoder_string = String::formatted("SerenityOS LibAudio {}", version_or_error.release_value());
auto encoder_string = String::formatted("SerenityOS LibMedia {}", version_or_error.release_value());
if (encoder_string.is_error())
encoder = {};
encoder = encoder_string.release_value();

View file

@ -6,9 +6,9 @@
#pragma once
#include "Sample.h"
#include <AK/Concepts.h>
#include <AK/FixedArray.h>
#include <LibAudio/Sample.h>
namespace Audio {

View file

@ -10,11 +10,11 @@
#include <LibCore/ThreadedPromise.h>
#if defined(HAVE_PULSEAUDIO)
# include <LibAudio/PlaybackStreamPulseAudio.h>
# include "PlaybackStreamPulseAudio.h"
#elif defined(AK_OS_MACOS)
# include <LibAudio/PlaybackStreamAudioUnit.h>
# include "PlaybackStreamAudioUnit.h"
#elif defined(AK_OS_ANDROID)
# include <LibAudio/PlaybackStreamOboe.h>
# include "PlaybackStreamOboe.h"
#endif
namespace Audio {

View file

@ -6,11 +6,11 @@
#pragma once
#include "SampleFormats.h"
#include <AK/AtomicRefCounted.h>
#include <AK/Function.h>
#include <AK/Queue.h>
#include <AK/Time.h>
#include <LibAudio/SampleFormats.h>
#include <LibCore/Forward.h>
#include <LibThreading/ConditionVariable.h>
#include <LibThreading/MutexProtected.h>

View file

@ -5,9 +5,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "PlaybackStreamAudioUnit.h"
#include <AK/Atomic.h>
#include <AK/SourceLocation.h>
#include <LibAudio/PlaybackStreamAudioUnit.h>
#include <LibCore/SharedCircularQueue.h>
#include <LibCore/ThreadedPromise.h>

View file

@ -7,9 +7,9 @@
#pragma once
#include "PlaybackStream.h"
#include <AK/Error.h>
#include <AK/NonnullRefPtr.h>
#include <LibAudio/PlaybackStream.h>
namespace Audio {

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "PlaybackStreamOboe.h"
#include <AK/Atomic.h>
#include <AK/SourceLocation.h>
#include <LibAudio/PlaybackStreamOboe.h>
#include <LibCore/SharedCircularQueue.h>
#include <LibCore/ThreadedPromise.h>
#include <memory>

View file

@ -6,9 +6,9 @@
#pragma once
#include "PlaybackStream.h"
#include <AK/Error.h>
#include <AK/NonnullRefPtr.h>
#include <LibAudio/PlaybackStream.h>
namespace Audio {

View file

@ -6,8 +6,8 @@
#pragma once
#include <LibAudio/PlaybackStream.h>
#include <LibAudio/PulseAudioWrappers.h>
#include "PlaybackStream.h"
#include "PulseAudioWrappers.h"
namespace Audio {

View file

@ -6,13 +6,13 @@
#pragma once
#include "Forward.h"
#include "PlaybackStream.h"
#include "SampleFormats.h"
#include <AK/AtomicRefCounted.h>
#include <AK/Error.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Time.h>
#include <LibAudio/Forward.h>
#include <LibAudio/PlaybackStream.h>
#include <LibAudio/SampleFormats.h>
#include <LibThreading/Thread.h>
#include <pulse/pulseaudio.h>

View file

@ -6,13 +6,13 @@
#pragma once
#include "Loader.h"
#include "QOATypes.h"
#include "SampleFormats.h"
#include <AK/Error.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/Span.h>
#include <AK/Types.h>
#include <LibAudio/Loader.h>
#include <LibAudio/QOATypes.h>
#include <LibAudio/SampleFormats.h>
namespace Audio {

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibAudio/Sample.h>
#include "Sample.h"
#include <LibCore/SharedCircularQueue.h>
namespace Audio {

View file

@ -6,11 +6,11 @@
#pragma once
#include "Sample.h"
#include <AK/DisjointChunks.h>
#include <AK/FixedArray.h>
#include <AK/Noncopyable.h>
#include <AK/Vector.h>
#include <LibAudio/Sample.h>
#include <LibThreading/Mutex.h>
namespace Audio {

View file

@ -6,9 +6,9 @@
#pragma once
#include "LoaderError.h"
#include "Metadata.h"
#include <AK/ByteBuffer.h>
#include <LibAudio/LoaderError.h>
#include <LibAudio/Metadata.h>
namespace Audio {

View file

@ -7,13 +7,13 @@
#pragma once
#include "Loader.h"
#include <AK/ByteString.h>
#include <AK/FixedArray.h>
#include <AK/OwnPtr.h>
#include <AK/RefPtr.h>
#include <AK/Span.h>
#include <AK/StringView.h>
#include <LibAudio/Loader.h>
#include <LibRIFF/RIFF.h>
namespace Audio {

View file

@ -5,10 +5,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "WavLoader.h"
#include "WavTypes.h"
#include "WavWriter.h"
#include <AK/Endian.h>
#include <LibAudio/WavLoader.h>
#include <LibAudio/WavTypes.h>
#include <LibAudio/WavWriter.h>
namespace Audio {

View file

@ -6,13 +6,13 @@
#pragma once
#include "Encoder.h"
#include "Sample.h"
#include "SampleFormats.h"
#include <AK/ByteString.h>
#include <AK/Noncopyable.h>
#include <AK/RefPtr.h>
#include <AK/StringView.h>
#include <LibAudio/Encoder.h>
#include <LibAudio/Sample.h>
#include <LibAudio/SampleFormats.h>
#include <LibCore/File.h>
#include <LibCore/Forward.h>

View file

@ -1,4 +1,18 @@
set(SOURCES
Audio/GenericTypes.cpp
Audio/SampleFormats.cpp
Audio/Loader.cpp
Audio/WavLoader.cpp
Audio/FlacLoader.cpp
Audio/FlacWriter.cpp
Audio/WavWriter.cpp
Audio/Metadata.cpp
Audio/MP3Loader.cpp
Audio/PlaybackStream.cpp
Audio/QOALoader.cpp
Audio/QOATypes.cpp
Audio/UserSampleQueue.cpp
Audio/VorbisComment.cpp
Color/ColorConverter.cpp
Color/ColorPrimaries.cpp
Color/TransferCharacteristics.cpp
@ -8,6 +22,13 @@ set(SOURCES
VideoFrame.cpp
)
if (HAVE_PULSEAUDIO)
list(APPEND SOURCES
Audio/PlaybackStreamPulseAudio.cpp
Audio/PulseAudioWrappers.cpp
)
endif()
if (NOT ANDROID)
list(APPEND SOURCES FFmpeg/FFmpegVideoDecoder.cpp)
else()
@ -15,7 +36,7 @@ else()
endif()
serenity_lib(LibMedia media)
target_link_libraries(LibMedia PRIVATE LibCore LibIPC LibGfx LibThreading)
target_link_libraries(LibMedia PRIVATE LibCore LibCrypto LibRIFF LibIPC LibGfx LibThreading LibUnicode)
if (NOT ANDROID)
# Third-party
@ -23,3 +44,21 @@ if (NOT ANDROID)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec)
target_link_libraries(LibMedia PRIVATE PkgConfig::AVCODEC)
endif()
if (HAVE_PULSEAUDIO)
target_link_libraries(LibMedia PRIVATE pulse)
target_compile_definitions(LibMedia PRIVATE HAVE_PULSEAUDIO=1)
endif()
if (APPLE AND NOT IOS)
target_sources(LibMedia PRIVATE Audio/PlaybackStreamAudioUnit.cpp)
find_library(AUDIO_UNIT AudioUnit REQUIRED)
target_link_libraries(LibMedia PRIVATE ${AUDIO_UNIT})
endif()
if (ANDROID)
target_sources(LibMedia PRIVATE Audio/PlaybackStreamOboe.cpp)
find_package(oboe REQUIRED CONFIG)
target_link_libraries(LibMedia PRIVATE log oboe::oboe)
endif()

View file

@ -794,7 +794,7 @@ set(GENERATED_SOURCES
serenity_lib(LibWeb web)
target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibAudio LibMedia LibWasm LibXML LibIDL LibURL LibTLS LibRequests skia)
target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibMedia LibWasm LibXML LibIDL LibURL LibTLS LibRequests skia)
generate_js_bindings(LibWeb)

View file

@ -5,9 +5,9 @@
*/
#include <AK/IDAllocator.h>
#include <LibAudio/Loader.h>
#include <LibJS/Runtime/Realm.h>
#include <LibJS/Runtime/VM.h>
#include <LibMedia/Audio/Loader.h>
#include <LibWeb/Bindings/AudioTrackPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/Event.h>

View file

@ -8,7 +8,7 @@
#include <AK/String.h>
#include <AK/Time.h>
#include <LibAudio/Forward.h>
#include <LibMedia/Audio/Forward.h>
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::HTML {

View file

@ -5,8 +5,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibAudio/Loader.h>
#include <LibJS/Runtime/Promise.h>
#include <LibMedia/Audio/Loader.h>
#include <LibMedia/PlaybackManager.h>
#include <LibWeb/Bindings/HTMLMediaElementPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibAudio/Loader.h>
#include <LibAudio/Resampler.h>
#include <LibAudio/Sample.h>
#include <LibMedia/Audio/Loader.h>
#include <LibMedia/Audio/Resampler.h>
#include <LibMedia/Audio/Sample.h>
#include <LibWeb/Platform/AudioCodecPlugin.h>
namespace Web::Platform {

View file

@ -10,7 +10,7 @@
#include <AK/Function.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <LibAudio/Forward.h>
#include <LibMedia/Audio/Forward.h>
namespace Web::Platform {

View file

@ -6,10 +6,10 @@
#include <AK/MemoryStream.h>
#include <AK/WeakPtr.h>
#include <LibAudio/Loader.h>
#include <LibCore/EventLoop.h>
#include <LibCore/ThreadedPromise.h>
#include <LibCore/Timer.h>
#include <LibMedia/Audio/Loader.h>
#include "AudioCodecPluginAgnostic.h"

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibAudio/PlaybackStream.h>
#include <LibMedia/Audio/PlaybackStream.h>
#include <LibWeb/Platform/AudioCodecPlugin.h>
namespace Web::Platform {

View file

@ -23,4 +23,4 @@ set(GENERATED_SOURCES
)
serenity_bin(WebContent)
target_link_libraries(WebContent PRIVATE LibCore LibFileSystem LibIPC LibGfx LibAudio LibImageDecoderClient LibJS LibWebView LibWeb LibUnicode LibMain LibURL)
target_link_libraries(WebContent PRIVATE LibCore LibFileSystem LibIPC LibGfx LibImageDecoderClient LibJS LibWebView LibWeb LibUnicode LibMain LibMedia LibURL)

View file

@ -5,7 +5,6 @@
*/
#include "ImageCodecPluginSerenity.h"
#include <LibAudio/Loader.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibCore/StandardPaths.h>
@ -13,6 +12,7 @@
#include <LibFileSystem/FileSystem.h>
#include <LibIPC/SingleServer.h>
#include <LibMain/Main.h>
#include <LibMedia/Audio/Loader.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Platform/AudioCodecPluginAgnostic.h>

View file

@ -6,12 +6,12 @@
#include <AK/NumericLimits.h>
#include <AK/Types.h>
#include <LibAudio/Loader.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/ElapsedTimer.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <LibMedia/Audio/Loader.h>
#include <stdio.h>
// The Kernel has problems with large anonymous buffers, so let's limit sample reads ourselves.

Some files were not shown because too many files have changed in this diff Show more