mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibAudio: Port the MP3 plugin to Core::Stream
This commit is contained in:
parent
597a614ce6
commit
bb17ee8397
2 changed files with 53 additions and 108 deletions
|
@ -10,7 +10,8 @@
|
|||
#include "MP3Types.h"
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <AK/Tuple.h>
|
||||
#include <LibCore/FileStream.h>
|
||||
#include <LibCore/InputBitStream.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibDSP/MDCT.h>
|
||||
|
||||
namespace Audio {
|
||||
|
@ -22,7 +23,7 @@ struct ScaleFactorBand;
|
|||
class MP3LoaderPlugin : public LoaderPlugin {
|
||||
public:
|
||||
explicit MP3LoaderPlugin(StringView path);
|
||||
~MP3LoaderPlugin();
|
||||
virtual ~MP3LoaderPlugin() = default;
|
||||
|
||||
virtual MaybeLoaderError initialize() override;
|
||||
virtual LoaderSamples get_more_samples(size_t max_bytes_to_read_from_input = 128 * KiB) override;
|
||||
|
@ -63,18 +64,16 @@ private:
|
|||
u32 m_sample_rate { 0 };
|
||||
u8 m_num_channels { 0 };
|
||||
PcmSampleFormat m_sample_format { PcmSampleFormat::Int16 };
|
||||
size_t m_file_size { 0 };
|
||||
int m_total_samples { 0 };
|
||||
size_t m_loaded_samples { 0 };
|
||||
bool m_is_first_frame { true };
|
||||
|
||||
AK::Optional<MP3::MP3Frame> m_current_frame;
|
||||
u32 m_current_frame_read;
|
||||
RefPtr<Core::File> m_file;
|
||||
OwnPtr<Core::InputFileStream> m_input_stream;
|
||||
OwnPtr<InputBitStream> m_bitstream;
|
||||
StringView m_path;
|
||||
OwnPtr<Core::Stream::SeekableStream> m_stream;
|
||||
OwnPtr<Core::Stream::BigEndianInputBitStream> m_bitstream;
|
||||
DuplexMemoryStream m_bit_reservoir;
|
||||
Optional<LoaderError> m_error {};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue