Gnash  0.8.10
Public Types | Public Member Functions | Static Public Member Functions
gnash::NetStream_as Class Reference

NetStream_as ActionScript class. More...

#include <NetStream_as.h>

Inheritance diagram for gnash::NetStream_as:
gnash::ActiveRelay gnash::Relay

List of all members.

Public Types

enum  PauseMode { pauseModeToggle = -1, pauseModePause = 0, pauseModeUnPause = 1 }

Public Member Functions

 NetStream_as (as_object *owner)
 Contruct a NetStream object.
 ~NetStream_as ()
PlayHead::PlaybackStatus playbackState () const
int videoHeight () const
 Get the real height of the video in pixels if the decoder exists.
int videoWidth () const
 Get the real width of the video in pixels if the decoder exists.
void close ()
void setAudioController (DisplayObject *controller)
 Make audio controlled by given DisplayObject.
void pause (PauseMode mode)
 Pauses/starts the playback of the media played by the current instance.
void play (const std::string &source)
 Starts the playback of the media.
void seek (boost::uint32_t pos)
 Seek in the media played by the current instance.
boost::int32_t time ()
 Tells where the playhead currently is.
void update ()
double getCurrentFPS ()
 Returns the current framerate in frames per second.
void setNetCon (NetConnection_as *nc)
 Sets the NetConnection needed to access external files.
bool isConnected () const
 Return true if the NetStream has an associated NetConnection.
void setBufferTime (boost::uint32_t time)
boost::uint32_t bufferTime ()
long bytesLoaded ()
 Returns the number of bytes of the media file that have been buffered.
long bytesTotal ()
 Returns the total number of bytes (size) of the media file.
long bufferLength ()
std::auto_ptr< image::GnashImageget_video ()
 Returns the video frame closest to current cursor. See time().
void setInvalidatedVideo (DisplayObject *ch)
 Register the DisplayObject to invalidate on video updates.
virtual void markReachableResources () const
 Mark any reachable resources other than the owner.

Static Public Member Functions

static unsigned int audio_streamer (void *udata, boost::int16_t *samples, unsigned int nSamples, bool &eof)
 Callback used by sound_handler to get audio data.

Detailed Description

NetStream_as ActionScript class.

This class is responsible for handlign external media files. Provides interfaces for playback control.


Member Enumeration Documentation

Enumerator:
pauseModeToggle 
pauseModePause 
pauseModeUnPause 

Constructor & Destructor Documentation

gnash::NetStream_as::NetStream_as ( as_object owner)

Contruct a NetStream object.

The default size needed to begin playback (_bufferTime) of media is 100 milliseconds.

gnash::NetStream_as::~NetStream_as ( )

Member Function Documentation

static unsigned int gnash::NetStream_as::audio_streamer ( void *  udata,
boost::int16_t *  samples,
unsigned int  nSamples,
bool &  eof 
) [static]

Callback used by sound_handler to get audio data.

This is a sound_handler::aux_streamer_ptr type.

It might be invoked by a separate thread (neither main, nor decoder thread).

long gnash::NetStream_as::bufferLength ( )

Returns the number of millisecond of the media file that is buffered and yet to be played

Returns:
Returns the number of millisecond of the media file that is buffered and yet to be played

Referenced by update().

boost::uint32_t gnash::NetStream_as::bufferTime ( ) [inline]

Returns what the buffer time has been set to. (100 milliseconds is default)

Returns:
The size of the buffer in milliseconds.
long gnash::NetStream_as::bytesLoaded ( )

Returns the number of bytes of the media file that have been buffered.

long gnash::NetStream_as::bytesTotal ( )

Returns the total number of bytes (size) of the media file.

Returns:
the total number of bytes (size) of the media file
void gnash::NetStream_as::close ( )

Closes the video session and frees all ressources used for decoding except the FLV-parser (this might not be correct).

References gnash::BufferedAudioStreamer::cleanAudioQueue(), and gnash::BufferedAudioStreamer::detachAuxStreamer().

Referenced by play().

