|
FFmpegfs Fuse Multi Media Filesystem 2.19
|
RAII wrapper for AVAudioFifo. More...
#include <ffmpeg_audiofifo.h>
Public Member Functions | |
| FFmpeg_AudioFifo () | |
| Construct an empty FIFO wrapper. | |
| FFmpeg_AudioFifo (AVSampleFormat sample_fmt, int channels, int nb_samples=1) | |
| Construct and allocate an audio FIFO. | |
| ~FFmpeg_AudioFifo () | |
| Release the owned FIFO, if any. | |
| FFmpeg_AudioFifo (const FFmpeg_AudioFifo &)=delete | |
| FFmpeg_AudioFifo & | operator= (const FFmpeg_AudioFifo &)=delete |
| FFmpeg_AudioFifo (FFmpeg_AudioFifo &&fifo) noexcept | |
| Move-construct a FIFO wrapper. | |
| FFmpeg_AudioFifo & | operator= (FFmpeg_AudioFifo &&fifo) noexcept |
| Move-assign a FIFO wrapper. | |
| int | alloc (AVSampleFormat sample_fmt, int channels, int nb_samples=1) |
| Allocate a new audio FIFO, replacing any existing one. | |
| void | reset () |
| Free the owned FIFO and reset the wrapper to empty. | |
| bool | empty () const |
| Check whether the wrapper currently owns a FIFO. | |
| int | size () const |
| Return the number of samples currently stored in the FIFO. | |
| int | realloc (int nb_samples) |
| Resize the FIFO allocation. | |
| int | write (void **data, int nb_samples) |
| Write audio samples into the FIFO. | |
| int | read (void **data, int nb_samples) |
| Read audio samples from the FIFO. | |
| AVAudioFifo * | get () |
| Get the owned FFmpeg FIFO pointer. | |
| const AVAudioFifo * | get () const |
| Get the owned FFmpeg FIFO pointer. | |
| AVAudioFifo * | release () |
| Release ownership without freeing the FIFO. | |
| operator AVAudioFifo * () | |
| Convert to the underlying mutable FIFO pointer. | |
| operator const AVAudioFifo * () const | |
| Convert to the underlying const FIFO pointer. | |
Private Attributes | |
| AVAudioFifo * | m_fifo |
| Pointer to underlying AVAudioFifo. | |
RAII wrapper for AVAudioFifo.
Owns an AVAudioFifo allocated with av_audio_fifo_alloc() and releases it with av_audio_fifo_free(). The wrapper is movable but not copyable.
Definition at line 32 of file ffmpeg_audiofifo.h.
| FFmpeg_AudioFifo::FFmpeg_AudioFifo | ( | ) |
Construct an empty FIFO wrapper.
Definition at line 31 of file ffmpeg_audiofifo.cc.
| FFmpeg_AudioFifo::FFmpeg_AudioFifo | ( | AVSampleFormat | sample_fmt, |
| int | channels, | ||
| int | nb_samples = 1 |
||
| ) |
Construct and allocate an audio FIFO.
| [in] | sample_fmt | Sample format stored in the FIFO. |
| [in] | channels | Number of audio channels. |
| [in] | nb_samples | Initial allocation size in samples. |
Definition at line 36 of file ffmpeg_audiofifo.cc.
References alloc().
| FFmpeg_AudioFifo::~FFmpeg_AudioFifo | ( | ) |
Release the owned FIFO, if any.
Definition at line 42 of file ffmpeg_audiofifo.cc.
References reset().
|
noexcept |
Move-construct a FIFO wrapper.
| [in,out] | fifo | Source wrapper whose FIFO ownership is transferred. |
Definition at line 47 of file ffmpeg_audiofifo.cc.
| int FFmpeg_AudioFifo::alloc | ( | AVSampleFormat | sample_fmt, |
| int | channels, | ||
| int | nb_samples = 1 |
||
| ) |
Allocate a new audio FIFO, replacing any existing one.
| [in] | sample_fmt | Sample format stored in the FIFO. |
| [in] | channels | Number of audio channels. |
| [in] | nb_samples | Initial allocation size in samples. |
Definition at line 64 of file ffmpeg_audiofifo.cc.
References m_fifo, and reset().
Referenced by FFmpeg_AudioFifo(), and FFmpeg_Transcoder::init_audio_fifo().
| bool FFmpeg_AudioFifo::empty | ( | ) | const |
Check whether the wrapper currently owns a FIFO.
Definition at line 86 of file ffmpeg_audiofifo.cc.
References m_fifo.
Referenced by FFmpeg_Transcoder::purge_audio_fifo().
| AVAudioFifo * FFmpeg_AudioFifo::get | ( | ) |
Get the owned FFmpeg FIFO pointer.
Definition at line 127 of file ffmpeg_audiofifo.cc.
References m_fifo.
| const AVAudioFifo * FFmpeg_AudioFifo::get | ( | ) | const |
Get the owned FFmpeg FIFO pointer.
Definition at line 132 of file ffmpeg_audiofifo.cc.
References m_fifo.
| FFmpeg_AudioFifo::operator AVAudioFifo * | ( | ) |
Convert to the underlying mutable FIFO pointer.
Definition at line 144 of file ffmpeg_audiofifo.cc.
| FFmpeg_AudioFifo::operator const AVAudioFifo * | ( | ) | const |
Convert to the underlying const FIFO pointer.
Definition at line 149 of file ffmpeg_audiofifo.cc.
|
noexcept |
Move-assign a FIFO wrapper.
| [in,out] | fifo | Source wrapper whose FIFO ownership is transferred. |
Definition at line 53 of file ffmpeg_audiofifo.cc.
| int FFmpeg_AudioFifo::read | ( | void ** | data, |
| int | nb_samples | ||
| ) |
Read audio samples from the FIFO.
| [out] | data | Per-channel destination buffers as expected by FFmpeg. |
| [in] | nb_samples | Number of samples to read. |
Definition at line 118 of file ffmpeg_audiofifo.cc.
References m_fifo.
Referenced by FFmpeg_Transcoder::create_audio_frame().
| int FFmpeg_AudioFifo::realloc | ( | int | nb_samples | ) |
Resize the FIFO allocation.
| [in] | nb_samples | New allocation size in samples. |
Definition at line 100 of file ffmpeg_audiofifo.cc.
References m_fifo.
Referenced by FFmpeg_Transcoder::add_samples_to_fifo().
| AVAudioFifo * FFmpeg_AudioFifo::release | ( | ) |
Release ownership without freeing the FIFO.
Definition at line 137 of file ffmpeg_audiofifo.cc.
References m_fifo.
| void FFmpeg_AudioFifo::reset | ( | ) |
Free the owned FIFO and reset the wrapper to empty.
Definition at line 77 of file ffmpeg_audiofifo.cc.
References m_fifo.
Referenced by alloc(), FFmpeg_Transcoder::purge_audio_fifo(), and ~FFmpeg_AudioFifo().
| int FFmpeg_AudioFifo::size | ( | ) | const |
Return the number of samples currently stored in the FIFO.
Definition at line 91 of file ffmpeg_audiofifo.cc.
References m_fifo.
Referenced by FFmpeg_Transcoder::add_samples_to_fifo(), FFmpeg_Transcoder::copy_audio_to_frame_buffer(), FFmpeg_Transcoder::create_audio_frame(), and FFmpeg_Transcoder::purge_audio_fifo().
| int FFmpeg_AudioFifo::write | ( | void ** | data, |
| int | nb_samples | ||
| ) |
Write audio samples into the FIFO.
| [in] | data | Per-channel sample buffers as expected by FFmpeg. |
| [in] | nb_samples | Number of samples to write. |
Definition at line 109 of file ffmpeg_audiofifo.cc.
References m_fifo.
Referenced by FFmpeg_Transcoder::add_samples_to_fifo().
|
private |