mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
LibAudio: Switch LoaderPlugin to a more traditional constructor pattern
This now prepares all the needed (fallible) components before actually constructing a LoaderPlugin object, so we are no longer filling them in at an arbitrary later point in time.
This commit is contained in:
parent
3cf93d0dd2
commit
c57be0f474
Notes:
sideshowbarker
2024-07-17 03:43:33 +09:00
Author: https://github.com/timschumi
Commit: c57be0f474
Pull-request: https://github.com/SerenityOS/serenity/pull/16316
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
12 changed files with 132 additions and 86 deletions
|
@ -47,11 +47,11 @@ ALWAYS_INLINE ErrorOr<i32> decode_unsigned_exp_golomb(u8 order, BigEndianInputBi
|
|||
// https://datatracker.ietf.org/doc/html/draft-ietf-cellar-flac-03 (newer IETF draft that uses incompatible numberings and names)
|
||||
class FlacLoaderPlugin : public LoaderPlugin {
|
||||
public:
|
||||
explicit FlacLoaderPlugin(StringView path);
|
||||
explicit FlacLoaderPlugin(Bytes buffer);
|
||||
explicit FlacLoaderPlugin(OwnPtr<Core::Stream::SeekableStream> stream);
|
||||
virtual ~FlacLoaderPlugin() override = default;
|
||||
|
||||
virtual MaybeLoaderError initialize() override;
|
||||
static Result<NonnullOwnPtr<FlacLoaderPlugin>, LoaderError> try_create(StringView path);
|
||||
static Result<NonnullOwnPtr<FlacLoaderPlugin>, LoaderError> try_create(Bytes buffer);
|
||||
|
||||
virtual LoaderSamples get_more_samples(size_t max_bytes_to_read_from_input = 128 * KiB) override;
|
||||
|
||||
|
@ -69,6 +69,7 @@ public:
|
|||
bool sample_count_unknown() const { return m_total_samples == 0; }
|
||||
|
||||
private:
|
||||
MaybeLoaderError initialize();
|
||||
MaybeLoaderError parse_header();
|
||||
// Either returns the metadata block or sets error message.
|
||||
// Additionally, increments m_data_start_location past the read meta block.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue