Gnash  0.8.11dev
Public Types | Public Member Functions | Static Public Member Functions | List of all members
gnash::NetStream_as Class Reference

NetStream_as ActionScript class. More...

#include <NetStream_as.h>

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

Public Types

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

Public Member Functions

 NetStream_as (as_object *owner)
 Contruct a NetStream object. More...
 
 ~NetStream_as ()
 
PlayHead::PlaybackStatus playbackState () const
 
int videoHeight () const
 Get the real height of the video in pixels if the decoder exists. More...
 
int videoWidth () const
 Get the real width of the video in pixels if the decoder exists. More...
 
void close ()
 
void setAudioController (DisplayObject *controller)
 Make audio controlled by given DisplayObject. More...
 
void pause (PauseMode mode)
 Pauses/starts the playback of the media played by the current instance. More...
 
void play (const std::string &source)
 Starts the playback of the media. More...
 
void seek (std::uint32_t pos)
 Seek in the media played by the current instance. More...
 
std::int32_t time ()
 Tells where the playhead currently is. More...
 
void update ()
 
double getCurrentFPS ()
 Returns the current framerate in frames per second. More...
 
void setNetCon (NetConnection_as *nc)
 Sets the NetConnection needed to access external files. More...
 
bool isConnected () const
 Return true if the NetStream has an associated NetConnection. More...
 
void setBufferTime (std::uint32_t time)
 
std::uint32_t bufferTime ()
 
long bytesLoaded ()
 Returns the number of bytes of the media file that have been buffered. More...
 
long bytesTotal ()
 Returns the total number of bytes (size) of the media file. More...
 
long bufferLength ()
 
std::unique_ptr< image::GnashImageget_video ()
 Returns the video frame closest to current cursor. See time(). More...
 
void setInvalidatedVideo (DisplayObject *ch)
 Register the DisplayObject to invalidate on video updates. More...
 
virtual void markReachableResources () const
 Mark any reachable resources other than the owner. More...
 
- Public Member Functions inherited from gnash::ActiveRelay
 ActiveRelay (as_object *owner)
 
virtual ~ActiveRelay ()
 Make sure we are removed from the list of callbacks on destruction. More...
 
virtual void setReachable ()
 Mark any other reachable resources, and finally mark our owner. More...
 
virtual void clean ()
 Remove the ActiveRelay from movie_root's callback set. More...
 
as_objectowner () const
 Return the as_object that this Relay is attached to. More...
 
- Public Member Functions inherited from gnash::Relay
virtual ~Relay ()=0
 

Static Public Member Functions

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

Additional Inherited Members

Detailed Description

NetStream_as ActionScript class.

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

Member Enumeration Documentation

§ PauseMode

Enumerator
pauseModeToggle 
pauseModePause 
pauseModeUnPause 

Constructor & Destructor Documentation

§ NetStream_as()

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.

§ ~NetStream_as()

gnash::NetStream_as::~NetStream_as ( )

Member Function Documentation

§ audio_streamer()

static unsigned int gnash::NetStream_as::audio_streamer ( void *  udata,
std::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).

§ bufferLength()

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 gnash::BufferedAudioStreamer::cleanAudioQueue(), seek(), and update().

§ bufferTime()

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

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ bytesLoaded()

long gnash::NetStream_as::bytesLoaded ( )

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

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ bytesTotal()

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

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ close()

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 gnash::BufferedAudioStreamer::cleanAudioQueue(), and play().

§ get_video()

std::unique_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 unique_ptr if none were ready

References gnash::createObject(), gnash::getGlobal(), gnash::as_object::init_member(), gnash::key::o, and gnash::ActiveRelay::owner().

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

§ getCurrentFPS()

double gnash::NetStream_as::getCurrentFPS ( )
inline

Returns the current framerate in frames per second.

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ isConnected()

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

Return true if the NetStream has an associated NetConnection.

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ markReachableResources()

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::movie_root::addAdvanceCallback(), gnash::getRoot(), gnash::ActiveRelay::owner(), gnash::movie_root::removeAdvanceCallback(), gnash::GcResource::setReachable(), and gnash::ActiveRelay::setReachable().

§ pause()

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 _, gnash::PlayHead::getState(), gnash::log_debug(), pauseModePause, pauseModeToggle, pauseModeUnPause, and gnash::PlayHead::PLAY_PAUSED.

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ play()

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

§ playbackState()

PlayHead::PlaybackStatus gnash::NetStream_as::playbackState ( ) const
inline

References play, and source.

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

§ seek()

void gnash::NetStream_as::seek ( std::uint32_t  pos)

§ setAudioController()

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

Make audio controlled by given DisplayObject.

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

Referenced by gnash::registerMovieClipNative().

§ setBufferTime()

void gnash::NetStream_as::setBufferTime ( std::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().

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ setInvalidatedVideo()

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

Register the DisplayObject to invalidate on video updates.

References gnash::netstream_class_init(), gnash::registerNetStreamNative(), ts, test::uri, and url.

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

§ setNetCon()

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

Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().

§ time()

std::int32_t gnash::NetStream_as::time ( )

§ update()

void gnash::NetStream_as::update ( )
virtual

Called at the heart-beat frequency. 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 _, gnash::BufferedAudioStreamer::_audioQueue, gnash::BufferedAudioStreamer::_audioQueueMutex, gnash::PlayHead::advanceIfConsumed(), bufferLength(), gnash::PlayHead::getPosition(), gnash::PlayHead::getState(), gnash::log_debug(), gnash::ActiveRelay::owner(), gnash::PlayHead::PLAY_PAUSED, and gnash::PlayHead::seekTo().

§ videoHeight()

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().

§ videoWidth()

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: