Gnash
0.8.11dev
|
NetStream_as ActionScript class. More...
#include <NetStream_as.h>
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::GnashImage > | get_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... | |
![]() | |
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_object & | owner () const |
Return the as_object that this Relay is attached to. More... | |
![]() | |
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 |
NetStream_as ActionScript class.
This class is responsible for handlign external media files. Provides interfaces for playback control.
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 | ( | ) |
|
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
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue(), seek(), and update().
|
inline |
Returns what the buffer time has been set to. (100 milliseconds is default)
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
long gnash::NetStream_as::bytesLoaded | ( | ) |
Returns the number of bytes of the media file that have been buffered.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
long gnash::NetStream_as::bytesTotal | ( | ) |
Returns the total number of bytes (size) of the media file.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
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().
std::unique_ptr< image::GnashImage > gnash::NetStream_as::get_video | ( | ) |
Returns the video frame closest to current cursor. See time().
References gnash::createObject(), gnash::getGlobal(), gnash::as_object::init_member(), gnash::key::o, and gnash::ActiveRelay::owner().
Referenced by gnash::Video::display().
|
inline |
Returns the current framerate in frames per second.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
|
inline |
Return true if the NetStream has an associated NetConnection.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
|
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().
void gnash::NetStream_as::pause | ( | PauseMode | mode | ) |
Pauses/starts the playback of the media played by the current instance.
mode | Defines 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().
void gnash::NetStream_as::play | ( | const std::string & | source | ) |
Starts the playback of the media.
source | Defines what file to play |
References _, gnash::sound::adjustVolume(), gnash::BufferedAudioStreamer::attachAuxStreamer(), gnash::movie_root::callInterface(), close(), gnash::media::MediaHandler::createAudioDecoder(), gnash::media::MediaHandler::createMediaParser(), gnash::media::MediaHandler::createVideoDecoder(), gnash::key::e, gnash::getRoot(), gnash::NetConnection_as::getStream(), gnash::DisplayObject::getWorldVolume(), IF_VERBOSE_ASCODING_ERRORS, gnash::NetConnection_as::isConnected(), gnash::log_aserror(), gnash::log_debug(), gnash::log_error(), LOG_ONCE, gnash::log_security(), gnash::key::m, gnash::BufferedAudioStreamer::CursoredBuffer::m_data, gnash::BufferedAudioStreamer::CursoredBuffer::m_ptr, gnash::BufferedAudioStreamer::CursoredBuffer::m_size, gnash::HostMessage::NOTIFY_ERROR, gnash::ActiveRelay::owner(), gnash::PlayHead::PLAY_PLAYING, gnash::PlayHead::seekTo(), gnash::PlayHead::setAudioConsumerAvailable(), gnash::PlayHead::setState(), gnash::PlayHead::setVideoConsumerAvailable(), start, ts, and UNUSED.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
|
inline |
Referenced by gnash::Video::clear().
void gnash::NetStream_as::seek | ( | std::uint32_t | pos | ) |
Seek in the media played by the current instance.
pos | Defines in seconds where to seek to |
References _, gnash::BufferedAudioStreamer::_audioQueue, gnash::BufferedAudioStreamer::_audioQueueMutex, bufferLength(), gnash::BufferedAudioStreamer::cleanAudioQueue(), gnash::PlayHead::getPosition(), gnash::PlayHead::getState(), GNASH_REPORT_FUNCTION, gnash::PlayHead::isAudioConsumed(), gnash::PlayHead::isVideoConsumed(), gnash::log_debug(), gnash::log_error(), gnash::BufferedAudioStreamer::CursoredBuffer::m_size, gnash::PlayHead::PLAY_PAUSED, gnash::BufferedAudioStreamer::push(), gnash::PlayHead::seekTo(), gnash::DisplayObject::set_invalidated(), gnash::PlayHead::setAudioConsumed(), gnash::PlayHead::setVideoConsumed(), time(), and UNUSED.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
void gnash::NetStream_as::setAudioController | ( | DisplayObject * | controller | ) |
Make audio controlled by given DisplayObject.
References gnash::getRoot(), and gnash::ActiveRelay::owner().
Referenced by gnash::registerMovieClipNative().
void gnash::NetStream_as::setBufferTime | ( | std::uint32_t | time | ) |
Specifies the number of milliseconds to buffer before starting to display the stream.
time | The time in milliseconds that should be buffered. |
References time().
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
|
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().
|
inline |
Sets the NetConnection needed to access external files.
nc | The NetConnection object to use for network access |
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue().
std::int32_t gnash::NetStream_as::time | ( | ) |
Tells where the playhead currently is.
References gnash::BufferedAudioStreamer::attachAuxStreamer(), gnash::BufferedAudioStreamer::detachAuxStreamer(), gnash::PlayHead::getPosition(), GNASH_REPORT_FUNCTION, gnash::PlayHead::PLAY_PAUSED, gnash::PlayHead::PLAY_PLAYING, and gnash::PlayHead::setState().
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue(), seek(), and setBufferTime().
|
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().
int gnash::NetStream_as::videoHeight | ( | ) | const |
Get the real height of the video in pixels if the decoder exists.
Referenced by gnash::Video::height().
int gnash::NetStream_as::videoWidth | ( | ) | const |
Get the real width of the video in pixels if the decoder exists.
Referenced by gnash::Video::width().