Gnash
0.8.11dev
|
The playback controller. More...
#include <PlayHead.h>
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. |
The playback controller.
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.
clockSource | The VirtualClock to use as time source. Ownership left to caller (not necessarely a good thing). |
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().
|
inline |
Get current playhead position (milliseconds)
Referenced by gnash::NetStream_as::time(), and gnash::NetStream_as::update().
|
inline |
Get current playback state.
Referenced by gnash::NetStream_as::pause(), gnash::NetStream_as::playbackState(), and gnash::NetStream_as::update().
|
inline |
Return true if audio of current position have been consumed.
|
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.
position | Position timestamp (milliseconds) |
POSTCONDITIONS:
References assert, gnash::VirtualClock::elapsed(), and position.
Referenced by gnash::NetStream_as::seek(), and gnash::NetStream_as::update().
|
inline |
Mark current position as being consumed by audio consumer.
|
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 assert, gnash::VirtualClock::elapsed(), PLAY_PAUSED, and PLAY_PLAYING.
Referenced by toggleState().
|
inline |
Mark current position as being consumed by video consumer.
|
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, PLAY_PLAYING, and setState().