| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // A clock represent a single source of time to allow audio and video streams |
| 6 // to synchronize with each other. Clocks essentially track the media time with |
| 7 // respect to some other source of time, whether that may be the system clock, |
| 8 // audio hardware or some other OS-level API. |
| 9 // |
| 10 // Clocks start off paused with a playback rate of 1.0f and a media time of 0. |
| 11 // |
| 12 // TODO(scherkus): Clocks will some day be responsible for executing callbacks |
| 13 // given a media time. This will be used primarily by video renderers. For now |
| 14 // we'll keep using a poll-and-sleep solution. |
| 15 |
| 16 #ifndef MEDIA_BASE_CLOCK_H_ |
| 17 #define MEDIA_BASE_CLOCK_H_ |
| 18 |
| 19 #include "base/time.h" |
| 20 |
| 21 namespace media { |
| 22 |
| 23 class Clock { |
| 24 public: |
| 25 // Starts the clock and returns the current media time, which will increase |
| 26 // with respect to the current playback rate. |
| 27 virtual base::TimeDelta Play() = 0; |
| 28 |
| 29 // Stops the clock and returns the current media time, which will remain |
| 30 // constant until Play() is called. |
| 31 virtual base::TimeDelta Pause() = 0; |
| 32 |
| 33 // Sets a new playback rate. The rate at which the media time will increase |
| 34 // will now change. |
| 35 virtual void SetPlaybackRate(float playback_rate) = 0; |
| 36 |
| 37 // Forcefully sets the media time to the given time. This should only be used |
| 38 // where a discontinuity in the media is found (i.e., seeking). |
| 39 virtual void SetTime(const base::TimeDelta& time) = 0; |
| 40 |
| 41 // Returns the current elapsed media time. |
| 42 virtual base::TimeDelta Elapsed() const = 0; |
| 43 }; |
| 44 |
| 45 } // namespace media |
| 46 |
| 47 #endif // MEDIA_BASE_CLOCK_H_ |
| OLD | NEW |