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 |
24 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder() { | 30 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder() { |
25 return new EncoderRowBased(new CompressorVerbatim(), | 31 return new EncoderRowBased(new CompressorVerbatim(), |
26 VideoPacketFormat::ENCODING_VERBATIM); | 32 VideoPacketFormat::ENCODING_VERBATIM); |
27 } | 33 } |
28 | 34 |
| 35 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder(int packet_size) { |
| 36 return new EncoderRowBased(new CompressorVerbatim(), |
| 37 VideoPacketFormat::ENCODING_VERBATIM, |
| 38 packet_size); |
| 39 } |
| 40 |
29 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 41 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
30 VideoPacketFormat::Encoding encoding) | 42 VideoPacketFormat::Encoding encoding) |
31 : encoding_(encoding), | 43 : encoding_(encoding), |
32 compressor_(compressor), | 44 compressor_(compressor), |
33 packet_size_(kPacketSize) { | 45 packet_size_(kPacketSize) { |
34 } | 46 } |
35 | 47 |
36 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 48 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
37 VideoPacketFormat::Encoding encoding, | 49 VideoPacketFormat::Encoding encoding, |
38 int packet_size) | 50 int packet_size) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 151 |
140 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { | 152 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { |
141 packet->mutable_data()->resize(size); | 153 packet->mutable_data()->resize(size); |
142 // TODO(ajwong): Is there a better way to do this at all??? | 154 // TODO(ajwong): Is there a better way to do this at all??? |
143 return const_cast<uint8*>(reinterpret_cast<const uint8*>( | 155 return const_cast<uint8*>(reinterpret_cast<const uint8*>( |
144 packet->mutable_data()->data())); | 156 packet->mutable_data()->data())); |
145 } | 157 } |
146 | 158 |
147 | 159 |
148 } // namespace remoting | 160 } // namespace remoting |
OLD | NEW |