Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GNASH_PLAYHEAD_H
00022 #define GNASH_PLAYHEAD_H
00023
00024 #include <boost/cstdint.hpp>
00025
00026
00027 namespace gnash {
00028 class VirtualClock;
00029 }
00030
00031 namespace gnash {
00032
00034 class PlayHead {
00035
00036 public:
00037
00039 enum PlaybackStatus {
00040 PLAY_PLAYING = 1,
00041 PLAY_PAUSED = 2
00042 };
00043
00046
00054 PlayHead(VirtualClock* clockSource);
00055
00057
00061 void setVideoConsumerAvailable()
00062 {
00063 _availableConsumers |= CONSUMER_VIDEO;
00064 }
00065
00067
00071 void setAudioConsumerAvailable()
00072 {
00073 _availableConsumers |= CONSUMER_AUDIO;
00074 }
00075
00077 boost::uint64_t getPosition() const { return _position; }
00078
00080 PlaybackStatus getState() const { return _state; }
00081
00083 PlaybackStatus setState(PlaybackStatus newState);
00084
00086 PlaybackStatus toggleState();
00087
00089 bool isVideoConsumed() const
00090 {
00091 return (_positionConsumers & CONSUMER_VIDEO);
00092 }
00093
00095 void setVideoConsumed()
00096 {
00097 _positionConsumers |= CONSUMER_VIDEO;
00098 }
00099
00101 bool isAudioConsumed() const
00102 {
00103 return (_positionConsumers & CONSUMER_AUDIO);
00104 }
00105
00107 void setAudioConsumed()
00108 {
00109 _positionConsumers |= CONSUMER_AUDIO;
00110 }
00111
00113
00124 void seekTo(boost::uint64_t position);
00125
00127
00137 void advanceIfConsumed();
00138
00139
00140 private:
00141
00143 enum ConsumerFlag {
00144 CONSUMER_VIDEO = 1,
00145 CONSUMER_AUDIO = 2
00146 };
00147
00149 boost::uint64_t _position;
00150
00152 PlaybackStatus _state;
00153
00156 int _availableConsumers;
00157
00160 int _positionConsumers;
00161
00163 VirtualClock* _clockSource;
00164
00167
00169 boost::uint64_t _clockOffset;
00170
00171 };
00172
00173 }
00174
00175
00176 #endif
00177