mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 23:07:35 +00:00
Ladybird+LibWeb+WebContent: Create a platform plugin for playing audio
This creates (and installs upon WebContent startup) a platform plugin to play audio data. On Serenity, we use AudioServer to play audio over IPC. Unfortunately, AudioServer is currently coupled with Serenity's audio devices, and thus cannot be used in Ladybird on Lagom. Instead, we use a Qt audio device to play the audio, which requires the Qt multimedia package. While we use Qt to play the audio, note that we can still use LibAudio to decode the audio data and retrieve samples - we simply send Qt the raw PCM signals.
This commit is contained in:
parent
ee48d7514f
commit
a34e369252
15 changed files with 317 additions and 9 deletions
28
Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.cpp
Normal file
28
Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Platform/AudioCodecPlugin.h>
|
||||
|
||||
namespace Web::Platform {
|
||||
|
||||
static Function<ErrorOr<NonnullOwnPtr<AudioCodecPlugin>>()> s_creation_hook;
|
||||
|
||||
AudioCodecPlugin::AudioCodecPlugin() = default;
|
||||
AudioCodecPlugin::~AudioCodecPlugin() = default;
|
||||
|
||||
void AudioCodecPlugin::install_creation_hook(Function<ErrorOr<NonnullOwnPtr<AudioCodecPlugin>>()> creation_hook)
|
||||
{
|
||||
VERIFY(!s_creation_hook);
|
||||
s_creation_hook = move(creation_hook);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<AudioCodecPlugin>> AudioCodecPlugin::create()
|
||||
{
|
||||
VERIFY(s_creation_hook);
|
||||
return s_creation_hook();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue