1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibAudio: Expose the format name from the loader plugins

The format of these names is "Full Abbreviation (.fileformat)". For
example: "FLAC (.flac)", "RIFF WAVE (.wav)", "MPEG Layer III (.mp3)",
"Vorbis (.ogg)" The reasoning is that the container and therefore the
file ending may differ significantly from the actual format, and the
format should be given as unambiguously as possible and necessary.
This commit is contained in:
kleines Filmröllchen 2022-01-14 12:32:42 +01:00 committed by Andreas Kling
parent dc89ac1463
commit 54ac4ba8cc
3 changed files with 5 additions and 0 deletions

View file

@ -50,6 +50,8 @@ public:
virtual u32 sample_rate() = 0;
virtual u16 num_channels() = 0;
// Human-readable name of the file format, of the form <full abbreviation> (.<ending>)
virtual String format_name() = 0;
virtual PcmSampleFormat pcm_format() = 0;
virtual RefPtr<Core::File> file() = 0;
};
@ -68,6 +70,7 @@ public:
int total_samples() const { return m_plugin->total_samples(); }
u32 sample_rate() const { return m_plugin->sample_rate(); }
u16 num_channels() const { return m_plugin->num_channels(); }
String format_name() const { return m_plugin->format_name(); }
u16 bits_per_sample() const { return pcm_bits_per_sample(m_plugin->pcm_format()); }
RefPtr<Core::File> file() const { return m_plugin->file(); }