FormatRegistry
FormatRegistry
#include <icy/av/formatregistry.h>Singleton registry of available media container formats for encoding and decoding.
Public Methods
| Return | Name | Description |
|---|---|---|
FormatRegistry | ||
Format & | get virtual | Return the format with the given display name. Throws std::runtime_error if no format with that name is registered. |
Format & | getByID virtual | Return the format with the given short ID (e.g. "mp4"). Throws std::runtime_error if no format with that ID is registered. |
Format & | getOrDefault virtual | Return the format with the given name, or the default format if not found. |
Format & | getDefault virtual | If a default has been specified it will be returned, other the format with the highest priority will take precedence. |
void | registerFormat virtual | Registers the given media format overriding existing media formats of the same name. |
bool | unregisterFormat virtual | Unregisters the media format matching the given name. |
void | setDefault virtual | Sets the default fallback media format. |
bool | exists virtual | #### Returns |
void | clear virtual | Remove all registered formats and clear the default. |
FormatList | formats virtual const | #### Returns |
FormatRegistry
FormatRegistry()get
virtual
virtual Format & get(std::string_view name)Return the format with the given display name. Throws std::runtime_error if no format with that name is registered.
Parameters
nameThe display name to look up.
getByID
virtual
virtual Format & getByID(std::string_view id)Return the format with the given short ID (e.g. "mp4"). Throws std::runtime_error if no format with that ID is registered.
Parameters
idThe short format ID to look up.
getOrDefault
virtual
virtual Format & getOrDefault(std::string_view name)Return the format with the given name, or the default format if not found.
Parameters
nameThe display name to look up.
getDefault
virtual
virtual Format & getDefault()If a default has been specified it will be returned, other the format with the highest priority will take precedence.
registerFormat
virtual
virtual void registerFormat(const Format & format)Registers the given media format overriding existing media formats of the same name.
unregisterFormat
virtual
virtual bool unregisterFormat(std::string_view name)Unregisters the media format matching the given name.
setDefault
virtual
virtual void setDefault(std::string_view name)Sets the default fallback media format.
exists
virtual
virtual bool exists(std::string_view name)Returns
True if a format with the given display name is registered.
Parameters
nameThe display name to check.
clear
virtual
virtual void clear()Remove all registered formats and clear the default.
formats
virtual const
virtual FormatList formats() constReturns
A snapshot copy of all registered formats.
Public Static Methods
| Return | Name | Description |
|---|---|---|
FormatRegistry & | instance static | Return the singleton FormatRegistry instance. |
instance
static
static FormatRegistry & instance()Return the singleton FormatRegistry instance.
Private Attributes
_formats
FormatList _formats_default
std::string _default_mutex
std::mutex _mutexPrivate Methods
| Return | Name | Description |
|---|---|---|
FormatRegistry | Deleted constructor. | |
FormatRegistry | Deleted constructor. | |
Format & | findByName | |
Format & | defaultLocked |
FormatRegistry
FormatRegistry(const FormatRegistry &) = deleteDeleted constructor.
FormatRegistry
FormatRegistry(FormatRegistry &&) = deleteDeleted constructor.
findByName
Format & findByName(std::string_view name)defaultLocked
Format & defaultLocked()