avcpp
2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
#include <audioresampler.h>
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) | |
AudioResampler & | operator= (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 |
av::AudioResampler::AudioResampler | ( | ) |
av::AudioResampler::AudioResampler | ( | uint64_t | dstChannelsLayout, |
int | dstRate, | ||
SampleFormat | dstFormat, | ||
uint64_t | srcChannelsLayout, | ||
int | srcRate, | ||
SampleFormat | srcFormat, | ||
OptionalErrorCode | ec = throws() |
||
) |
av::AudioResampler::AudioResampler | ( | uint64_t | dstChannelsLayout, |
int | dstRate, | ||
SampleFormat | dstFormat, | ||
uint64_t | srcChannelsLayout, | ||
int | srcRate, | ||
SampleFormat | srcFormat, | ||
Dictionary & | options, | ||
OptionalErrorCode | ec = throws() |
||
) |
av::AudioResampler::AudioResampler | ( | uint64_t | dstChannelsLayout, |
int | dstRate, | ||
SampleFormat | dstFormat, | ||
uint64_t | srcChannelsLayout, | ||
int | srcRate, | ||
SampleFormat | srcFormat, | ||
Dictionary && | options, | ||
OptionalErrorCode | ec = throws() |
||
) |
av::AudioResampler::~AudioResampler | ( | ) |
av::AudioResampler::AudioResampler | ( | AudioResampler && | other | ) |
int64_t av::AudioResampler::delay | ( | ) | const |
uint64_t av::AudioResampler::dstChannelLayout | ( | ) | const |
int av::AudioResampler::dstChannels | ( | ) | const |
SampleFormat av::AudioResampler::dstSampleFormat | ( | ) | const |
int av::AudioResampler::dstSampleRate | ( | ) | const |
bool av::AudioResampler::init | ( | uint64_t | dstChannelsLayout, |
int | dstRate, | ||
SampleFormat | dstFormat, | ||
uint64_t | srcChannelsLayout, | ||
int | srcRate, | ||
SampleFormat | srcFormat, | ||
Dictionary && | options, | ||
OptionalErrorCode | ec = throws() |
||
) |
bool av::AudioResampler::init | ( | uint64_t | dstChannelsLayout, |
int | dstRate, | ||
SampleFormat | dstFormat, | ||
uint64_t | srcChannelsLayout, | ||
int | srcRate, | ||
SampleFormat | srcFormat, | ||
Dictionary & | options, | ||
OptionalErrorCode | ec = throws() |
||
) |
bool av::AudioResampler::init | ( | uint64_t | dstChannelsLayout, |
int | dstRate, | ||
SampleFormat | dstFormat, | ||
uint64_t | srcChannelsLayout, | ||
int | srcRate, | ||
SampleFormat | srcFormat, | ||
OptionalErrorCode | ec = throws() |
||
) |
bool av::AudioResampler::isValid | ( | ) | const |
|
inline |
AudioResampler & av::AudioResampler::operator= | ( | AudioResampler && | rhs | ) |
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.
[out] | dst | frame to store audio data. Frame must be allocated before call. |
[in] | getall | if true and if avail data less then nb_samples return data as is |
[in,out] | ec | this represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead |
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.
[in] | samplesCount | samples count to extract. If zero (0) - extract all delayed (buffered) samples. |
[in,out] | ec | this represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead |
void av::AudioResampler::push | ( | const AudioSamples & | src, |
OptionalErrorCode | ec = throws() |
||
) |
Push frame to the rescaler context.
Note, signle push can produce multiple frames.
[in] | src | source frame |
[in,out] | ec | this represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead |
uint64_t av::AudioResampler::srcChannelLayout | ( | ) | const |
int av::AudioResampler::srcChannels | ( | ) | const |
SampleFormat av::AudioResampler::srcSampleFormat | ( | ) | const |
int av::AudioResampler::srcSampleRate | ( | ) | const |
void av::AudioResampler::swap | ( | AudioResampler & | other | ) |
|
static |