|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
| bool MayaFlux::IO::AudioEncodeContext::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.
Selects the encoder: if codec_id is AV_CODEC_ID_NONE the container's default audio codec is used (WAV → PCM_S16LE, MP4/MKV → AAC, OGG → Vorbis, FLAC → FLAC). Allocates and opens AVCodecContext, copies parameters to the new AVStream, initialises SwrContext (AV_SAMPLE_FMT_DBL → encoder native format), and allocates AVAudioFifo sized to two encoder frames.
Must be called after FFmpegMuxContext::open() and before FFmpegMuxContext::write_header().
| mux | Open mux context that will own the output stream. |
| sample_rate | PCM sample rate in Hz. |
| channels | Number of interleaved channels. |
| codec_id | Encoder override; AV_CODEC_ID_NONE = container default. |
Definition at line 52 of file AudioEncodeContext.cpp.
References MayaFlux::IO::FFmpegMuxContext::add_stream(), close(), codec_context, MayaFlux::IO::FFmpegMuxContext::format_context, MayaFlux::IO::FFmpegDemuxContext::init_ffmpeg(), MayaFlux::IO::FFmpegMuxContext::is_open(), MayaFlux::IO::FFmpegMuxContext::last_error(), m_channels, m_last_error, m_sample_rate, m_stream_index, setup_fifo(), setup_resampler(), and stream.
Referenced by MayaFlux::IO::SoundFileWriter::worker_loop().
Here is the call graph for this function:
Here is the caller graph for this function: