22#include "utility/sound/decoder/decoder_registry.hpp"
26namespace utility::sound
29 decoderRegistryLogger(
"DecoderRegistry");
32std::shared_ptr<utility::sound::AAudioDecoder>
34 const std::string &filePath, AudioDecoderType type)
44 static const std::vector<std::shared_ptr<AAudioDecoder>> decoders = {
45 std::make_shared<WAVDecoder>(), std::make_shared<MP3Decoder>()
47 for (
const auto &decoder: decoders) {
48 if (decoder->canDecode(filePath) || decoder->canDecode(type)) {
49 decoderRegistryLogger.
debug()
50 <<
"Found decoder for file: " << filePath;
55 <<
"No decoder found for file: " << filePath;
LogMessage debug(std::source_location loc=std::source_location::current())
Begin a debug-level log message.
LogMessage warning(std::source_location loc=std::source_location::current())
Begin a warning-level log message.
Standard output/error logger implementation.
static std::shared_ptr< AAudioDecoder > getDecoderForFile(const std::string &filePath, AudioDecoderType type=AudioDecoderType::UNKNOWN)
Retrieves a decoder compatible with the specified audio source.
Platform-specific default logger alias.