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