Chromium Code Reviews| 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/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "media/base/data_buffer.h" | |
| 11 | 10 |
| 12 namespace media { | 11 class SkRegion; |
| 13 class ScreenCaptureData; | 12 |
| 14 } // namespace media | 13 namespace webrtc { |
| 14 class DesktopFrame; | |
| 15 } // namespace webrtc | |
| 15 | 16 |
| 16 namespace remoting { | 17 namespace remoting { |
| 17 | 18 |
| 18 class VideoPacket; | 19 class VideoPacket; |
| 19 | 20 |
| 20 // A class to perform the task of encoding a continous stream of | 21 // A class to perform the task of encoding a continous stream of |
| 21 // images. | 22 // images. |
| 22 // This class operates asynchronously to enable maximum throughput. | 23 // This class operates asynchronously to enable maximum throughput. |
|
Wez
2013/04/26 18:48:14
nit: This is an interface, not a class, so unless
Sergey Ulanov
2013/05/07 22:25:50
Done.
| |
| 23 class VideoEncoder { | 24 class VideoEncoder { |
| 24 public: | 25 public: |
| 25 | 26 |
| 26 // DataAvailableCallback is called one or more times, for each chunk the | 27 // DataAvailableCallback is called one or more times, for each chunk the |
| 27 // underlying video encoder generates. | 28 // underlying video encoder generates. |
| 28 typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback; | 29 typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback; |
| 29 | 30 |
| 30 virtual ~VideoEncoder() {} | 31 virtual ~VideoEncoder() {} |
| 31 | 32 |
| 32 // Encode an image stored in |capture_data|. | 33 // Encode an image stored in |frame|. Doesn't take ownership of |frame|. When |
| 33 // | 34 // encoded data is available, partial or full |data_available_callback| is |
| 34 // If |key_frame| is true, the encoder should not reference | 35 // called. |
|
Wez
2013/04/26 18:48:14
IIRC the implementations are synchronous, so you c
Sergey Ulanov
2013/05/07 22:25:50
Not related to this CL.
| |
| 35 // previous encode and encode the full frame. | 36 virtual void Encode(webrtc::DesktopFrame* frame, |
|
Wez
2013/04/26 18:48:14
If this isn't being passed, it can be const Deskto
Sergey Ulanov
2013/05/07 22:25:50
Done.
| |
| 36 // | |
| 37 // When encoded data is available, partial or full |data_available_callback| | |
| 38 // is called. | |
| 39 virtual void Encode(scoped_refptr<media::ScreenCaptureData> capture_data, | |
| 40 bool key_frame, | |
| 41 const DataAvailableCallback& data_available_callback) = 0; | 37 const DataAvailableCallback& data_available_callback) = 0; |
| 42 }; | 38 }; |
| 43 | 39 |
| 44 } // namespace remoting | 40 } // namespace remoting |
| 45 | 41 |
| 46 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ | 42 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ |
| OLD | NEW |