OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_ENCODER_H_ |
| 6 #define REMOTING_HOST_ENCODER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/task.h" |
| 10 #include "remoting/base/protocol/chromotocol.pb.h" |
| 11 #include "remoting/host/capturer.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 class DataBuffer; |
| 16 |
| 17 } // namespace media |
| 18 |
| 19 namespace remoting { |
| 20 |
| 21 // A class to perform the task of encoding a continous stream of |
| 22 // images. |
| 23 // This class operates asynchronously to enable maximum throughput. |
| 24 class Encoder { |
| 25 public: |
| 26 virtual ~Encoder() {} |
| 27 |
| 28 // Encode an image stored in |input_data|. |dirty_rects| contains |
| 29 // regions of update since last encode. |
| 30 // |
| 31 // If |key_frame| is true, the encoder should not reference |
| 32 // previous encode and encode the full frame. |
| 33 // |
| 34 // When encoded data is available, partial or full |data_available_task| |
| 35 // is called, data can be read from |data| and size is |data_size|. |
| 36 // After the last data available event and encode has completed, |
| 37 // |encode_done| is set to true and |data_available_task| is deleted. |
| 38 // |
| 39 // Note that |input_data| and |stride| are arrays of 3 elements. |
| 40 // |
| 41 // Implementation has to ensure that when |data_available_task| is called |
| 42 // output parameters are stable. |
| 43 virtual void Encode(const DirtyRects& dirty_rects, |
| 44 const uint8** input_data, |
| 45 const int* strides, |
| 46 bool key_frame, |
| 47 chromotocol_pb::UpdateStreamPacketHeader* header, |
| 48 scoped_refptr<media::DataBuffer>* output_data, |
| 49 bool* encode_done, |
| 50 Task* data_available_task) = 0; |
| 51 |
| 52 // Set the dimension of the incoming images. Need to call this before |
| 53 // calling Encode(). |
| 54 virtual void SetSize(int width, int height) = 0; |
| 55 |
| 56 // Set the pixel format of the incoming images. Need to call this before |
| 57 // calling Encode(). |
| 58 virtual void SetPixelFormat(chromotocol_pb::PixelFormat pixel_format) = 0; |
| 59 }; |
| 60 |
| 61 } // namespace remoting |
| 62 |
| 63 #endif // REMOTING_HOST_ENCODER_H_ |
OLD | NEW |