|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
RAII owner of one audio stream's encoder, resampler, and sample FIFO. More...
#include <AudioEncodeContext.hpp>
Collaboration diagram for MayaFlux::IO::AudioEncodeContext:Public Member Functions | |
| AudioEncodeContext ()=default | |
| AudioEncodeContext (AudioEncodeContext &&)=delete | |
| AudioEncodeContext (const AudioEncodeContext &)=delete | |
| void | close () |
| Release all owned resources. | |
| bool | drain (FFmpegMuxContext &mux) |
| Flush the FIFO remainder and encoder internal delay to the mux. | |
| bool | encode_frames (std::span< const double > interleaved, uint32_t num_frames, FFmpegMuxContext &mux) |
| Encode a block of interleaved double-precision PCM frames. | |
| bool | is_valid () const |
| True if codec, resampler, and FIFO are all ready. | |
| const std::string & | last_error () const |
| bool | open (FFmpegMuxContext &mux, uint32_t sample_rate, uint32_t channels, AVCodecID codec_id) |
| Open the encoder and register an audio stream in the mux context. | |
| AudioEncodeContext & | operator= (AudioEncodeContext &&)=delete |
| AudioEncodeContext & | operator= (const AudioEncodeContext &)=delete |
| ~AudioEncodeContext () | |
Public Attributes | |
| AVCodecContext * | codec_context {} |
| Owned; freed in destructor. | |
| AVAudioFifo * | fifo {} |
| Owned; freed in destructor. | |
| uint32_t | m_channels {} |
| uint32_t | m_sample_rate {} |
| int | m_stream_index { -1 } |
| AVStream * | stream {} |
| Owned by mux; pointer cached here. | |
| SwrContext * | swr_context {} |
| Owned; freed in destructor. | |
Private Member Functions | |
| bool | drain_packets (FFmpegMuxContext &mux) |
| Drain all packets currently available from the encoder into mux. | |
| bool | send_fifo_frame (FFmpegMuxContext &mux, bool pad_to_frame_size) |
| Pull one frame from the FIFO and send it to the encoder. | |
| bool | setup_fifo () |
| bool | setup_resampler () |
Private Attributes | |
| std::string | m_last_error |
| int64_t | m_pts = 0 |
RAII owner of one audio stream's encoder, resampler, and sample FIFO.
Encapsulates all audio-stream-specific FFmpeg objects on the write path:
Does NOT own AVFormatContext — that belongs to FFmpegMuxContext.
Destruction order (enforced in destructor): fifo → swr_context → codec_context The associated FFmpegMuxContext must outlive this object.
Open sequence:
Definition at line 40 of file AudioEncodeContext.hpp.