6 #include <libavutil/samplefmt.h> 
    7 #include <libavutil/channel_layout.h> 
   16     : _sampleRate(sampleRate)
 
   17     , _nbChannels(nbChannels)
 
   18     , _sampleFormat(sampleFormat)
 
   23     : _sampleRate(sampleRate)
 
   24     , _nbChannels(nbChannels)
 
   57         LOG_WARN(
"Incorrect sample format when get size of audio frame: return a size of 0.")
 
   64         std::stringstream msg;
 
   65         msg << 
"Unable to determine audio buffer size:" << std::endl;
 
   68         msg << 
"bytes per sample = " << av_get_bytes_per_sample(
getSampleFormat()) << std::endl;
 
   69         throw std::runtime_error(msg.str());
 
   79     av_frame_set_channel_layout(
_frame, av_get_default_channel_layout(desc.
_nbChannels));
 
   90         os << 
"Unable to allocate an audio frame of ";
 
   91         os << 
"sample rate = " << 
_frame->sample_rate << 
", ";
 
   92         os << 
"nb channels = " << 
_frame->channels << 
", ";
 
   93         os << 
"channel layout = " << av_get_channel_name(
_frame->channels) << 
", ";
 
   94         os << 
"nb samples = " << 
_frame->nb_samples << 
", ";
 
   96         throw std::runtime_error(os.str());
 
  104     const int audioSize = 
getSize();
 
  105     unsigned char* audioBuffer = 
new unsigned char[audioSize];
 
  106     memset(audioBuffer, value, audioSize);
 
  119         std::stringstream os;
 
  121         throw std::runtime_error(os.str());
 
AudioFrame(const AudioFrameDesc &ref)
 
AVSampleFormat getSampleFormat() const 
 
std::string getDescriptionFromErrorCode(const int code)
Get the string description corresponding to the error code provided by ffmpeg/libav. 
 
std::map< std::string, std::string > Profile
 
const std::string avProfileSampleRate
 
size_t getSize() const 
in bytes 
 
AVSampleFormat _sampleFormat
 
Description to create an audio frame. This corresponds to the number of samples, which corresponds to...
 
void setParameters(const ProfileLoader::Profile &profile)
Set the attributes from the given profile. 
 
size_t getNbChannels() const 
 
This class describes decoded (raw) audio or video data. 
 
const std::string avProfileSampleFormat
 
std::string getSampleFormatName(const AVSampleFormat sampleFormat)
 
void allocateAVSample(const AudioFrameDesc &ref)
Allocate the audio buffer of the frame. 
 
const std::string avProfileChannel
 
size_t getNbSamplesPerChannel() const 
 
AVSampleFormat getAVSampleFormat(const std::string &sampleFormat)
Get the corresponding AVSampleFormat from the sample format name. 
 
AudioFrameDesc(const size_t sampleRate=0, const size_t channels=0, const AVSampleFormat sampleFormat=AV_SAMPLE_FMT_NONE)
 
void assign(const unsigned char value)
Assign the given value to all the data of the audio frame.