| 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_VERBATIM_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
| 6 #define REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ | 6 #define REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
| 7 | 7 |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "remoting/codec/video_encoder.h" | 9 #include "remoting/codec/video_encoder.h" |
| 10 #include "remoting/proto/video.pb.h" | 10 #include "remoting/proto/video.pb.h" |
| 11 #include "third_party/skia/include/core/SkRect.h" | 11 #include "third_party/skia/include/core/SkRect.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 // VideoEncoderVerbatim implements a VideoEncoder that sends image data as a | 15 // VideoEncoderVerbatim implements a VideoEncoder that sends image data as a |
| 16 // sequence of RGB values, without compression. | 16 // sequence of RGB values, without compression. |
| 17 class VideoEncoderVerbatim : public VideoEncoder { | 17 class VideoEncoderVerbatim : public VideoEncoder { |
| 18 public: | 18 public: |
| 19 VideoEncoderVerbatim(); | 19 VideoEncoderVerbatim(); |
| 20 virtual ~VideoEncoderVerbatim(); | 20 virtual ~VideoEncoderVerbatim(); |
| 21 | 21 |
| 22 // Sets maximum size of data in video packets. Used by unittests. | 22 // Sets maximum size of data in video packets. Used by unittests. |
| 23 void SetMaxPacketSize(int size); | 23 void SetMaxPacketSize(int size); |
| 24 | 24 |
| 25 // VideoEncoder interface. | 25 // VideoEncoder interface. |
| 26 virtual void Encode( | 26 virtual void Encode( |
| 27 scoped_refptr<CaptureData> capture_data, | 27 scoped_refptr<media::ScreenCaptureData> capture_data, |
| 28 bool key_frame, | 28 bool key_frame, |
| 29 const DataAvailableCallback& data_available_callback) OVERRIDE; | 29 const DataAvailableCallback& data_available_callback) OVERRIDE; |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 // Encode a single dirty |rect|. | 32 // Encode a single dirty |rect|. |
| 33 void EncodeRect(const SkIRect& rect, bool last); | 33 void EncodeRect(const SkIRect& rect, bool last); |
| 34 | 34 |
| 35 // Initializes first packet in a sequence of video packets to update screen | 35 // Initializes first packet in a sequence of video packets to update screen |
| 36 // rectangle |rect|. | 36 // rectangle |rect|. |
| 37 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); | 37 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); |
| 38 | 38 |
| 39 // Allocates a buffer of the specified |size| inside |packet| and returns the | 39 // Allocates a buffer of the specified |size| inside |packet| and returns the |
| 40 // pointer to it. | 40 // pointer to it. |
| 41 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); | 41 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); |
| 42 | 42 |
| 43 // Submit |packet| to |callback_|. | 43 // Submit |packet| to |callback_|. |
| 44 void SubmitMessage(VideoPacket* packet, size_t rect_index); | 44 void SubmitMessage(VideoPacket* packet, size_t rect_index); |
| 45 | 45 |
| 46 scoped_refptr<CaptureData> capture_data_; | 46 scoped_refptr<media::ScreenCaptureData> capture_data_; |
| 47 DataAvailableCallback callback_; | 47 DataAvailableCallback callback_; |
| 48 base::Time encode_start_time_; | 48 base::Time encode_start_time_; |
| 49 | 49 |
| 50 // The most recent screen size. | 50 // The most recent screen size. |
| 51 SkISize screen_size_; | 51 SkISize screen_size_; |
| 52 | 52 |
| 53 int max_packet_size_; | 53 int max_packet_size_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace remoting | 56 } // namespace remoting |
| 57 | 57 |
| 58 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ | 58 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
| OLD | NEW |