Gnash  0.8.10
Public Types | Public Member Functions
gnash::PlayHead Class Reference

The playback controller. More...

#include <PlayHead.h>

List of all members.

Public Types

enum  PlaybackStatus { PLAY_PLAYING = 1, PLAY_PAUSED = 2 }
 Flags for playback state. More...

Public Member Functions

 PlayHead (VirtualClock *clockSource)
void setVideoConsumerAvailable ()
 Set a video consumer as available.
void setAudioConsumerAvailable ()
 Set an audio consumer as available.
boost::uint64_t getPosition () const
 Get current playhead position (milliseconds)
PlaybackStatus getState () const
 Get current playback state.
PlaybackStatus setState (PlaybackStatus newState)
 Set playback state, returning old state.
PlaybackStatus toggleState ()
 Toggle playback state, returning old state.
bool isVideoConsumed () const
 Return true if video of current position have been consumed.
void setVideoConsumed ()
 Mark current position as being consumed by video consumer.
bool isAudioConsumed () const
 Return true if audio of current position have been consumed.
void setAudioConsumed ()
 Mark current position as being consumed by audio consumer.
void seekTo (boost::uint64_t position)
 Change current position to the given time.
void advanceIfConsumed ()
 Advance position if all available consumers consumed the current one.

Detailed Description

The playback controller.


Member Enumeration Documentation

Flags for playback state.

Enumerator:
PLAY_PLAYING 
PLAY_PAUSED 

Constructor & Destructor Documentation

gnash::PlayHead::PlayHead ( VirtualClock clockSource)

Initialize playhead given a VirtualCock to use as clock source. The PlayHead will have initial state set to PAUSED and initial position set to 0.

Parameters:
clockSourceThe VirtualClock to use as time source. Ownership left to caller (not necessarely a good thing).

Member Function Documentation

void gnash::PlayHead::advanceIfConsumed ( )

Advance position if all available consumers consumed the current one.

Clock source will be used to determine the amount of milliseconds to advance position to.

Consumer flags will be reset.

POSTCONDITIONS:

References gnash::VirtualClock::elapsed().

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

boost::uint64_t gnash::PlayHead::getPosition ( ) const [inline]

Get current playhead position (milliseconds)

Referenced by gnash::NetStream_as::update(), and gnash::NetStream_as::time().

PlaybackStatus gnash::PlayHead::getState ( ) const [inline]
bool gnash::PlayHead::isAudioConsumed ( ) const [inline]

Return true if audio of current position have been consumed.

bool gnash::PlayHead::isVideoConsumed ( ) const [inline]

Return true if video of current position have been consumed.

void gnash::PlayHead::seekTo ( boost::uint64_t  position)

Change current position to the given time.

Consume flag will be reset.

Parameters:
positionPosition timestamp (milliseconds)

POSTCONDITIONS:

References gnash::VirtualClock::elapsed(), position, and assert.

Referenced by gnash::NetStream_as::seek(), and gnash::NetStream_as::update().

void gnash::PlayHead::setAudioConsumed ( ) [inline]

Mark current position as being consumed by audio consumer.

void gnash::PlayHead::setAudioConsumerAvailable ( ) [inline]

Set an audio consumer as available.

This should be completely fine to do during PlayHead lifetime.

PlayHead::PlaybackStatus gnash::PlayHead::setState ( PlaybackStatus  newState)

Set playback state, returning old state.

References PLAY_PAUSED, assert, PLAY_PLAYING, and gnash::VirtualClock::elapsed().

Referenced by toggleState().

void gnash::PlayHead::setVideoConsumed ( ) [inline]

Mark current position as being consumed by video consumer.

void gnash::PlayHead::setVideoConsumerAvailable ( ) [inline]

Set a video consumer as available.

This should be completely fine to do during PlayHead lifetime.

PlayHead::PlaybackStatus gnash::PlayHead::toggleState ( )

Toggle playback state, returning old state.

References PLAY_PAUSED, setState(), and PLAY_PLAYING.


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