OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 #ifndef CHROMECAST_PUBLIC_MEDIA_MEDIA_CLOCK_DEVICE_H_ | |
6 #define CHROMECAST_PUBLIC_MEDIA_MEDIA_CLOCK_DEVICE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 namespace chromecast { | |
11 namespace media { | |
12 | |
13 // Interface for platform-specific pipeline clock. | |
14 // Pipeline clocks follow this state machine: | |
15 // ------------------- | |
16 // | | | |
17 // v | | |
18 // kUninitialized --> kIdle --------- kRunning | |
19 // | |
20 // {any state} --> kError | |
21 // | |
22 // Notes: | |
23 // - Hardware resources should be acquired when transitioning from the | |
24 // |kUninitialized| state to the |kIdle| state. | |
25 // - The initial value of the timeline will only be set in the kIdle state. | |
26 class MediaClockDevice { | |
27 public: | |
28 enum State { | |
29 kStateUninitialized, | |
30 kStateIdle, | |
31 kStateRunning, | |
32 kStateError, | |
33 }; | |
34 | |
35 virtual ~MediaClockDevice() {} | |
36 | |
37 // Returns the current state of the media clock. | |
38 virtual State GetState() const = 0; | |
39 | |
40 // Changes the state and performs any necessary transitions. | |
41 // Returns true when successful. | |
42 virtual bool SetState(State new_state) = 0; | |
43 | |
44 // Sets the initial value of the timeline in microseconds. | |
45 // Will only be invoked in state kStateIdle. | |
46 // Returns true when successful. | |
47 virtual bool ResetTimeline(int64_t time_microseconds) = 0; | |
48 | |
49 // Sets the clock rate. | |
50 // |rate| == 0 means the clock is not progressing and that the renderer | |
51 // tied to this media clock should pause rendering. | |
52 // Will only be invoked in states kStateIdle or kStateRunning. | |
53 virtual bool SetRate(float rate) = 0; | |
54 | |
55 // Retrieves the media clock time in microseconds. | |
56 // Will only be invoked in states kStateIdle or kStateRunning. | |
57 virtual int64_t GetTime() = 0; | |
servolk
2015/07/30 17:50:29
Now that it returns just int64_t, let's rename it
halliwell
2015/07/30 18:20:18
Done.
| |
58 }; | |
59 | |
60 } // namespace media | |
61 } // namespace chromecast | |
62 | |
63 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_CLOCK_DEVICE_H_ | |
OLD | NEW |