Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tangara-fw/src/codecs/codec.cpp

35 lines
699 B

/*
* 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 "opus.hpp"
#include "types.hpp"
#include "vorbis.hpp"
namespace codecs {
auto CreateCodecForType(StreamType type) -> std::optional<ICodec*> {
switch (type) {
case StreamType::kMp3:
return new MadMp3Decoder();
case StreamType::kVorbis:
return new TremorVorbisDecoder();
case StreamType::kFlac:
return new FoxenFlacDecoder();
case StreamType::kOpus:
return new XiphOpusDecoder();
default:
return {};
}
}
} // namespace codecs