Gnash  0.8.10
Public Member Functions | Protected Member Functions
gnash::media::MediaHandler Class Reference

The MediaHandler class acts as a factory to provide parser and decoders. More...

#include <MediaHandler.h>

Inheritance diagram for gnash::media::MediaHandler:
gnash::media::ffmpeg::MediaHandlerFfmpeg gnash::media::gst::MediaHandlerGst gnash::media::haiku::MediaHandlerHaiku

List of all members.

Public Member Functions

virtual ~MediaHandler ()
virtual std::string description () const =0
 Return a description of this media handler.
virtual std::auto_ptr
< MediaParser
createMediaParser (std::auto_ptr< IOChannel > stream)
 Return an appropriate MediaParser for given input.
virtual std::auto_ptr
< VideoDecoder
createVideoDecoder (const VideoInfo &info)=0
 Create a VideoDecoder for decoding what's specified in the VideoInfo.
virtual std::auto_ptr
< AudioDecoder
createAudioDecoder (const AudioInfo &info)=0
 Create an AudioDecoder for decoding what's specified in the AudioInfo.
virtual std::auto_ptr
< VideoConverter
createVideoConverter (ImgBuf::Type4CC srcFormat, ImgBuf::Type4CC dstFormat)=0
 Create an VideoConverter for converting between color spaces.
virtual VideoInputgetVideoInput (size_t index)=0
 Return a VideoInput.
virtual AudioInputgetAudioInput (size_t index)=0
virtual void cameraNames (std::vector< std::string > &names) const =0
 Return a list of available cameras.
virtual size_t getInputPaddingSize () const
 Return the number of bytes padding needed for input buffers.

Protected Member Functions

 MediaHandler ()
 Base constructor.
std::auto_ptr< AudioDecodercreateFlashAudioDecoder (const AudioInfo &info)
 Create an AudioDecoder for CODEC_TYPE_FLASH codecs.
bool isFLV (IOChannel &stream)
 Return true if input stream is an FLV.

Detailed Description

The MediaHandler class acts as a factory to provide parser and decoders.


Constructor & Destructor Documentation

virtual gnash::media::MediaHandler::~MediaHandler ( ) [inline, virtual]
gnash::media::MediaHandler::MediaHandler ( ) [inline, protected]

Base constructor.

This is an abstract base class, so not instantiable anyway.


Member Function Documentation

virtual void gnash::media::MediaHandler::cameraNames ( std::vector< std::string > &  names) const [pure virtual]

Return a list of available cameras.

This is re-generated every time the function is called.

Implemented in gnash::media::haiku::MediaHandlerHaiku, gnash::media::ffmpeg::MediaHandlerFfmpeg, and gnash::media::gst::MediaHandlerGst.

virtual std::auto_ptr<AudioDecoder> gnash::media::MediaHandler::createAudioDecoder ( const AudioInfo info) [pure virtual]

Create an AudioDecoder for decoding what's specified in the AudioInfo.

Parameters:
infoAudioInfo class with all the info needed to decode the sound correctly.
Returns:
Will always return a valid AudioDecoder or throw a gnash::MediaException if a fatal error occurs.

Implemented in gnash::media::haiku::MediaHandlerHaiku, gnash::media::ffmpeg::MediaHandlerFfmpeg, and gnash::media::gst::MediaHandlerGst.

std::auto_ptr< AudioDecoder > gnash::media::MediaHandler::createFlashAudioDecoder ( const AudioInfo info) [protected]

Create an AudioDecoder for CODEC_TYPE_FLASH codecs.

This method is attempted as a fallback in case a mediahandler-specific audio decoder couldn't be created for a CODEC_TYPE_FLASH codec.

Exceptions:
aMediaException if it can't create a decoder
Parameters:
infoInformations about the audio. It is *required* for info.type to be media::CODEC_TYPE_FLASH (caller should check that before calling this).

References assert, gnash::media::AudioInfo::type, gnash::media::CODEC_TYPE_FLASH, gnash::media::AudioInfo::codec, gnash::media::AUDIO_CODEC_ADPCM, gnash::media::AUDIO_CODEC_RAW, gnash::media::AUDIO_CODEC_UNCOMPRESSED, gnash::media::AUDIO_CODEC_SPEEX, and _.

Referenced by gnash::media::ffmpeg::MediaHandlerFfmpeg::createAudioDecoder(), gnash::media::gst::MediaHandlerGst::createAudioDecoder(), and gnash::media::haiku::MediaHandlerHaiku::createAudioDecoder().

std::auto_ptr< MediaParser > gnash::media::MediaHandler::createMediaParser ( std::auto_ptr< IOChannel stream) [virtual]

Return an appropriate MediaParser for given input.

Parameters:
streamInput stream, ownership transferred
Returns:
0 if no parser could be created for the input

NOTE: the default implementation returns an FLVParser for FLV input or 0 for others.

Reimplemented in gnash::media::haiku::MediaHandlerHaiku, gnash::media::ffmpeg::MediaHandlerFfmpeg, and gnash::media::gst::MediaHandlerGst.

References isFLV(), _, gnash::key::m, and assert.

virtual std::auto_ptr<VideoConverter> gnash::media::MediaHandler::createVideoConverter ( ImgBuf::Type4CC  srcFormat,
ImgBuf::Type4CC  dstFormat 
) [pure virtual]

Create an VideoConverter for converting between color spaces.

Parameters:
srcFormatThe source image color space
dstFormatThe destination image color space
Returns:
A valid VideoConverter or a NULL auto_ptr if a fatal error occurs.

Implemented in gnash::media::gst::MediaHandlerGst, gnash::media::haiku::MediaHandlerHaiku, and gnash::media::ffmpeg::MediaHandlerFfmpeg.

virtual std::auto_ptr<VideoDecoder> gnash::media::MediaHandler::createVideoDecoder ( const VideoInfo info) [pure virtual]

Create a VideoDecoder for decoding what's specified in the VideoInfo.

Parameters:
infoVideoInfo class with all the info needed to decode the image stream correctly.
Returns:
Will always return a valid VideoDecoder or throw a gnash::MediaException if a fatal error occurs.

Implemented in gnash::media::haiku::MediaHandlerHaiku, gnash::media::ffmpeg::MediaHandlerFfmpeg, and gnash::media::gst::MediaHandlerGst.

Referenced by gnash::Video::Video().

virtual std::string gnash::media::MediaHandler::description ( ) const [pure virtual]
virtual AudioInput* gnash::media::MediaHandler::getAudioInput ( size_t  index) [pure virtual]
virtual size_t gnash::media::MediaHandler::getInputPaddingSize ( ) const [inline, virtual]

Return the number of bytes padding needed for input buffers.

Bitstream readers are optimized to read several bytes at a time, and this should be used to allocate a large enough input buffer.

Reimplemented in gnash::media::ffmpeg::MediaHandlerFfmpeg.

Referenced by gnash::SWF::StreamSoundBlockTag::loader(), and gnash::SWF::define_sound_loader().

virtual VideoInput* gnash::media::MediaHandler::getVideoInput ( size_t  index) [pure virtual]

Return a VideoInput.

This is always owned by the MediaHandler, but will remain alive as long as it is referenced by a Camera object.

Parameters:
indexThe index of the VideoInput to return.
Returns:
A Video Input corresponding to the specified index or null if it is not available.

Implemented in gnash::media::haiku::MediaHandlerHaiku, gnash::media::ffmpeg::MediaHandlerFfmpeg, and gnash::media::gst::MediaHandlerGst.

bool gnash::media::MediaHandler::isFLV ( IOChannel stream) [protected]

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