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 "base/basictypes.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/callback.h" | |
10 | |
11 class SkRegion; | |
12 | 9 |
13 namespace webrtc { | 10 namespace webrtc { |
14 class DesktopFrame; | 11 class DesktopFrame; |
15 } // namespace webrtc | 12 } // namespace webrtc |
16 | 13 |
17 namespace remoting { | 14 namespace remoting { |
18 | 15 |
19 class VideoPacket; | 16 class VideoPacket; |
20 | 17 |
21 // A class to perform the task of encoding a continuous stream of images. The | 18 // A class to perform the task of encoding a continuous stream of images. The |
22 // interface is asynchronous to enable maximum throughput. | 19 // interface is asynchronous to enable maximum throughput. |
23 class VideoEncoder { | 20 class VideoEncoder { |
24 public: | 21 public: |
25 | |
26 // DataAvailableCallback is called one or more times, for each chunk the | |
27 // underlying video encoder generates. | |
28 typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback; | |
29 | |
30 virtual ~VideoEncoder() {} | 22 virtual ~VideoEncoder() {} |
31 | 23 |
32 // Encode an image stored in |frame|. Doesn't take ownership of |frame|. When | 24 // Encode an image stored in |frame|. |
33 // encoded data is available, partial or full |data_available_callback| is | 25 virtual scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) = 0; |
34 // called. | |
35 virtual void Encode(const webrtc::DesktopFrame* frame, | |
36 const DataAvailableCallback& data_available_callback) = 0; | |
37 }; | 26 }; |
38 | 27 |
39 } // namespace remoting | 28 } // namespace remoting |
40 | 29 |
41 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ | 30 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ |
OLD | NEW |