OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "remoting/base/encoder_row_based.h" | 5 #include "remoting/base/encoder_row_based.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "gfx/rect.h" | 8 #include "gfx/rect.h" |
9 #include "remoting/base/capture_data.h" | 9 #include "remoting/base/capture_data.h" |
10 #include "remoting/base/compressor_verbatim.h" | 10 #include "remoting/base/compressor_verbatim.h" |
11 #include "remoting/base/compressor_zlib.h" | 11 #include "remoting/base/compressor_zlib.h" |
12 #include "remoting/base/util.h" | 12 #include "remoting/base/util.h" |
13 #include "remoting/proto/video.pb.h" | 13 #include "remoting/proto/video.pb.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 static const int kPacketSize = 1024 * 1024; | 17 static const int kPacketSize = 1024 * 1024; |
18 | 18 |
19 EncoderRowBased* EncoderRowBased::CreateZlibEncoder() { | 19 EncoderRowBased* EncoderRowBased::CreateZlibEncoder() { |
20 return new EncoderRowBased(new CompressorZlib(), | 20 return new EncoderRowBased(new CompressorZlib(), |
21 VideoPacketFormat::ENCODING_ZLIB); | 21 VideoPacketFormat::ENCODING_ZLIB); |
22 } | 22 } |
23 | 23 |
24 EncoderRowBased* EncoderRowBased::CreateZlibEncoder(int packet_size) { | |
25 return new EncoderRowBased(new CompressorZlib(), | |
26 VideoPacketFormat::ENCODING_ZLIB, | |
27 packet_size); | |
28 } | |
29 | |
30 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder() { | 24 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder() { |
31 return new EncoderRowBased(new CompressorVerbatim(), | 25 return new EncoderRowBased(new CompressorVerbatim(), |
32 VideoPacketFormat::ENCODING_VERBATIM); | 26 VideoPacketFormat::ENCODING_VERBATIM); |
33 } | 27 } |
34 | 28 |
35 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder(int packet_size) { | |
36 return new EncoderRowBased(new CompressorVerbatim(), | |
37 VideoPacketFormat::ENCODING_VERBATIM, | |
38 packet_size); | |
39 } | |
40 | |
41 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 29 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
42 VideoPacketFormat::Encoding encoding) | 30 VideoPacketFormat::Encoding encoding) |
43 : encoding_(encoding), | 31 : encoding_(encoding), |
44 compressor_(compressor), | 32 compressor_(compressor), |
45 packet_size_(kPacketSize) { | 33 packet_size_(kPacketSize) { |
46 } | 34 } |
47 | 35 |
48 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 36 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
49 VideoPacketFormat::Encoding encoding, | 37 VideoPacketFormat::Encoding encoding, |
50 int packet_size) | 38 int packet_size) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 139 |
152 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { | 140 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { |
153 packet->mutable_data()->resize(size); | 141 packet->mutable_data()->resize(size); |
154 // TODO(ajwong): Is there a better way to do this at all??? | 142 // TODO(ajwong): Is there a better way to do this at all??? |
155 return const_cast<uint8*>(reinterpret_cast<const uint8*>( | 143 return const_cast<uint8*>(reinterpret_cast<const uint8*>( |
156 packet->mutable_data()->data())); | 144 packet->mutable_data()->data())); |
157 } | 145 } |
158 | 146 |
159 | 147 |
160 } // namespace remoting | 148 } // namespace remoting |
OLD | NEW |