Gazebo Common

API Reference

5.7.0
AudioDecoder Class Reference

An audio decoder based on FFMPEG. More...

#include <gz/common/common.hh>

Public Member Functions

 AudioDecoder ()
 Constructor. More...
 
bool Decode (uint8_t **_outBuffer, unsigned int *_outBufferSize)
 Decode the loaded audio file. More...
 
std::string File () const
 Get the audio filename that was set. More...
 
int SampleRate ()
 Get the sample rate from the latest decoded file. More...
 
bool SetFile (const std::string &_filename)
 Set the file to decode. More...
 

Detailed Description

An audio decoder based on FFMPEG.

Constructor & Destructor Documentation

◆ AudioDecoder()

Constructor.

Member Function Documentation

◆ Decode()

bool Decode ( uint8_t **  _outBuffer,
unsigned int *  _outBufferSize 
)

Decode the loaded audio file.

See also
AudioDecoder::SetFile
Parameters
[out]_outBufferBuffer that holds the decoded audio data.
[out]_outBufferSizeSize of the _outBuffer.
Returns
True if decoding was succesful.

◆ File()

std::string File ( ) const

Get the audio filename that was set.

Returns
The name of the set audio file.
See also
AudioDecoder::SetFile

◆ SampleRate()

int SampleRate ( )

Get the sample rate from the latest decoded file.

Returns
Integer sample rate, such as 44100. If no file is decoded, -1 is returned.

◆ SetFile()

bool SetFile ( const std::string _filename)

Set the file to decode.

Parameters
[in]_filenamePath to an audio file.
Returns
True if the file was successfull opened.

The documentation for this class was generated from the following file: