diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-07 15:39:28 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-07 15:39:28 +1000 |
| commit | e12ac1d9632856237388614bf393c7338500e00a (patch) | |
| tree | 9f353c516427225906eafa9704f312dd12174a46 /src/codecs/codec.cpp | |
| parent | 7e96482087632278c3d9e4a5db6bad25374ada8f (diff) | |
| download | tangara-fw-e12ac1d9632856237388614bf393c7338500e00a.tar.gz | |
Do some prep cleanup for multiple filetypes
Diffstat (limited to 'src/codecs/codec.cpp')
| -rw-r--r-- | src/codecs/codec.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/codecs/codec.cpp b/src/codecs/codec.cpp index 4f9e8892..73bc9032 100644 --- a/src/codecs/codec.cpp +++ b/src/codecs/codec.cpp @@ -7,13 +7,19 @@ #include "codec.hpp" #include <memory> +#include <optional> #include "mad.hpp" +#include "types.hpp" namespace codecs { -auto CreateCodecForType(StreamType type) - -> cpp::result<std::unique_ptr<ICodec>, CreateCodecError> { - return std::make_unique<MadMp3Decoder>(); // TODO. +auto CreateCodecForType(StreamType type) -> std::optional<ICodec*> { + switch (type) { + case StreamType::kMp3: + return new MadMp3Decoder(); + default: + return {}; + } } } // namespace codecs |
