Gnash  0.8.11dev
Public Member Functions | List of all members
gnash::media::ffmpeg::MediaParserFfmpeg Class Reference

FFMPEG based MediaParser. More...

#include <MediaParserFfmpeg.h>

Inheritance diagram for gnash::media::ffmpeg::MediaParserFfmpeg:
gnash::media::MediaParser

Public Member Functions

 MediaParserFfmpeg (std::auto_ptr< IOChannel > stream)
 Construct a ffmpeg-based media parser for given stream.
 ~MediaParserFfmpeg ()
virtual bool seek (boost::uint32_t &)
 Seeks to the closest possible position the given position, and returns the new position.
virtual bool parseNextChunk ()
 Parse next chunk of input.
virtual boost::uint64_t getBytesLoaded () const
 Return number of bytes parsed so far.
virtual boost::optional< Id3InfogetId3Info () const
 Get ID3 data from the parsed stream if it exists.
- Public Member Functions inherited from gnash::media::MediaParser
 MediaParser (std::auto_ptr< IOChannel > stream)
virtual ~MediaParser ()
DSOEXPORT boost::uint64_t getBufferLength () const
 Returns mininum length of available buffers in milliseconds.
DSOEXPORT bool isBufferEmpty () const
 Return true if both audio and video buffers are empty.
DSOEXPORT boost::uint64_t getBufferTime () const
 Return the time we want the parser thread to maintain in the buffer.
DSOEXPORT void setBufferTime (boost::uint64_t t)
 Set the time we want the parser thread to maintain in the buffer.
DSOEXPORT bool nextFrameTimestamp (boost::uint64_t &ts) const
 Get timestamp of the next frame available, if any.
DSOEXPORT bool nextVideoFrameTimestamp (boost::uint64_t &ts) const
 Get timestamp of the video frame which would be returned on nextVideoFrame.
DSOEXPORT std::auto_ptr
< EncodedVideoFrame
nextVideoFrame ()
 Returns the next video frame in the parsed buffer, advancing video cursor.
DSOEXPORT bool nextAudioFrameTimestamp (boost::uint64_t &ts) const
 Get timestamp of the audio frame which would be returned on nextAudioFrame.
DSOEXPORT std::auto_ptr
< EncodedAudioFrame
nextAudioFrame ()
 Returns the next audio frame in the parsed buffer, advancing audio cursor.
VideoInfogetVideoInfo ()
 Returns a VideoInfo class about the videostream.
AudioInfogetAudioInfo ()
 Returns a AudioInfo class about the audiostream.
bool parsingCompleted () const
 Return true of parsing is completed.
virtual bool indexingCompleted () const
 Return true of indexing is completed.
boost::uint64_t getBytesTotal () const
 Return total number of bytes in input.
virtual void fetchMetaTags (OrderedMetaTags &tags, boost::uint64_t ts)
 Retrieve any parsed metadata tags up to a specified timestamp.

Additional Inherited Members

- Public Types inherited from gnash::media::MediaParser
typedef std::multimap
< boost::uint64_t,
boost::shared_ptr
< SimpleBuffer > > 
MetaTags
 A container for executable MetaTags contained in media streams.
typedef std::vector
< MetaTags::mapped_type > 
OrderedMetaTags
- Protected Member Functions inherited from gnash::media::MediaParser
void startParserThread ()
 }@
void stopParserThread ()
 Stop the parser thread.
void clearBuffers ()
 Clear the a/v buffers.
void pushEncodedAudioFrame (std::auto_ptr< EncodedAudioFrame > frame)
 Push an encoded audio frame to buffer.
void pushEncodedVideoFrame (std::auto_ptr< EncodedVideoFrame > frame)
 Push an encoded video frame to buffer.
void parserLoop ()
bool parserThreadKillRequested () const
void waitIfNeeded (boost::mutex::scoped_lock &qMutexLock)
void wakeupParserThread ()
bool bufferFull () const
 Method to check if buffer is full w/out locking the _qMutex.
- Static Protected Member Functions inherited from gnash::media::MediaParser
static void parserLoopStarter (MediaParser *mp)
- Protected Attributes inherited from gnash::media::MediaParser
std::auto_ptr< VideoInfo_videoInfo
 Subclasses must set the following variables:
std::auto_ptr< AudioInfo_audioInfo
 Info about the audio stream (if any)
bool _parsingComplete
 Whether the parsing is complete or not.
boost::uint64_t _bytesLoaded
 Number of bytes loaded.
std::auto_ptr< IOChannel_stream
 The stream used to access the file.
boost::mutex _streamMutex
boost::uint64_t _bufferTime
boost::mutex _bufferTimeMutex
std::auto_ptr< boost::thread > _parserThread
boost::barrier _parserThreadStartBarrier
boost::mutex _parserThreadKillRequestMutex
bool _parserThreadKillRequested
boost::condition _parserThreadWakeup
boost::mutex _qMutex
 mutex protecting access to the a/v encoded frames queues
boost::mutex _bytesLoadedMutex
 Mutex protecting _bytesLoaded (read by main, set by parser)
bool _seekRequest

Detailed Description

FFMPEG based MediaParser.

Constructor & Destructor Documentation

gnash::media::ffmpeg::MediaParserFfmpeg::MediaParserFfmpeg ( std::auto_ptr< IOChannel stream)

Construct a ffmpeg-based media parser for given stream.

Can throw a GnashException if input format couldn't be detected

References gnash::media::MediaParser::startParserThread().

gnash::media::ffmpeg::MediaParserFfmpeg::~MediaParserFfmpeg ( )

Member Function Documentation

boost::uint64_t gnash::media::ffmpeg::MediaParserFfmpeg::getBytesLoaded ( ) const
virtual

Return number of bytes parsed so far.

Reimplemented from gnash::media::MediaParser.

boost::optional< Id3Info > gnash::media::ffmpeg::MediaParserFfmpeg::getId3Info ( ) const
virtual

Get ID3 data from the parsed stream if it exists.

It's best to do this only when parsingComplete is true.

Reimplemented from gnash::media::MediaParser.

bool gnash::media::ffmpeg::MediaParserFfmpeg::parseNextChunk ( )
virtual

Parse next chunk of input.

The implementations are required to parse a small chunk of input, so to avoid blocking too much if parsing conditions change (ie: seek or destruction requested)

When LOAD_MEDIA_IN_A_SEPARATE_THREAD is defined, this should never be called by users (consider protected).

Implements gnash::media::MediaParser.

bool gnash::media::ffmpeg::MediaParserFfmpeg::seek ( boost::uint32_t &  time)
virtual

Seeks to the closest possible position the given position, and returns the new position.

Parameters
timeinput/output parameter, input requests a time, output return the actual time seeked to.
Returns
true if the seek was valid, false otherwise.

Implements gnash::media::MediaParser.

References _, __FUNCTION__, gnash::media::MediaParser::_parsingComplete, gnash::media::MediaParser::_streamMutex, and gnash::media::MediaParser::clearBuffers().


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