Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::audio::FormatRegistry Class Reference

Registry of audio format readers and writers. More...

#include <format_registry.hpp>

Public Member Functions

void register_reader (std::unique_ptr< FormatReader > reader)
 Register a custom reader.
void register_writer (std::unique_ptr< FormatWriter > writer)
 Register a custom writer.
FormatReader * find_reader (std::string_view extension) const
 Find a reader for the given file extension.
FormatWriter * find_writer (std::string_view extension) const
 Find a writer for the given file extension.
std::optional< AudioFileInfo > read_info (const std::string &path) const
 Read any supported audio file (dispatches to the right reader).
std::optional< AudioFileData > read (const std::string &path) const
std::optional< AudioFileData > read (const std::string &path, const DecodeLimits &limits) const
 Read with explicit decode ceilings.
bool write (const std::string &path, const AudioFileData &data) const
 Write audio data (dispatches to the right writer based on extension).
std::vector< std::string > supported_read_extensions () const
 List all supported read extensions.
std::vector< std::string > supported_write_extensions () const
 List all supported write extensions.

Static Public Member Functions

static FormatRegistry & instance ()
 Get the global singleton registry (pre-populated with built-in formats).

Detailed Description

Registry of audio format readers and writers.

Member Function Documentation

◆ find_reader()

FormatReader * pulp::audio::FormatRegistry::find_reader ( std::string_view extension) const

Find a reader for the given file extension.

◆ find_writer()

FormatWriter * pulp::audio::FormatRegistry::find_writer ( std::string_view extension) const

Find a writer for the given file extension.

◆ instance()

FormatRegistry & pulp::audio::FormatRegistry::instance ( )
static

Get the global singleton registry (pre-populated with built-in formats).

◆ read() [1/2]

std::optional< AudioFileData > pulp::audio::FormatRegistry::read ( const std::string & path) const

◆ read() [2/2]

std::optional< AudioFileData > pulp::audio::FormatRegistry::read ( const std::string & path,
const DecodeLimits & limits ) const

Read with explicit decode ceilings.

Every built-in reader refuses a file whose header or decoded output would exceed them; a custom reader registered without a limits overload reads unbounded.

◆ read_info()

std::optional< AudioFileInfo > pulp::audio::FormatRegistry::read_info ( const std::string & path) const

Read any supported audio file (dispatches to the right reader).

◆ register_reader()

void pulp::audio::FormatRegistry::register_reader ( std::unique_ptr< FormatReader > reader)

Register a custom reader.

◆ register_writer()

void pulp::audio::FormatRegistry::register_writer ( std::unique_ptr< FormatWriter > writer)

Register a custom writer.

◆ supported_read_extensions()

std::vector< std::string > pulp::audio::FormatRegistry::supported_read_extensions ( ) const

List all supported read extensions.

◆ supported_write_extensions()

std::vector< std::string > pulp::audio::FormatRegistry::supported_write_extensions ( ) const

List all supported write extensions.

◆ write()

bool pulp::audio::FormatRegistry::write ( const std::string & path,
const AudioFileData & data ) const

Write audio data (dispatches to the right writer based on extension).


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