StormByte C++ Library: Multimedia module 0.0.9999
StormByte-Multimedia is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
StormByte::Multimedia::FFmpeg::AudioFifo Class Reference

RAII AVAudioFifo for sample buffering (loudnorm / encoder). More...

#include <StormByte/multimedia/ffmpeg/AudioFifo.hxx>

Inheritance diagram for StormByte::Multimedia::FFmpeg::AudioFifo:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Multimedia::FFmpeg::AudioFifo:
Collaboration graph
[legend]

Public Member Functions

 AudioFifo (AudioFifo &&other) noexcept=default
 Move constructor.
 
 ~AudioFifo () noexcept override
 Destructor.
 
AudioFifooperator= (AudioFifo &&other) noexcept=default
 Move assignment.
 
 operator bool () const noexcept
 Whether a fifo is allocated.
 
int Size () const noexcept
 Samples currently stored.
 
int Space () const noexcept
 Free sample slots.
 
bool Write (const AVFrame &src) noexcept
 Appends src samples to the fifo.
 
bool Read (AVFrame &dst, int nb_samples) noexcept
 Reads nb_samples into dst (already allocated).
 
bool Realloc (int nb_samples) noexcept
 Grows the fifo so it can hold at least nb_samples.
 
- Public Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::AVAudioFifo >
constexpr AVPointer () noexcept=delete
 Default constructor (deleted).
 
constexpr AVPointer (const AVPointer &) noexcept=delete
 Copy constructor (deleted).
 
constexpr AVPointer (AVPointer &&other) noexcept
 Move constructor.
 
virtual ~AVPointer () noexcept=default
 Destructor.
 
constexpr AVPointeroperator= (const AVPointer &) noexcept=delete
 Copy assignment (deleted).
 
constexpr AVPointeroperator= (AVPointer &&other) noexcept
 Move assignment.
 

Static Public Member Functions

static AudioFifo Open (int sample_fmt, int channels, int nb_samples) noexcept
 Allocates a fifo.
 

Additional Inherited Members

- Protected Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::AVAudioFifo >
constexpr AVPointer (std::decay_t< ::AVAudioFifo > *ptr) noexcept
 Adopts ptr.
 
constexpr const std::decay_t< ::AVAudioFifo > * Get () const noexcept
 Const view of the raw FFmpeg pointer.
 
constexpr std::decay_t< ::AVAudioFifo > * Get () noexcept
 Mutable view of the raw FFmpeg pointer.
 
constexpr std::decay_t< ::AVAudioFifo > * Detach () noexcept
 Yields the raw pointer and leaves this wrapper empty.
 
- Protected Attributes inherited from StormByte::Multimedia::FFmpeg::AVPointer<::AVAudioFifo >
std::decay_t< ::AVAudioFifo > * m_ptr
 Owned FFmpeg pointer.
 

Detailed Description

RAII AVAudioFifo for sample buffering (loudnorm / encoder).

Constructor & Destructor Documentation

◆ AudioFifo()

StormByte::Multimedia::FFmpeg::AudioFifo::AudioFifo ( AudioFifo &&  other)
defaultnoexcept

Move constructor.

Transfers the fifo.

Parameters
otherSource fifo; left empty.

◆ ~AudioFifo()

StormByte::Multimedia::FFmpeg::AudioFifo::~AudioFifo ( )
overridenoexcept

Destructor.

Frees the AVAudioFifo.

Member Function Documentation

◆ Open()

static AudioFifo StormByte::Multimedia::FFmpeg::AudioFifo::Open ( int  sample_fmt,
int  channels,
int  nb_samples 
)
staticnoexcept

Allocates a fifo.

Empty wrapper on failure.

Parameters
sample_fmtAVSampleFormat as int.
channelsChannel count.
nb_samplesInitial capacity in samples.
Returns
Open fifo, or empty on failure.

◆ operator bool()

StormByte::Multimedia::FFmpeg::AudioFifo::operator bool ( ) const
explicitnoexcept

Whether a fifo is allocated.

Returns
true if Write / Read can run.

◆ operator=()

AudioFifo & StormByte::Multimedia::FFmpeg::AudioFifo::operator= ( AudioFifo &&  other)
defaultnoexcept

Move assignment.

Frees *this, then takes other.

Parameters
otherSource fifo; left empty.
Returns
*this.

◆ Read()

bool StormByte::Multimedia::FFmpeg::AudioFifo::Read ( AVFrame dst,
int  nb_samples 
)
noexcept

Reads nb_samples into dst (already allocated).

Parameters
dstDestination audio frame.
nb_samplesSamples to read.
Returns
false on failure.

◆ Realloc()

bool StormByte::Multimedia::FFmpeg::AudioFifo::Realloc ( int  nb_samples)
noexcept

Grows the fifo so it can hold at least nb_samples.

Parameters
nb_samplesMinimum capacity in samples.
Returns
false on failure.

◆ Size()

int StormByte::Multimedia::FFmpeg::AudioFifo::Size ( ) const
noexcept

Samples currently stored.

Returns
Sample count, or 0.

◆ Space()

int StormByte::Multimedia::FFmpeg::AudioFifo::Space ( ) const
noexcept

Free sample slots.

Returns
Remaining capacity, or 0.

◆ Write()

bool StormByte::Multimedia::FFmpeg::AudioFifo::Write ( const AVFrame src)
noexcept

Appends src samples to the fifo.

Parameters
srcSource audio frame.
Returns
false on failure.

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