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

LibAudio: Extract loader stream creation from the plugins

This removes a lot of duplicated stream creation code from the plugins,
and also simplifies the way that the appropriate plugin is found. This
mirrors the ImageDecoderPlugin design and necessitates new sniffing
methods on the loaders.
This commit is contained in:
kleines Filmröllchen 2023-06-24 17:04:38 +02:00 committed by Sam Atkins
parent dfd48ab643
commit 5f1dbbaaa6
15 changed files with 124 additions and 131 deletions

View file

@ -10,8 +10,9 @@
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
auto flac_data = ByteBuffer::copy(data, size).release_value();
auto mp3_or_error = Audio::MP3LoaderPlugin::create(flac_data.bytes());
auto const mp3_bytes = ByteBuffer::copy(data, size).release_value();
auto mp3_data = try_make<FixedMemoryStream>(mp3_bytes).release_value();
auto mp3_or_error = Audio::MP3LoaderPlugin::create(move(mp3_data));
if (mp3_or_error.is_error())
return 0;