| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ROW_BASED_H_ | 5 #ifndef REMOTING_BASE_ENCODER_ROW_BASED_H_ |
| 6 #define REMOTING_BASE_ENCODER_ROW_BASED_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 #include "remoting/proto/video.pb.h" |
| 10 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // rectangle can be decoded independently. | 23 // rectangle can be decoded independently. |
| 24 class EncoderRowBased : public Encoder { | 24 class EncoderRowBased : public Encoder { |
| 25 public: | 25 public: |
| 26 static EncoderRowBased* CreateZlibEncoder(); | 26 static EncoderRowBased* CreateZlibEncoder(); |
| 27 static EncoderRowBased* CreateZlibEncoder(int packet_size); | 27 static EncoderRowBased* CreateZlibEncoder(int packet_size); |
| 28 static EncoderRowBased* CreateVerbatimEncoder(); | 28 static EncoderRowBased* CreateVerbatimEncoder(); |
| 29 static EncoderRowBased* CreateVerbatimEncoder(int packet_size); | 29 static EncoderRowBased* CreateVerbatimEncoder(int packet_size); |
| 30 | 30 |
| 31 virtual ~EncoderRowBased(); | 31 virtual ~EncoderRowBased(); |
| 32 | 32 |
| 33 virtual void Encode(scoped_refptr<CaptureData> capture_data, | 33 virtual void Encode( |
| 34 bool key_frame, | 34 scoped_refptr<CaptureData> capture_data, |
| 35 DataAvailableCallback* data_available_callback); | 35 bool key_frame, |
| 36 const DataAvailableCallback& data_available_callback) OVERRIDE; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding); | 39 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding); |
| 39 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding, | 40 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding, |
| 40 int packet_size); | 41 int packet_size); |
| 41 | 42 |
| 42 // Encode a single dirty rect using compressor. | 43 // Encode a single dirty rect using compressor. |
| 43 void EncodeRect(const SkIRect& rect, bool last); | 44 void EncodeRect(const SkIRect& rect, bool last); |
| 44 | 45 |
| 45 // Marks a packet as the first in a series of rectangle updates. | 46 // Marks a packet as the first in a series of rectangle updates. |
| 46 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); | 47 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); |
| 47 | 48 |
| 48 // Retrieves a pointer to the output buffer in |update| used for storing the | 49 // Retrieves a pointer to the output buffer in |update| used for storing the |
| 49 // encoded rectangle data. Will resize the buffer to |size|. | 50 // encoded rectangle data. Will resize the buffer to |size|. |
| 50 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); | 51 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); |
| 51 | 52 |
| 52 // Submit |message| to |callback_|. | 53 // Submit |message| to |callback_|. |
| 53 void SubmitMessage(VideoPacket* packet, size_t rect_index); | 54 void SubmitMessage(VideoPacket* packet, size_t rect_index); |
| 54 | 55 |
| 55 // The encoding of the incoming stream. | 56 // The encoding of the incoming stream. |
| 56 VideoPacketFormat::Encoding encoding_; | 57 VideoPacketFormat::Encoding encoding_; |
| 57 | 58 |
| 58 scoped_ptr<Compressor> compressor_; | 59 scoped_ptr<Compressor> compressor_; |
| 59 | 60 |
| 60 scoped_refptr<CaptureData> capture_data_; | 61 scoped_refptr<CaptureData> capture_data_; |
| 61 scoped_ptr<DataAvailableCallback> callback_; | 62 DataAvailableCallback callback_; |
| 62 | 63 |
| 63 // The most recent screen size. | 64 // The most recent screen size. |
| 64 SkISize screen_size_; | 65 SkISize screen_size_; |
| 65 | 66 |
| 66 int packet_size_; | 67 int packet_size_; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace remoting | 70 } // namespace remoting |
| 70 | 71 |
| 71 #endif // REMOTING_BASE_ENCODER_ROW_BASED_H_ | 72 #endif // REMOTING_BASE_ENCODER_ROW_BASED_H_ |
| OLD | NEW |