OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_VIDEO_STREAM_H_ | 5 #ifndef REMOTING_PROTOCOL_VIDEO_STREAM_H_ |
6 #define REMOTING_PROTOCOL_VIDEO_STREAM_H_ | 6 #define REMOTING_PROTOCOL_VIDEO_STREAM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cstdint> | 10 #include <cstdint> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 | 13 |
14 namespace webrtc { | 14 namespace webrtc { |
15 class DesktopSize; | 15 class DesktopSize; |
16 class DesktopVector; | 16 class DesktopVector; |
17 } // namespace webrtc | 17 } // namespace webrtc |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 namespace protocol { | 20 namespace protocol { |
21 | 21 |
22 class VideoStream { | 22 class VideoStream { |
23 public: | 23 public: |
24 // Callback used to notify about screen size changes. The size must be | 24 class Observer { |
25 // specified in physical pixels. | 25 public: |
26 typedef base::Callback<void(const webrtc::DesktopSize& size, | 26 // Called to notify about screen size changes. The size is specified in |
27 const webrtc::DesktopVector& dpi)> | 27 // physical pixels. |
28 SizeCallback; | 28 virtual void OnVideoSizeChanged(VideoStream* stream, |
| 29 const webrtc::DesktopSize& size, |
| 30 const webrtc::DesktopVector& dpi) = 0; |
| 31 |
| 32 // Called to notify about an outgoing video frame. |input_event_timestamp| |
| 33 // corresponds to the last input event that was injected before the frame |
| 34 // was captured. |
| 35 virtual void OnVideoFrameSent(VideoStream* stream, |
| 36 uint32_t frame_id, |
| 37 int64_t event_timestamp) = 0; |
| 38 }; |
29 | 39 |
30 VideoStream() {} | 40 VideoStream() {} |
31 virtual ~VideoStream() {} | 41 virtual ~VideoStream() {} |
32 | 42 |
33 // Pauses or resumes scheduling of frame captures. Pausing/resuming captures | 43 // Pauses or resumes scheduling of frame captures. Pausing/resuming captures |
34 // only affects capture scheduling and does not stop/start the capturer. | 44 // only affects capture scheduling and does not stop/start the capturer. |
35 virtual void Pause(bool pause) = 0; | 45 virtual void Pause(bool pause) = 0; |
36 | 46 |
37 // Should be called whenever an input event is received. | 47 // Should be called whenever an input event is received. |
38 virtual void OnInputEventReceived(int64_t event_timestamp) = 0; | 48 virtual void OnInputEventReceived(int64_t event_timestamp) = 0; |
39 | 49 |
40 // Sets whether the video encoder should be requested to encode losslessly, | 50 // Sets whether the video encoder should be requested to encode losslessly, |
41 // or to use a lossless color space (typically requiring higher bandwidth). | 51 // or to use a lossless color space (typically requiring higher bandwidth). |
42 virtual void SetLosslessEncode(bool want_lossless) = 0; | 52 virtual void SetLosslessEncode(bool want_lossless) = 0; |
43 virtual void SetLosslessColor(bool want_lossless) = 0; | 53 virtual void SetLosslessColor(bool want_lossless) = 0; |
44 | 54 |
45 // Sets SizeCallback to be called when screen size is changed. | 55 // Sets stream observer. |
46 virtual void SetSizeCallback(const SizeCallback& size_callback) = 0; | 56 virtual void SetObserver(Observer* observer) = 0; |
47 }; | 57 }; |
48 | 58 |
49 } // namespace protocol | 59 } // namespace protocol |
50 } // namespace remoting | 60 } // namespace remoting |
51 | 61 |
52 #endif // REMOTING_PROTOCOL_VIDEO_STREAM_H_ | 62 #endif // REMOTING_PROTOCOL_VIDEO_STREAM_H_ |
OLD | NEW |