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/webrtc/modules/desktop_capture/desktop_geometry.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<media::ScreenCaptureData> capture_data, | 27 const webrtc::DesktopFrame* frame, |
28 bool key_frame, | |
29 const DataAvailableCallback& data_available_callback) OVERRIDE; | 28 const DataAvailableCallback& data_available_callback) OVERRIDE; |
30 | 29 |
31 private: | 30 private: |
32 // Encode a single dirty |rect|. | 31 // Encode a single dirty |rect|. |
33 void EncodeRect(const SkIRect& rect, bool last); | 32 void EncodeRect(const webrtc::DesktopFrame* frame, |
| 33 const webrtc::DesktopRect& rect, |
| 34 bool last); |
34 | 35 |
35 // Initializes first packet in a sequence of video packets to update screen | 36 // Initializes first packet in a sequence of video packets to update screen |
36 // rectangle |rect|. | 37 // rectangle |rect|. |
37 void PrepareUpdateStart(const SkIRect& rect, VideoPacket* packet); | 38 void PrepareUpdateStart(const webrtc::DesktopFrame* frame, |
| 39 const webrtc::DesktopRect& rect, |
| 40 VideoPacket* packet); |
38 | 41 |
39 // Allocates a buffer of the specified |size| inside |packet| and returns the | 42 // Allocates a buffer of the specified |size| inside |packet| and returns the |
40 // pointer to it. | 43 // pointer to it. |
41 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); | 44 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); |
42 | 45 |
43 // Submit |packet| to |callback_|. | 46 // Submit |packet| to |callback_|. |
44 void SubmitMessage(VideoPacket* packet, size_t rect_index); | 47 void SubmitMessage(VideoPacket* packet, size_t rect_index); |
45 | 48 |
46 scoped_refptr<media::ScreenCaptureData> capture_data_; | |
47 DataAvailableCallback callback_; | 49 DataAvailableCallback callback_; |
48 base::Time encode_start_time_; | 50 base::Time encode_start_time_; |
49 | 51 |
50 // The most recent screen size. | 52 // The most recent screen size. |
51 SkISize screen_size_; | 53 webrtc::DesktopSize screen_size_; |
52 | 54 |
53 int max_packet_size_; | 55 int max_packet_size_; |
54 }; | 56 }; |
55 | 57 |
56 } // namespace remoting | 58 } // namespace remoting |
57 | 59 |
58 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ | 60 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
OLD | NEW |