mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:17:35 +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
12 changed files with 132 additions and 86 deletions
|
@ -23,11 +23,12 @@ struct ScaleFactorBand;
|
|||
|
||||
class MP3LoaderPlugin : public LoaderPlugin {
|
||||
public:
|
||||
explicit MP3LoaderPlugin(StringView path);
|
||||
explicit MP3LoaderPlugin(Bytes buffer);
|
||||
explicit MP3LoaderPlugin(OwnPtr<Core::Stream::SeekableStream> stream);
|
||||
virtual ~MP3LoaderPlugin() = default;
|
||||
|
||||
virtual MaybeLoaderError initialize() override;
|
||||
static Result<NonnullOwnPtr<MP3LoaderPlugin>, LoaderError> try_create(StringView path);
|
||||
static Result<NonnullOwnPtr<MP3LoaderPlugin>, LoaderError> try_create(Bytes buffer);
|
||||
|
||||
virtual LoaderSamples get_more_samples(size_t max_bytes_to_read_from_input = 128 * KiB) override;
|
||||
|
||||
virtual MaybeLoaderError reset() override;
|
||||
|
@ -41,6 +42,7 @@ public:
|
|||
virtual String format_name() override { return "MP3 (.mp3)"; }
|
||||
|
||||
private:
|
||||
MaybeLoaderError initialize();
|
||||
MaybeLoaderError synchronize();
|
||||
MaybeLoaderError build_seek_table();
|
||||
ErrorOr<MP3::Header, LoaderError> read_header();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue