##

AudioDecoder.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GAZEBO_AUDIO_DECODER_HH_
#define _GAZEBO_AUDIO_DECODER_HH_
#include <stdint.h>
#include <string>
#include "gazebo/util/system.hh"
struct AVFormatContext;
struct AVCodecContext;
struct AVCodec;
namespace gazebo
{
namespace common
{
class GZ_COMMON_VISIBLE AudioDecoder
{
public: AudioDecoder();
public: virtual ~AudioDecoder();
public: bool SetFile(const std::string &_filename);
public: std::string GetFile() const;
public: bool Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize);
public: int GetSampleRate();
private: void Cleanup();
private: AVFormatContext *formatCtx;
private: AVCodecContext *codecCtx;
private: AVCodec *codec;
private: int audioStream;
private: static bool initialized;
private: std::string filename;
};
}
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
common
common
Definition: FuelModelDatabase.hh:37
system.hh
gazebo::common::AudioDecoder
An audio decoder based on FFMPEG.
Definition: AudioDecoder.hh:39
gazebo::common::AudioDecoder::GetSampleRate
int GetSampleRate()
Get the sample rate from the latest decoded file.
gazebo::common::AudioDecoder::Decode
bool Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)
Decode the loaded audio file.
gazebo::common::AudioDecoder::AudioDecoder
AudioDecoder()
Constructor.
gazebo::common::AudioDecoder::GetFile
std::string GetFile() const
Get the audio filename that was set.
gazebo::common::AudioDecoder::SetFile
bool SetFile(const std::string &_filename)
Set the file to decode.
gazebo::common::AudioDecoder::~AudioDecoder
virtual ~AudioDecoder()
Destructor.