Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_BASE_ENCODER_VERBATIM_H_ | 5 #ifndef REMOTING_BASE_ENCODER_ROW_BASED_H_ |
| 6 #define REMOTING_BASE_ENCODER_VERBATIM_H_ | 6 #define REMOTING_BASE_ENCODER_ROW_BASED_H_ |
| 7 | 7 |
| 8 #include "remoting/base/encoder.h" | 8 #include "remoting/base/encoder.h" |
| 9 #include "remoting/proto/video.pb.h" | |
| 9 | 10 |
| 10 #include "gfx/rect.h" | 11 #include "gfx/rect.h" |
| 11 | 12 |
| 12 namespace remoting { | 13 namespace remoting { |
| 13 | 14 |
| 15 class Compressor; | |
| 14 class UpdateStreamPacket; | 16 class UpdateStreamPacket; |
| 15 | 17 |
| 16 // EncoderVerbatim implements Encoder and simply copies input to the output | 18 // EncoderRowBased implements an Encoder using zlib or verbatim |
| 17 // buffer verbatim. | 19 // compression. |
| 18 class EncoderVerbatim : public Encoder { | 20 class EncoderRowBased : public Encoder { |
|
Alpha Left Google
2010/12/02 19:39:55
Add comments about the compressor used here. Also
Sergey Ulanov
2010/12/03 00:17:21
Done.
| |
| 19 public: | 21 public: |
| 20 EncoderVerbatim(); | 22 static EncoderRowBased* CreateZlibEncoder(); |
| 21 EncoderVerbatim(int packet_size); | 23 static EncoderRowBased* CreateVerbatimEncoder(); |
| 22 | 24 |
| 23 virtual ~EncoderVerbatim() {} | 25 virtual ~EncoderRowBased(); |
| 24 | 26 |
| 25 virtual void Encode(scoped_refptr<CaptureData> capture_data, | 27 virtual void Encode(scoped_refptr<CaptureData> capture_data, |
| 26 bool key_frame, | 28 bool key_frame, |
| 27 DataAvailableCallback* data_available_callback); | 29 DataAvailableCallback* data_available_callback); |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 // Encode a single dirty rect. | 32 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding); |
| 33 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding, | |
| 34 int packet_size); | |
| 35 | |
| 36 // Encode a single dirty rect using compressor. | |
| 31 void EncodeRect(const gfx::Rect& rect, size_t rect_index); | 37 void EncodeRect(const gfx::Rect& rect, size_t rect_index); |
| 32 | 38 |
| 33 // Marks a packets as the first in a series of rectangle updates. | 39 // Marks a packets as the first in a series of rectangle updates. |
|
garykac
2010/12/02 19:51:31
Not part of your CL, but this should be "Marks a p
Sergey Ulanov
2010/12/03 00:17:21
Done.
| |
| 34 void PrepareUpdateStart(const gfx::Rect& rect, VideoPacket* packet); | 40 void PrepareUpdateStart(const gfx::Rect& rect, VideoPacket* packet); |
| 35 | 41 |
| 36 // Retrieves a pointer to the output buffer in |update| used for storing the | 42 // Retrieves a pointer to the output buffer in |update| used for storing the |
| 37 // encoded rectangle data. Will resize the buffer to |size|. | 43 // encoded rectangle data. Will resize the buffer to |size|. |
| 38 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); | 44 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); |
| 39 | 45 |
| 40 // Submit |message| to |callback_|. | 46 // Submit |message| to |callback_|. |
| 41 void SubmitMessage(VideoPacket* packet, size_t rect_index); | 47 void SubmitMessage(VideoPacket* packet, size_t rect_index); |
| 42 | 48 |
| 49 // The encoding of the incoming stream. | |
| 50 VideoPacketFormat::Encoding encoding_; | |
| 51 | |
| 52 scoped_ptr<Compressor> compressor_; | |
| 53 | |
| 43 scoped_refptr<CaptureData> capture_data_; | 54 scoped_refptr<CaptureData> capture_data_; |
| 44 scoped_ptr<DataAvailableCallback> callback_; | 55 scoped_ptr<DataAvailableCallback> callback_; |
| 56 | |
| 45 int packet_size_; | 57 int packet_size_; |
| 46 }; | 58 }; |
| 47 | 59 |
| 48 } // namespace remoting | 60 } // namespace remoting |
| 49 | 61 |
| 50 #endif // REMOTING_BASE_ENCODER_VERBATIM_H_ | 62 #endif // REMOTING_BASE_ENCODER_ROW_BASED_H_ |
| OLD | NEW |