RAII SwrContext for audio convert / resample.
More...
#include <StormByte/multimedia/ffmpeg/Swr.hxx>
|
| | Swr (Swr &&other) noexcept=default |
| | Move constructor.
|
| |
| | ~Swr () noexcept override |
| | Destructor.
|
| |
| Swr & | operator= (Swr &&other) noexcept=default |
| | Move assignment.
|
| |
| | operator bool () const noexcept |
| | Whether a resampler context is open.
|
| |
| bool | Convert (const AVFrame &src, AVFrame &dst) const noexcept |
| | Converts src into dst (swr_convert_frame).
|
| |
| bool | Drain (AVFrame &dst) const noexcept |
| | Flushes delayed samples into dst (swr_convert_frame with a null source).
|
| |
| std::int64_t | Delay (std::int64_t base) const noexcept |
| | Buffered delay in units of 1/base seconds (swr_get_delay).
|
| |
| 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 AVPointer & | operator= (const AVPointer &) noexcept=delete |
| | Copy assignment (deleted).
|
| |
| constexpr AVPointer & | operator= (AVPointer &&other) noexcept |
| | Move assignment.
|
| |
|
| constexpr | AVPointer (std::decay_t< ::SwrContext > *ptr) noexcept |
| | Adopts ptr.
|
| |
| constexpr const std::decay_t< ::SwrContext > * | Get () const noexcept |
| | Const view of the raw FFmpeg pointer.
|
| |
| constexpr std::decay_t< ::SwrContext > * | Get () noexcept |
| | Mutable view of the raw FFmpeg pointer.
|
| |
| constexpr std::decay_t< ::SwrContext > * | Detach () noexcept |
| | Yields the raw pointer and leaves this wrapper empty.
|
| |
| std::decay_t< ::SwrContext > * | m_ptr |
| | Owned FFmpeg pointer.
|
| |
RAII SwrContext for audio convert / resample.
◆ Swr()
| StormByte::Multimedia::FFmpeg::Swr::Swr |
( |
Swr && |
other | ) |
|
|
defaultnoexcept |
Move constructor.
Transfers the resampler.
- Parameters
-
| other | Source resampler; left empty. |
◆ ~Swr()
| StormByte::Multimedia::FFmpeg::Swr::~Swr |
( |
| ) |
|
|
overridenoexcept |
Destructor.
Frees the SwrContext.
◆ Convert()
| bool StormByte::Multimedia::FFmpeg::Swr::Convert |
( |
const AVFrame & |
src, |
|
|
AVFrame & |
dst |
|
) |
| const |
|
noexcept |
Converts src into dst (swr_convert_frame).
- Parameters
-
| src | Source frame. |
| dst | Destination frame (geometry already set). |
- Returns
- false on failure.
◆ Delay()
| std::int64_t StormByte::Multimedia::FFmpeg::Swr::Delay |
( |
std::int64_t |
base | ) |
const |
|
noexcept |
Buffered delay in units of 1/base seconds (swr_get_delay).
- Parameters
-
| base | Unit. Pass the input sample rate to get samples. |
- Returns
- Delay, or 0.
◆ Drain()
| bool StormByte::Multimedia::FFmpeg::Swr::Drain |
( |
AVFrame & |
dst | ) |
const |
|
noexcept |
Flushes delayed samples into dst (swr_convert_frame with a null source).
- Parameters
-
| dst | Destination frame (geometry already set). |
- Returns
- false on failure.
◆ Open()
| static Swr StormByte::Multimedia::FFmpeg::Swr::Open |
( |
const AVChannelLayout & |
out_layout, |
|
|
int |
out_fmt, |
|
|
int |
out_rate, |
|
|
const AVChannelLayout & |
in_layout, |
|
|
int |
in_fmt, |
|
|
int |
in_rate |
|
) |
| |
|
staticnoexcept |
Opens a resampler.
Empty wrapper on failure.
- Parameters
-
| out_layout | Destination channel layout. |
| out_fmt | Destination AVSampleFormat as int. |
| out_rate | Destination sample rate in Hz. |
| in_layout | Source channel layout. |
| in_fmt | Source AVSampleFormat as int. |
| in_rate | Source sample rate in Hz. |
- Returns
- Open resampler, or empty on failure.
◆ operator bool()
| StormByte::Multimedia::FFmpeg::Swr::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Whether a resampler context is open.
- Returns
- true if
Convert can run.
◆ operator=()
| Swr & StormByte::Multimedia::FFmpeg::Swr::operator= |
( |
Swr && |
other | ) |
|
|
defaultnoexcept |
Move assignment.
Frees *this, then takes other.
- Parameters
-
| other | Source resampler; left empty. |
- Returns
- *this.
The documentation for this class was generated from the following file:
- lib/public/StormByte/multimedia/ffmpeg/Swr.hxx