OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CODEC_VIDEO_ENCODER_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_H_ |
6 #define REMOTING_CODEC_VIDEO_ENCODER_H_ | 6 #define REMOTING_CODEC_VIDEO_ENCODER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 namespace webrtc { | 12 namespace webrtc { |
13 class DesktopFrame; | 13 class DesktopFrame; |
14 } // namespace webrtc | 14 } // namespace webrtc |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 | 17 namespace protocol { |
| 18 class SessionConfig; |
| 19 } // namespace protocol |
18 class VideoPacket; | 20 class VideoPacket; |
19 | 21 |
20 // A class to perform the task of encoding a continuous stream of images. The | 22 // A class to perform the task of encoding a continuous stream of images. The |
21 // interface is asynchronous to enable maximum throughput. | 23 // interface is asynchronous to enable maximum throughput. |
22 class VideoEncoder { | 24 class VideoEncoder { |
23 public: | 25 public: |
24 enum Flags { REQUEST_KEY_FRAME = 1 << 0 }; | 26 enum Flags { REQUEST_KEY_FRAME = 1 << 0 }; |
25 virtual ~VideoEncoder() {} | 27 virtual ~VideoEncoder() {} |
26 | 28 |
27 // Request that the encoder provide lossless encoding, or color, if possible. | 29 // Request that the encoder provide lossless encoding, or color, if possible. |
28 virtual void SetLosslessEncode(bool want_lossless) {} | 30 virtual void SetLosslessEncode(bool want_lossless) {} |
29 virtual void SetLosslessColor(bool want_lossless) {} | 31 virtual void SetLosslessColor(bool want_lossless) {} |
30 | 32 |
31 // Encode an image stored in |frame|. If |frame.updated_region()| is empty | 33 // Encode an image stored in |frame|. If |frame.updated_region()| is empty |
32 // then the encoder may return a packet (e.g. to top-off previously-encoded | 34 // then the encoder may return a packet (e.g. to top-off previously-encoded |
33 // portions of the frame to higher quality) or return nullptr to indicate that | 35 // portions of the frame to higher quality) or return nullptr to indicate that |
34 // there is no work to do. | 36 // there is no work to do. |
35 virtual std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame, | 37 virtual std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame, |
36 uint32_t flags) = 0; | 38 uint32_t flags) = 0; |
| 39 |
| 40 static std::unique_ptr<VideoEncoder> Create( |
| 41 const protocol::SessionConfig& config); |
37 }; | 42 }; |
38 | 43 |
39 } // namespace remoting | 44 } // namespace remoting |
40 | 45 |
41 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ | 46 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ |
OLD | NEW |