std::auto_ptr< image::GnashImage > gnash::NetStream_as::get_video ( )

Returns the video frame closest to current cursor. See time().

Returns:
a image containing the video frame, a NULL auto_ptr if none were ready
double gnash::NetStream_as::getCurrentFPS ( ) [inline]

Returns the current framerate in frames per second.

bool gnash::NetStream_as::isConnected ( ) const [inline]

Return true if the NetStream has an associated NetConnection.

void gnash::NetStream_as::markReachableResources ( ) const [virtual]

Mark any reachable resources other than the owner.

Override this function if the subclass holds references to GC resources other than the owner.

Reimplemented from gnash::ActiveRelay.

References gnash::ActiveRelay::setReachable(), and gnash::GcResource::setReachable().

void gnash::NetStream_as::pause ( PauseMode  mode)

Pauses/starts the playback of the media played by the current instance.

Parameters:
modeDefines what mode to put the instance in.

References _, pauseModeToggle, gnash::PlayHead::getState(), pauseModePause, and pauseModeUnPause.

void gnash::NetStream_as::play ( const std::string &  source)

Starts the playback of the media.

Parameters:
sourceDefines what file to play

References IF_VERBOSE_ASCODING_ERRORS, _, gnash::NetConnection_as::isConnected(), close(), gnash::NetConnection_as::getStream(), and gnash::BufferedAudioStreamer::attachAuxStreamer().

PlayHead::PlaybackStatus gnash::NetStream_as::playbackState ( ) const [inline]
void gnash::NetStream_as::seek ( boost::uint32_t  pos)

Seek in the media played by the current instance.

Parameters:
posDefines in seconds where to seek to
Todo:
take milliseconds !!

References GNASH_REPORT_FUNCTION, _, gnash::BufferedAudioStreamer::cleanAudioQueue(), and gnash::PlayHead::seekTo().

void gnash::NetStream_as::setAudioController ( DisplayObject controller)

Make audio controlled by given DisplayObject.

References gnash::getRoot(), and gnash::ActiveRelay::owner().

void gnash::NetStream_as::setBufferTime ( boost::uint32_t  time)

Specifies the number of milliseconds to buffer before starting to display the stream.

Parameters:
timeThe time in milliseconds that should be buffered.

References time().

void gnash::NetStream_as::setInvalidatedVideo ( DisplayObject ch) [inline]

Register the DisplayObject to invalidate on video updates.

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

void gnash::NetStream_as::setNetCon ( NetConnection_as nc) [inline]

Sets the NetConnection needed to access external files.

Parameters:
ncThe NetConnection object to use for network access
boost::int32_t gnash::NetStream_as::time ( )

Tells where the playhead currently is.

Returns:
The time in milliseconds of the current playhead position

References gnash::PlayHead::getPosition().

Referenced by setBufferTime().

void gnash::NetStream_as::update ( ) [virtual]

Called at the SWF heart-beat. Used to process queued status messages and (re)start after a buffering pause. In NetStreamFfmpeg it is also used to find the next video frame to be shown, though this might change.

Implements gnash::ActiveRelay.

References bufferLength(), _, gnash::PlayHead::getPosition(), gnash::PlayHead::getState(), gnash::PlayHead::seekTo(), gnash::PlayHead::advanceIfConsumed(), gnash::BufferedAudioStreamer::_audioQueueMutex, gnash::BufferedAudioStreamer::_audioQueue, gnash::key::i, gnash::key::e, and gnash::ActiveRelay::owner().

int gnash::NetStream_as::videoHeight ( ) const

Get the real height of the video in pixels if the decoder exists.

Returns:
the height of the video in pixels or 0 if no decoder exists. The width returned from the decoder may also vary, and will be 0 until it knows the width.

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

int gnash::NetStream_as::videoWidth ( ) const

Get the real width of the video in pixels if the decoder exists.

Returns:
the width of the video in pixels or 0 if no decoder exists. The width returned from the decoder may also vary, and will be 0 until it knows the width.

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


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