1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibAudio: Allow the MP3 plugin to be constructed from a byte buffer

This commit is contained in:
Lucas CHOLLET 2022-10-13 15:55:21 +02:00 committed by Linus Groh
parent bb17ee8397
commit 754b129f4a
3 changed files with 14 additions and 2 deletions

View file

@ -15,13 +15,19 @@ DSP::MDCT<12> MP3LoaderPlugin::s_mdct_12;
DSP::MDCT<36> MP3LoaderPlugin::s_mdct_36;
MP3LoaderPlugin::MP3LoaderPlugin(StringView path)
: m_path(path)
: LoaderPlugin(path)
{
}
MP3LoaderPlugin::MP3LoaderPlugin(Bytes buffer)
: m_backing_memory(buffer)
{
}
MaybeLoaderError MP3LoaderPlugin::initialize()
{
m_stream = LOADER_TRY(Core::Stream::File::open(m_path, Core::Stream::OpenMode::Read));
LOADER_TRY(LoaderPlugin::initialize());
m_bitstream = LOADER_TRY(Core::Stream::BigEndianInputBitStream::construct(*m_stream));
TRY(synchronize());