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 namespace protocol { | 17 namespace protocol { |
18 class SessionConfig; | 18 class SessionConfig; |
19 } // namespace protocol | 19 } // namespace protocol |
20 class VideoPacket; | 20 class VideoPacket; |
21 | 21 |
22 // 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 |
23 // interface is asynchronous to enable maximum throughput. | 23 // interface is asynchronous to enable maximum throughput. |
24 class VideoEncoder { | 24 class VideoEncoder { |
25 public: | 25 public: |
26 enum Flags { REQUEST_KEY_FRAME = 1 << 0 }; | |
27 virtual ~VideoEncoder() {} | 26 virtual ~VideoEncoder() {} |
28 | 27 |
29 // Request that the encoder provide lossless encoding, or color, if possible. | 28 // Request that the encoder provide lossless encoding, or color, if possible. |
30 virtual void SetLosslessEncode(bool want_lossless) {} | 29 virtual void SetLosslessEncode(bool want_lossless) {} |
31 virtual void SetLosslessColor(bool want_lossless) {} | 30 virtual void SetLosslessColor(bool want_lossless) {} |
32 | 31 |
33 // Encode an image stored in |frame|. If |frame.updated_region()| is empty | 32 // Encode an image stored in |frame|. If |frame.updated_region()| is empty |
34 // then the encoder may return a packet (e.g. to top-off previously-encoded | 33 // then the encoder may return a packet (e.g. to top-off previously-encoded |
35 // portions of the frame to higher quality) or return nullptr to indicate that | 34 // portions of the frame to higher quality) or return nullptr to indicate that |
36 // there is no work to do. | 35 // there is no work to do. |
37 virtual std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame, | 36 virtual std::unique_ptr<VideoPacket> Encode( |
38 uint32_t flags) = 0; | 37 const webrtc::DesktopFrame& frame) = 0; |
39 | 38 |
40 static std::unique_ptr<VideoEncoder> Create( | 39 static std::unique_ptr<VideoEncoder> Create( |
41 const protocol::SessionConfig& config); | 40 const protocol::SessionConfig& config); |
42 virtual void UpdateTargetBitrate(int bitrate_kbps) {} | |
43 }; | 41 }; |
44 | 42 |
45 } // namespace remoting | 43 } // namespace remoting |
46 | 44 |
47 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ | 45 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ |
OLD | NEW |