blob: e23b87026577a557ce1b52a2bd6309ab1ea5086d (
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
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "codec.hpp"
#include <memory>
#include <optional>
#include "foxenflac.hpp"
#include "mad.hpp"
#include "stbvorbis.hpp"
#include "types.hpp"
namespace codecs {
auto CreateCodecForType(StreamType type) -> std::optional<ICodec*> {
switch (type) {
case StreamType::kMp3:
return new MadMp3Decoder();
case StreamType::kFlac:
return new FoxenFlacDecoder();
case StreamType::kVorbis:
return new StbVorbisDecoder();
default:
return {};
}
}
} // namespace codecs
|