Sirikata
Public Member Functions | Private Member Functions | Private Attributes | Friends
Sirikata::SDL::FFmpegAudioStream Class Reference

Represents a single audio stream within a media file. More...

#include <FFmpegAudioStream.hpp>

Collaboration diagram for Sirikata::SDL::FFmpegAudioStream:

List of all members.

Public Member Functions

 ~FFmpegAudioStream ()
bool finished () const
void samples (int16 *samples_out, bool loop)
 Get the next samples from the stream, or fill them with silence if the stream has ended.

Private Member Functions

 FFmpegAudioStream (FFmpegStreamPtr parent, uint32 stream_idx, uint8 target_nchannels)
bool openCodec ()
void closeCodec ()
AVPacket * getNextPacket (bool loop)
void decodeSome (bool loop)
void convertFormat (int decoded_size)

Private Attributes

FFmpegStreamPtr mParent
AVCodecContext * mCodecCtx
AVCodec * mCodec
uint32 mStreamIndex
bool mFinished
AVPacket * mCurrentPacket
int mCurrentPacketOffset
uint8 * mDecodedData
SDL_AudioCVT * mConverter
uint8 mTargetChannels
uint16 * mConvertedData
int mConvertedOffset
int mConvertedSize

Friends

class FFmpegStream

Detailed Description

Represents a single audio stream within a media file.


Constructor & Destructor Documentation

Sirikata::SDL::FFmpegAudioStream::~FFmpegAudioStream ( )
Sirikata::SDL::FFmpegAudioStream::FFmpegAudioStream ( FFmpegStreamPtr  parent,
uint32  stream_idx,
uint8  target_nchannels 
) [private]

References openCodec().


Member Function Documentation

void Sirikata::SDL::FFmpegAudioStream::closeCodec ( ) [private]

References mCodecCtx.

Referenced by getNextPacket(), and ~FFmpegAudioStream().

void Sirikata::SDL::FFmpegAudioStream::convertFormat ( int  decoded_size) [private]
void Sirikata::SDL::FFmpegAudioStream::decodeSome ( bool  loop) [private]
bool Sirikata::SDL::FFmpegAudioStream::finished ( ) const

References mFinished.

Referenced by samples().

AVPacket * Sirikata::SDL::FFmpegAudioStream::getNextPacket ( bool  loop) [private]
bool Sirikata::SDL::FFmpegAudioStream::openCodec ( ) [private]
void Sirikata::SDL::FFmpegAudioStream::samples ( int16 *  samples_out,
bool  loop 
)

Get the next samples from the stream, or fill them with silence if the stream has ended.

If the requested number of channels doesn't match, the conversion will be performed automatically.

Parameters:
samples_outoutput buffer for decoded samples. Always uses 16-bit signed values
loopif true, loops the track if the end is reached while decoding the requested samples

References decodeSome(), finished(), mConvertedData, mConvertedOffset, mConvertedSize, and mTargetChannels.


Friends And Related Function Documentation

friend class FFmpegStream [friend]

Member Data Documentation

Referenced by openCodec().

Referenced by convertFormat(), decodeSome(), and samples().

Referenced by convertFormat(), decodeSome(), and samples().

Referenced by decodeSome().

Referenced by decodeSome().

Referenced by finished(), and getNextPacket().

Referenced by getNextPacket(), and openCodec().

Referenced by getNextPacket(), and openCodec().

Referenced by convertFormat(), and samples().


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