mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
LibAudio: Remove the last occurrence of Core::File
in the Wav plugin
This commit is contained in:
parent
2d6124049a
commit
f028930033
2 changed files with 3 additions and 5 deletions
|
@ -19,7 +19,7 @@ namespace Audio {
|
|||
static constexpr size_t const maximum_wav_size = 1 * GiB; // FIXME: is there a more appropriate size limit?
|
||||
|
||||
WavLoaderPlugin::WavLoaderPlugin(StringView path)
|
||||
: m_file(Core::File::construct(path))
|
||||
: m_path(path)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ MaybeLoaderError WavLoaderPlugin::initialize()
|
|||
if (m_backing_memory.has_value())
|
||||
m_stream = LOADER_TRY(Core::Stream::MemoryStream::construct(m_backing_memory.value()));
|
||||
else
|
||||
m_stream = LOADER_TRY(Core::Stream::File::open(m_file->filename(), Core::Stream::OpenMode::Read));
|
||||
m_stream = LOADER_TRY(Core::Stream::File::open(m_path, Core::Stream::OpenMode::Read));
|
||||
|
||||
TRY(parse_header());
|
||||
return {};
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
virtual u16 num_channels() override { return m_num_channels; }
|
||||
virtual String format_name() override { return "RIFF WAVE (.wav)"; }
|
||||
virtual PcmSampleFormat pcm_format() override { return m_sample_format; }
|
||||
virtual RefPtr<Core::File> file() override { return m_file; }
|
||||
|
||||
private:
|
||||
MaybeLoaderError parse_header();
|
||||
|
@ -57,8 +56,7 @@ private:
|
|||
template<typename SampleReader>
|
||||
MaybeLoaderError read_samples_from_stream(Core::Stream::Stream& stream, SampleReader read_sample, FixedArray<Sample>& samples) const;
|
||||
|
||||
// This is only kept around for compatibility for now.
|
||||
RefPtr<Core::File> m_file;
|
||||
StringView m_path;
|
||||
OwnPtr<Core::Stream::SeekableStream> m_stream;
|
||||
// The constructor might set this so that we can initialize the data stream later.
|
||||
Optional<Bytes const&> m_backing_memory;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue