Gnash  0.8.11dev
Public Member Functions | Protected Member Functions | List of all members
gnash::media::MediaHandler Class Referenceabstract

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

Public Member Functions

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

Protected Member Functions

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

Detailed Description

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

Constructor & Destructor Documentation

◆ ~MediaHandler()

virtual gnash::media::MediaHandler::~MediaHandler ( )
inlinevirtual

References names.

◆ MediaHandler()

gnash::media::MediaHandler::MediaHandler ( )
inlineprotected

Base constructor.

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

Member Function Documentation

◆ cameraNames()

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.

◆ createAudioDecoder()

virtual std::unique_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.

Referenced by gnash::sound::LiveSound::LiveSound(), and gnash::NetStream_as::play().

◆ createFlashAudioDecoder()

std::unique_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 _, gnash::media::AUDIO_CODEC_ADPCM, gnash::media::AUDIO_CODEC_RAW, gnash::media::AUDIO_CODEC_SPEEX, gnash::media::AUDIO_CODEC_UNCOMPRESSED, gnash::media::AudioInfo::codec, gnash::media::CODEC_TYPE_FLASH, and gnash::media::AudioInfo::type.

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

◆ createMediaParser()

std::unique_ptr< MediaParser > gnash::media::MediaHandler::createMediaParser ( std::unique_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::ffmpeg::MediaHandlerFfmpeg, and gnash::media::gst::MediaHandlerGst.

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

Referenced by gnash::NetStream_as::play().

◆ createVideoConverter()

virtual std::unique_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 unique_ptr if a fatal error occurs.

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

◆ createVideoDecoder()

virtual std::unique_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::NetStream_as::play().

◆ description()

virtual std::string gnash::media::MediaHandler::description ( ) const
pure virtual

◆ getAudioInput()

virtual AudioInput* gnash::media::MediaHandler::getAudioInput ( size_t  index)
pure virtual

◆ getInputPaddingSize()

virtual size_t gnash::media::MediaHandler::getInputPaddingSize ( ) const
inlinevirtual

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::define_sound_loader(), and gnash::SWF::StreamSoundBlockTag::loader().

◆ getVideoInput()

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.

◆ isFLV()

bool gnash::media::MediaHandler::isFLV ( IOChannel &  stream)
protected

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