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.
5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_
6 #define REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_
8 #include "base/time/time.h"
9 #include "remoting/codec/video_encoder.h"
10 #include "remoting/proto/video.pb.h"
11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
15 // VideoEncoderVerbatim implements a VideoEncoder that sends image data as a
16 // sequence of RGB values, without compression.
17 class VideoEncoderVerbatim
: public VideoEncoder
{
19 VideoEncoderVerbatim();
20 virtual ~VideoEncoderVerbatim();
22 // Sets maximum size of data in video packets. Used by unittests.
23 void SetMaxPacketSize(int size
);
25 // VideoEncoder interface.
27 const webrtc::DesktopFrame
* frame
,
28 const DataAvailableCallback
& data_available_callback
) OVERRIDE
;
31 // Encode a single dirty |rect|.
32 void EncodeRect(const webrtc::DesktopFrame
* frame
,
33 const webrtc::DesktopRect
& rect
,
36 // Initializes first packet in a sequence of video packets to update screen
38 void PrepareUpdateStart(const webrtc::DesktopFrame
* frame
,
39 const webrtc::DesktopRect
& rect
,
42 // Allocates a buffer of the specified |size| inside |packet| and returns the
44 uint8
* GetOutputBuffer(VideoPacket
* packet
, size_t size
);
46 // Submit |packet| to |callback_|.
47 void SubmitMessage(VideoPacket
* packet
, size_t rect_index
);
49 DataAvailableCallback callback_
;
50 base::Time encode_start_time_
;
52 // The most recent screen size.
53 webrtc::DesktopSize screen_size_
;
58 } // namespace remoting
60 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_