avcpp  2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Public Member Functions | Static Public Member Functions | List of all members
av::AudioResampler Class Reference

#include <audioresampler.h>

Inheritance diagram for av::AudioResampler:
Inheritance graph
[legend]
Collaboration diagram for av::AudioResampler:
Collaboration graph
[legend]

Public Member Functions

 AudioResampler ()
 
 AudioResampler (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat, uint64_t srcChannelsLayout, int srcRate, SampleFormat srcFormat, OptionalErrorCode ec=throws())
 
 AudioResampler (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat, uint64_t srcChannelsLayout, int srcRate, SampleFormat srcFormat, Dictionary &options, OptionalErrorCode ec=throws())
 
 AudioResampler (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat, uint64_t srcChannelsLayout, int srcRate, SampleFormat srcFormat, Dictionary &&options, OptionalErrorCode ec=throws())
 
 ~AudioResampler ()
 
 AudioResampler (AudioResampler &&other)
 
AudioResampleroperator= (AudioResampler &&rhs)
 
void swap (AudioResampler &other)
 
uint64_t dstChannelLayout () const
 
int dstChannels () const
 
int dstSampleRate () const
 
SampleFormat dstSampleFormat () const
 
uint64_t srcChannelLayout () const
 
int srcChannels () const
 
int srcSampleRate () const
 
SampleFormat srcSampleFormat () const
 
void push (const AudioSamples &src, OptionalErrorCode ec=throws())
 Push frame to the rescaler context. More...
 
bool pop (AudioSamples &dst, bool getall, OptionalErrorCode ec=throws())
 Pop frame from the rescaler context. More...
 
AudioSamples pop (size_t samplesCount, OptionalErrorCode ec=throws())
 Pop frame from the rescaler context. More...
 
bool isValid () const
 
 operator bool () const
 
int64_t delay () const
 
bool init (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat, uint64_t srcChannelsLayout, int srcRate, SampleFormat srcFormat, OptionalErrorCode ec=throws())
 
bool init (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat, uint64_t srcChannelsLayout, int srcRate, SampleFormat srcFormat, Dictionary &options, OptionalErrorCode ec=throws())
 
bool init (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat, uint64_t srcChannelsLayout, int srcRate, SampleFormat srcFormat, Dictionary &&options, OptionalErrorCode ec=throws())
 
- Public Member Functions inherited from FFWrapperPtr< SwrContext >
 FFWrapperPtr ()=default
 
 FFWrapperPtr (SwrContext *raw)
 
const SwrContext * raw () const
 
SwrContext * raw ()
 
void reset (SwrContext *raw=nullptr)
 
bool isNull () const
 
void _log (int level, const char *fmt) const
 
void _log (int level, const char *fmt, const Args &... args) const
 

Static Public Member Functions

static bool validate (uint64_t dstChannelsLayout, int dstRate, SampleFormat dstFormat)
 

Additional Inherited Members

- Protected Member Functions inherited from av::noncopyable
 noncopyable ()=default
 
 noncopyable (const noncopyable &)=delete
 
void operator= (const noncopyable &)=delete
 
- Protected Attributes inherited from FFWrapperPtr< SwrContext >
SwrContext * m_raw
 

Constructor & Destructor Documentation

◆ AudioResampler() [1/5]

av::AudioResampler::AudioResampler ( )

◆ AudioResampler() [2/5]

av::AudioResampler::AudioResampler ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat,
uint64_t  srcChannelsLayout,
int  srcRate,
SampleFormat  srcFormat,
OptionalErrorCode  ec = throws() 
)

◆ AudioResampler() [3/5]

av::AudioResampler::AudioResampler ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat,
uint64_t  srcChannelsLayout,
int  srcRate,
SampleFormat  srcFormat,
Dictionary options,
OptionalErrorCode  ec = throws() 
)

◆ AudioResampler() [4/5]

av::AudioResampler::AudioResampler ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat,
uint64_t  srcChannelsLayout,
int  srcRate,
SampleFormat  srcFormat,
Dictionary &&  options,
OptionalErrorCode  ec = throws() 
)

◆ ~AudioResampler()

av::AudioResampler::~AudioResampler ( )

◆ AudioResampler() [5/5]

av::AudioResampler::AudioResampler ( AudioResampler &&  other)

Member Function Documentation

◆ delay()

int64_t av::AudioResampler::delay ( ) const

◆ dstChannelLayout()

uint64_t av::AudioResampler::dstChannelLayout ( ) const

◆ dstChannels()

int av::AudioResampler::dstChannels ( ) const

◆ dstSampleFormat()

SampleFormat av::AudioResampler::dstSampleFormat ( ) const

◆ dstSampleRate()

int av::AudioResampler::dstSampleRate ( ) const

◆ init() [1/3]

bool av::AudioResampler::init ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat,
uint64_t  srcChannelsLayout,
int  srcRate,
SampleFormat  srcFormat,
Dictionary &&  options,
OptionalErrorCode  ec = throws() 
)

◆ init() [2/3]

bool av::AudioResampler::init ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat,
uint64_t  srcChannelsLayout,
int  srcRate,
SampleFormat  srcFormat,
Dictionary options,
OptionalErrorCode  ec = throws() 
)

◆ init() [3/3]

bool av::AudioResampler::init ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat,
uint64_t  srcChannelsLayout,
int  srcRate,
SampleFormat  srcFormat,
OptionalErrorCode  ec = throws() 
)

◆ isValid()

bool av::AudioResampler::isValid ( ) const

◆ operator bool()

av::AudioResampler::operator bool ( ) const
inline

◆ operator=()

AudioResampler & av::AudioResampler::operator= ( AudioResampler &&  rhs)

◆ pop() [1/2]

bool av::AudioResampler::pop ( AudioSamples dst,
bool  getall,
OptionalErrorCode  ec = throws() 
)

Pop frame from the rescaler context.

Note, single push can produce multiple output frames.

If getall sets to true and false returns, this means that no data at all and resampler fully flushed.

Parameters
[out]dstframe to store audio data. Frame must be allocated before call.
[in]getallif true and if avail data less then nb_samples return data as is
[in,out]ecthis represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead
Returns
false if no samples avail, true otherwise. On error false.

◆ pop() [2/2]

AudioSamples av::AudioResampler::pop ( size_t  samplesCount,
OptionalErrorCode  ec = throws() 
)

Pop frame from the rescaler context.

Note, single push can produce multiple output frames.

If samplesCount sets to the zero and null frame returns, it means that no data at all and resampler fully flushed.

Parameters
[in]samplesCountsamples count to extract. If zero (0) - extract all delayed (buffered) samples.
[in,out]ecthis represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead
Returns
resampled samples or null-frame when no requested samples avail. On error null-frame.

◆ push()

void av::AudioResampler::push ( const AudioSamples src,
OptionalErrorCode  ec = throws() 
)

Push frame to the rescaler context.

Note, signle push can produce multiple frames.

Parameters
[in]srcsource frame
[in,out]ecthis represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead

◆ srcChannelLayout()

uint64_t av::AudioResampler::srcChannelLayout ( ) const

◆ srcChannels()

int av::AudioResampler::srcChannels ( ) const

◆ srcSampleFormat()

SampleFormat av::AudioResampler::srcSampleFormat ( ) const

◆ srcSampleRate()

int av::AudioResampler::srcSampleRate ( ) const

◆ swap()

void av::AudioResampler::swap ( AudioResampler other)

◆ validate()

bool av::AudioResampler::validate ( uint64_t  dstChannelsLayout,
int  dstRate,
SampleFormat  dstFormat 
)
static

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