mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
LibAudio: Implement the Quite Okay Audio format
Brought to you by the inventor of QOI, QOA is a lossy audio codec that is, as the name says, quite okay in compressing audio data reasonably well without frequency transformation, mostly introducing some white noise in the background. This implementation of QOA is fully compatible with the qoa.h reference implementation as of 2023-02-25. Note that there may be changes to the QOA format before a specification is finalized, and there is currently no information on when that will happen and which changes will be made. This implementation of QOA can handle varying sample rate and varying channel count files. The reference implementation does not produce these files and cannot handle them, so their implementation is untested. The QOA loader is capable of seeking in constant-bitrate streams. QOA links: https://phoboslab.org/log/2023/02/qoa-time-domain-audio-compression https://github.com/phoboslab/qoa
This commit is contained in:
parent
3c65c22728
commit
0b421a3764
6 changed files with 542 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, the SerenityOS developers.
|
||||
* Copyright (c) 2018-2023, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -7,6 +7,7 @@
|
|||
#include <LibAudio/FlacLoader.h>
|
||||
#include <LibAudio/Loader.h>
|
||||
#include <LibAudio/MP3Loader.h>
|
||||
#include <LibAudio/QOALoader.h>
|
||||
#include <LibAudio/WavLoader.h>
|
||||
|
||||
namespace Audio {
|
||||
|
@ -41,6 +42,12 @@ Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::create_plugin(StringVie
|
|||
return NonnullOwnPtr<LoaderPlugin>(plugin.release_value());
|
||||
}
|
||||
|
||||
{
|
||||
auto plugin = QOALoaderPlugin::create(path);
|
||||
if (!plugin.is_error())
|
||||
return NonnullOwnPtr<LoaderPlugin>(plugin.release_value());
|
||||
}
|
||||
|
||||
return LoaderError { "No loader plugin available" };
|
||||
}
|
||||
|
||||
|
@ -64,6 +71,12 @@ Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::create_plugin(Bytes buf
|
|||
return NonnullOwnPtr<LoaderPlugin>(plugin.release_value());
|
||||
}
|
||||
|
||||
{
|
||||
auto plugin = QOALoaderPlugin::create(buffer);
|
||||
if (!plugin.is_error())
|
||||
return NonnullOwnPtr<LoaderPlugin>(plugin.release_value());
|
||||
}
|
||||
|
||||
return LoaderError { "No loader plugin available" };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue