AV module

FormatRegistry

[Singleton]({#ref classicy_1_1Singleton #}) registry of available media container formats for encoding and decoding.

FormatRegistry

#include <icy/av/formatregistry.h>

Singleton registry of available media container formats for encoding and decoding.

Public Methods

ReturnNameDescription
FormatRegistry
Format &get virtualReturn the format with the given display name. Throws std::runtime_error if no format with that name is registered.
Format &getByID virtualReturn the format with the given short ID (e.g. "mp4"). Throws std::runtime_error if no format with that ID is registered.
Format &getOrDefault virtualReturn the format with the given name, or the default format if not found.
Format &getDefault virtualIf a default has been specified it will be returned, other the format with the highest priority will take precedence.
voidregisterFormat virtualRegisters the given media format overriding existing media formats of the same name.
boolunregisterFormat virtualUnregisters the media format matching the given name.
voidsetDefault virtualSets the default fallback media format.
boolexists virtual#### Returns
voidclear virtualRemove all registered formats and clear the default.
FormatListformats 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

  • name The 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

  • id The 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

  • name The 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

  • name The display name to check.

clear

virtual

virtual void clear()

Remove all registered formats and clear the default.


formats

virtual const

virtual FormatList formats() const

Returns

A snapshot copy of all registered formats.

Public Static Methods

ReturnNameDescription
FormatRegistry &instance staticReturn the singleton FormatRegistry instance.

instance

static

static FormatRegistry & instance()

Return the singleton FormatRegistry instance.

Private Attributes

ReturnNameDescription
FormatList_formats
std::string_default
std::mutex_mutex

_formats

FormatList _formats

_default

std::string _default

_mutex

std::mutex _mutex

Private Methods

ReturnNameDescription
FormatRegistryDeleted constructor.
FormatRegistryDeleted constructor.
Format &findByName
Format &defaultLocked

FormatRegistry

FormatRegistry(const FormatRegistry &) = delete

Deleted constructor.


FormatRegistry

FormatRegistry(FormatRegistry &&) = delete

Deleted constructor.


findByName

Format & findByName(std::string_view name)

defaultLocked

Format & defaultLocked()