mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
This commit implements the functionality to play back audio through PlaybackManager. To decode the audio data, AudioDataProviders are created for each track in the provided media data. These providers will fill their audio block queue, then sit idle until their corresponding tracks are enabled. In order to output the audio, one AudioMixingSink is created which manages a PlaybackStream which requests audio blocks from multiple AudioDataProviders and mixes them into one buffer with sample-perfect precision.
30 lines
657 B
C++
30 lines
657 B
C++
/*
|
|
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
#include <AK/NonnullOwnPtr.h>
|
|
#include <AK/Time.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibMedia/AudioBlock.h>
|
|
#include <LibMedia/DecoderError.h>
|
|
|
|
namespace Media {
|
|
|
|
class AudioDecoder {
|
|
public:
|
|
virtual ~AudioDecoder() { }
|
|
|
|
virtual DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data) = 0;
|
|
// Writes all buffered audio samples to the provided block.
|
|
virtual DecoderErrorOr<void> write_next_block(AudioBlock&) = 0;
|
|
|
|
virtual void flush() = 0;
|
|
};
|
|
|
|
}
|