1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:47:45 +00:00

LibAudio: Pass raw streams to MP3 synchronize() and read_frame()

`synchronize()` can be simplified greatly by checking whole bytes with
bitwise operations, and doing so also avoids the overhead of reading
individual bits from a bitstream.

Making `read_frame()` also take a `SeekableStream` will allow it to be
used inside `synchronize()` in the next commit.
This commit is contained in:
Zaggy1024 2023-08-26 01:13:02 -05:00 committed by Tim Flynn
parent 1847155b12
commit cbdf49de30
2 changed files with 47 additions and 52 deletions

View file

@ -42,8 +42,8 @@ public:
private:
MaybeLoaderError initialize();
static MaybeLoaderError skip_id3(SeekableStream& stream);
static MaybeLoaderError synchronize(BigEndianInputBitStream& stream, size_t sample_index);
static ErrorOr<MP3::Header, LoaderError> read_header(BigEndianInputBitStream& stream, size_t sample_index);
static MaybeLoaderError synchronize(SeekableStream& stream, size_t sample_index);
static ErrorOr<MP3::Header, LoaderError> read_header(SeekableStream& stream, size_t sample_index);
MaybeLoaderError synchronize();
MaybeLoaderError build_seek_table();
ErrorOr<MP3::MP3Frame, LoaderError> read_next_frame();