| 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" | 10 #include "media/base/data_buffer.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 class DataBuffer; | 13 class ScreenCaptureData; |
| 14 } | 14 } // namespace media |
| 15 | 15 |
| 16 namespace remoting { | 16 namespace remoting { |
| 17 | 17 |
| 18 class CaptureData; | |
| 19 class VideoPacket; | 18 class VideoPacket; |
| 20 | 19 |
| 21 // A class to perform the task of encoding a continous stream of | 20 // A class to perform the task of encoding a continous stream of |
| 22 // images. | 21 // images. |
| 23 // This class operates asynchronously to enable maximum throughput. | 22 // This class operates asynchronously to enable maximum throughput. |
| 24 class VideoEncoder { | 23 class VideoEncoder { |
| 25 public: | 24 public: |
| 26 | 25 |
| 27 // DataAvailableCallback is called one or more times, for each chunk the | 26 // DataAvailableCallback is called one or more times, for each chunk the |
| 28 // underlying video encoder generates. | 27 // underlying video encoder generates. |
| 29 typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback; | 28 typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback; |
| 30 | 29 |
| 31 virtual ~VideoEncoder() {} | 30 virtual ~VideoEncoder() {} |
| 32 | 31 |
| 33 // Encode an image stored in |capture_data|. | 32 // Encode an image stored in |capture_data|. |
| 34 // | 33 // |
| 35 // If |key_frame| is true, the encoder should not reference | 34 // If |key_frame| is true, the encoder should not reference |
| 36 // previous encode and encode the full frame. | 35 // previous encode and encode the full frame. |
| 37 // | 36 // |
| 38 // When encoded data is available, partial or full |data_available_callback| | 37 // When encoded data is available, partial or full |data_available_callback| |
| 39 // is called. | 38 // is called. |
| 40 virtual void Encode(scoped_refptr<CaptureData> capture_data, | 39 virtual void Encode(scoped_refptr<media::ScreenCaptureData> capture_data, |
| 41 bool key_frame, | 40 bool key_frame, |
| 42 const DataAvailableCallback& data_available_callback) = 0; | 41 const DataAvailableCallback& data_available_callback) = 0; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 } // namespace remoting | 44 } // namespace remoting |
| 46 | 45 |
| 47 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ | 46 #endif // REMOTING_CODEC_VIDEO_ENCODER_H_ |
| OLD | NEW |