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:
Inheritance graph
[legend]

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 FLASH codecs.
bool isFLV (IOChannel &stream) throw (IOException)
 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::ffmpeg::MediaHandlerFfmpeg, gnash::media::gst::MediaHandlerGst, and gnash::media::haiku::MediaHandlerHaiku.

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:
info AudioInfo 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::ffmpeg::MediaHandlerFfmpeg, gnash::media::gst::MediaHandlerGst, and gnash::media::haiku::MediaHandlerHaiku.

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

Create an AudioDecoder for FLASH codecs.

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

Exceptions:
a MediaException if it can't create a decoder
Parameters:
info Informations about the audio. It is *required* for info.type to be media::FLASH (caller should check that before calling this).
std::auto_ptr< MediaParser > gnash::media::MediaHandler::createMediaParser ( std::auto_ptr< IOChannel stream  )  [virtual]

Return an appropriate MediaParser for given input.

Parameters:
stream Input 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::ffmpeg::MediaHandlerFfmpeg, gnash::media::gst::MediaHandlerGst, and gnash::media::haiku::MediaHandlerHaiku.

References _.

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:
srcFormat The source image color space
dstFormat The destination image color space
Returns:
A valid VideoConverter or a NULL auto_ptr if a fatal error occurs.

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

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:
info VideoInfo 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::ffmpeg::MediaHandlerFfmpeg, gnash::media::gst::MediaHandlerGst, and gnash::media::haiku::MediaHandlerHaiku.

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::sound::sound_handler::create_sound().

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:
index The 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::ffmpeg::MediaHandlerFfmpeg, gnash::media::gst::MediaHandlerGst, and gnash::media::haiku::MediaHandlerHaiku.

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

Return true if input stream is an FLV.

If this cannot read the necessary 3 bytes, it throws an IOException.

References gnash::IOChannel::read(), and gnash::IOChannel::seek().

Referenced by gnash::media::haiku::MediaHandlerHaiku::createMediaParser(), and gnash::media::gst::MediaHandlerGst::createMediaParser().


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