Index: remoting/base/encoder_verbatim.cc |
diff --git a/remoting/host/encoder_verbatim.cc b/remoting/base/encoder_verbatim.cc |
similarity index 74% |
rename from remoting/host/encoder_verbatim.cc |
rename to remoting/base/encoder_verbatim.cc |
index fd9dadf4b2d938dbc4e242dd08558ded214f5347..f6cc2cac6387c96b77c1466fac545ab554fedae8 100644 |
--- a/remoting/host/encoder_verbatim.cc |
+++ b/remoting/base/encoder_verbatim.cc |
@@ -2,10 +2,11 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "remoting/host/encoder_verbatim.h" |
+#include "remoting/base/encoder_verbatim.h" |
#include "gfx/rect.h" |
#include "media/base/data_buffer.h" |
+#include "remoting/base/capture_data.h" |
#include "remoting/base/protocol_util.h" |
#include "remoting/base/protocol/chromotocol.pb.h" |
@@ -13,7 +14,7 @@ namespace remoting { |
using media::DataBuffer; |
-void EncoderVerbatim::Encode(scoped_refptr<Capturer::CaptureData> capture_data, |
+void EncoderVerbatim::Encode(scoped_refptr<CaptureData> capture_data, |
bool key_frame, |
DataAvailableCallback* data_available_callback) { |
int num_rects = capture_data->dirty_rects().size(); |
@@ -22,7 +23,8 @@ void EncoderVerbatim::Encode(scoped_refptr<Capturer::CaptureData> capture_data, |
HostMessage* msg = new HostMessage(); |
UpdateStreamPacketMessage* packet = msg->mutable_update_stream_packet(); |
- if (EncodeRect(dirty_rect, capture_data, packet)) { |
+ if (EncodeRect(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), |
+ dirty_rect.height(), capture_data, packet)) { |
// Prepare the end rect content. |
packet->mutable_end_rect(); |
@@ -41,26 +43,26 @@ void EncoderVerbatim::Encode(scoped_refptr<Capturer::CaptureData> capture_data, |
} |
bool EncoderVerbatim::EncodeRect( |
- const gfx::Rect& dirty, |
- const scoped_refptr<Capturer::CaptureData>& capture_data, |
+ int x, int y, int width, int height, |
+ const scoped_refptr<CaptureData>& capture_data, |
UpdateStreamPacketMessage* packet) { |
// Prepare the begin rect content. |
- packet->mutable_begin_rect()->set_x(dirty.x()); |
- packet->mutable_begin_rect()->set_y(dirty.y()); |
- packet->mutable_begin_rect()->set_width(dirty.width()); |
- packet->mutable_begin_rect()->set_height(dirty.height()); |
+ packet->mutable_begin_rect()->set_x(x); |
+ packet->mutable_begin_rect()->set_y(y); |
+ packet->mutable_begin_rect()->set_width(width); |
+ packet->mutable_begin_rect()->set_height(height); |
packet->mutable_begin_rect()->set_encoding(EncodingNone); |
packet->mutable_begin_rect()->set_pixel_format(capture_data->pixel_format()); |
// Calculate the size of output. |
int bytes_per_pixel = GetBytesPerPixel(capture_data->pixel_format()); |
- int row_size = bytes_per_pixel * dirty.width(); |
+ int row_size = bytes_per_pixel * width; |
int output_size = 0; |
- for (int i = 0; i < Capturer::DataPlanes::kPlaneCount; ++i) { |
+ for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { |
// TODO(hclam): Handle YUV since the height would be different. |
const uint8* in = capture_data->data_planes().data[i]; |
if (!in) continue; |
- output_size += row_size * dirty.height(); |
+ output_size += row_size * height; |
} |
// Resize the output data buffer. |
@@ -68,13 +70,13 @@ bool EncoderVerbatim::EncodeRect( |
uint8* out = reinterpret_cast<uint8*>( |
&((*packet->mutable_rect_data()->mutable_data())[0])); |
- for (int i = 0; i < Capturer::DataPlanes::kPlaneCount; ++i) { |
+ for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { |
const uint8* in = capture_data->data_planes().data[i]; |
// Skip over planes that don't have data. |
if (!in) continue; |
// TODO(hclam): Handle YUV since the height would be different. |
- for (int j = 0; j < dirty.height(); ++j) { |
+ for (int j = 0; j < height; ++j) { |
DCHECK_LE(row_size, capture_data->data_planes().strides[i]); |
memcpy(out, in, row_size); |
in += capture_data->data_planes().strides[i]; |