utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::sound::DecoderRegistry Class Reference

Factory responsible for resolving audio decoders. More...

#include <headers/utility/sound/decoder/decoder_registry.hpp>

Static Public Member Functions

static std::shared_ptr< AAudioDecodergetDecoderForFile (const std::string &filePath, AudioDecoderType type=AudioDecoderType::UNKNOWN)
 Retrieves a decoder compatible with the specified audio source.
 

Detailed Description

Factory responsible for resolving audio decoders.

DecoderRegistry provides a centralized mechanism for locating an appropriate AAudioDecoder implementation for a given audio file or decoder type.

The registry abstracts format-specific decoder selection from the rest of the audio subsystem, allowing clients to decode audio files without needing to know which concrete decoder implementation is required.

Supported decoder implementations are evaluated sequentially until a compatible decoder is found.

Note
The current implementation uses a static collection of decoder instances.
Future implementations may replace the linear search with a more efficient lookup mechanism or a plugin-based architecture.

Definition at line 53 of file decoder_registry.hpp.

Member Function Documentation

◆ getDecoderForFile()

std::shared_ptr< utility::sound::AAudioDecoder > utility::sound::DecoderRegistry::getDecoderForFile ( const std::string &  filePath,
AudioDecoderType  type = AudioDecoderType::UNKNOWN 
)
static

Retrieves a decoder compatible with the specified audio source.

The registry attempts to find a decoder that supports either the provided file path or the specified decoder type.

Parameters
filePathPath to the audio file.
typeExplicit audio type hint.
Returns
A shared pointer to a compatible decoder, or nullptr if no suitable decoder is found.

This is a simple implementation that checks each decoder in the registry to see if it can decode the given file path or type. In a more complex implementation, you might want to use a more efficient lookup mechanism, such as a map of file extensions to decoders, or a plugin system for dynamically loading decoders.

Definition at line 33 of file decoder_registry.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: