Chromium Code Reviews| 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_CODEC_VIDEO_ENCODER_ROW_BASED_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_ROW_BASED_H_ |
| 6 #define REMOTING_CODEC_VIDEO_ENCODER_ROW_BASED_H_ | 6 #define REMOTING_CODEC_VIDEO_ENCODER_ROW_BASED_H_ |
| 7 | 7 |
| 8 #include "remoting/codec/video_encoder.h" | 8 #include "remoting/codec/video_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" |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 | 13 |
| 14 class Compressor; | 14 class Compressor; |
| 15 | 15 |
| 16 // EncoderRowBased implements an Encoder using zlib or verbatim | 16 // VideoEncoderRowBased implements an VideoEncoder using zlib or verbatim |
|
simonmorris
2012/08/24 16:19:29
an -> a
kxing
2012/08/24 16:28:04
Done.
| |
| 17 // compression. Zlib-based encoder must be created using | 17 // compression. Zlib-based encoder must be created using |
| 18 // CreateZlibEncoder(), verbatim encoder is created with | 18 // CreateZlibEncoder(), verbatim encoder is created with |
| 19 // CreateVerbatimEncoder(). | 19 // CreateVerbatimEncoder(). |
| 20 // | 20 // |
| 21 // Compressor is reset before encoding each rectangle, so that each | 21 // Compressor is reset before encoding each rectangle, so that each |
| 22 // rectangle can be decoded independently. | 22 // rectangle can be decoded independently. |
| 23 class EncoderRowBased : public Encoder { | 23 class VideoEncoderRowBased : public VideoEncoder { |
| 24 public: | 24 public: |
| 25 static EncoderRowBased* CreateZlibEncoder(); | 25 static VideoEncoderRowBased* CreateZlibEncoder(); |
| 26 static EncoderRowBased* CreateZlibEncoder(int packet_size); | 26 static VideoEncoderRowBased* CreateZlibEncoder(int packet_size); |
| 27 static EncoderRowBased* CreateVerbatimEncoder(); | 27 static VideoEncoderRowBased* CreateVerbatimEncoder(); |
| 28 static EncoderRowBased* CreateVerbatimEncoder(int packet_size); | 28 static VideoEncoderRowBased* CreateVerbatimEncoder(int packet_size); |
| 29 | 29 |
| 30 virtual ~EncoderRowBased(); | 30 virtual ~VideoEncoderRowBased(); |
| 31 | 31 |
| 32 virtual void Encode( | 32 virtual void Encode( |
| 33 scoped_refptr<CaptureData> capture_data, | 33 scoped_refptr<CaptureData> capture_data, |
| 34 bool key_frame, | 34 bool key_frame, |
| 35 const DataAvailableCallback& data_available_callback) OVERRIDE; | 35 const DataAvailableCallback& data_available_callback) OVERRIDE; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding); | 38 VideoEncoderRowBased(Compressor* compressor, |
| 39 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding, | 39 VideoPacketFormat::Encoding encoding); |
| 40 int packet_size); | 40 VideoEncoderRowBased(Compressor* compressor, |
| 41 VideoPacketFormat::Encoding encoding, | |
| 42 int packet_size); | |
| 41 | 43 |
| 42 // Encode a single dirty rect using compressor. | 44 // Encode a single dirty rect using compressor. |
| 43 void EncodeRect(const SkIRect& rect, bool last); | 45 void EncodeRect(const SkIRect& rect, bool last); |
| 44 | 46 |
| 45 // Marks a packet as the first in a series of rectangle updates. | 47 // Marks a packet as the first in a series of rectangle updates. |
| 46 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); | 48 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); |
| 47 | 49 |
| 48 // Retrieves a pointer to the output buffer in |update| used for storing the | 50 // Retrieves a pointer to the output buffer in |update| used for storing the |
| 49 // encoded rectangle data. Will resize the buffer to |size|. | 51 // encoded rectangle data. Will resize the buffer to |size|. |
| 50 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); | 52 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 62 | 64 |
| 63 // The most recent screen size. | 65 // The most recent screen size. |
| 64 SkISize screen_size_; | 66 SkISize screen_size_; |
| 65 | 67 |
| 66 int packet_size_; | 68 int packet_size_; |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 } // namespace remoting | 71 } // namespace remoting |
| 70 | 72 |
| 71 #endif // REMOTING_CODEC_VIDEO_ENCODER_ROW_BASED_H_ | 73 #endif // REMOTING_CODEC_VIDEO_ENCODER_ROW_BASED_H_ |
| OLD | NEW |