13 , _frameDesc(frameDesc)
27 LOG_WARN(
"The given frame is not a valid audio frame: allocate a new AVSample to put generated data into it.");
34 if(frameBuffer.
getAVFrame().channel_layout == 0)
36 const size_t channelLayout = av_get_default_channel_layout(frameBuffer.
getAVFrame().channels);
37 LOG_WARN(
"Channel layout en the audio frame is not set. Set it to '" << channelLayout <<
"' to be able to copy silence data.")
38 av_frame_set_channel_layout(&frameBuffer.
getAVFrame(), channelLayout);
50 std::stringstream msg;
51 msg <<
"Generate a silence with the following features:" << std::endl;
62 LOG_DEBUG(
"Copy data of the silence when decode next frame")
68 LOG_DEBUG(
"Copy data of the audio specified when decode next frame")
AudioFrameDesc desc() const
void clear()
Unreference all the buffers referenced by frame and reset the frame fields.
AVSampleFormat getSampleFormat() const
AudioGenerator(const AudioGenerator &audioGenerator)
bool isAudioFrame() const
void setNbSamplesPerChannel(const size_t nbSamples)
const AudioFrameDesc _frameDesc
The description of the silence (sampleRate, channels...)
Description to create an audio frame. This corresponds to the number of samples, which corresponds to...
bool decodeNextFrame(Frame &frameBuffer)
Decode next frame.
size_t getSampleRate() const
size_t getNbChannels() const
This class describes decoded audio data.
This class describes decoded (raw) audio or video data.
void copyData(const Frame &frameToRef)
Copy the data of the given Frame.
std::string getSampleFormatName(const AVSampleFormat sampleFormat)
Frame * _inputFrame
Has link (no ownership)
size_t getNbSamplesPerChannel() const
AudioFrame * _silent
The generated silent (has ownership)