blob: f3b54f8ffac5f3d7c0a14c98a571ac74a7e8c953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* Copyright (c) 2018-2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibAudio/FlacLoader.h>
#include <LibAudio/WavLoader.h>
namespace Audio {
Loader::Loader(const StringView& path)
{
m_plugin = make<WavLoaderPlugin>(path);
if (m_plugin->sniff())
return;
m_plugin = make<FlacLoaderPlugin>(path);
if (m_plugin->sniff())
return;
m_plugin = nullptr;
}
Loader::Loader(const ByteBuffer& buffer)
{
m_plugin = make<WavLoaderPlugin>(buffer);
if (m_plugin->sniff())
return;
m_plugin = make<FlacLoaderPlugin>(buffer);
if (m_plugin->sniff()) {
dbgln("FLAC sniff successful");
return;
}
m_plugin = nullptr;
}
}
|