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/decoder_row_based.h" | 5 #include "remoting/base/decoder_row_based.h" |
6 | 6 |
7 #include "remoting/base/decompressor.h" | 7 #include "remoting/base/decompressor.h" |
8 #include "remoting/base/decompressor_zlib.h" | 8 #include "remoting/base/decompressor_zlib.h" |
9 #include "remoting/base/decompressor_verbatim.h" | 9 #include "remoting/base/decompressor_verbatim.h" |
10 #include "remoting/base/util.h" | 10 #include "remoting/base/util.h" |
11 | 11 |
12 namespace remoting { | 12 namespace remoting { |
13 | 13 |
14 DecoderRowBased* DecoderRowBased::CreateZlibDecoder() { | 14 DecoderRowBased* DecoderRowBased::CreateZlibDecoder() { |
15 return new DecoderRowBased(new DecompressorZlib(), EncodingZlib); | 15 return new DecoderRowBased(new DecompressorZlib(), |
| 16 VideoPacketFormat::ENCODING_ZLIB); |
16 } | 17 } |
17 | 18 |
18 DecoderRowBased* DecoderRowBased::CreateVerbatimDecoder() { | 19 DecoderRowBased* DecoderRowBased::CreateVerbatimDecoder() { |
19 return new DecoderRowBased(new DecompressorVerbatim(), EncodingNone); | 20 return new DecoderRowBased(new DecompressorVerbatim(), |
| 21 VideoPacketFormat::ENCODING_VERBATIM); |
20 } | 22 } |
21 | 23 |
22 DecoderRowBased::DecoderRowBased(Decompressor* decompressor, | 24 DecoderRowBased::DecoderRowBased(Decompressor* decompressor, |
23 UpdateStreamEncoding encoding) | 25 VideoPacketFormat::Encoding encoding) |
24 : state_(kUninitialized), | 26 : state_(kUninitialized), |
25 decompressor_(decompressor), | 27 decompressor_(decompressor), |
26 encoding_(encoding), | 28 encoding_(encoding), |
27 bytes_per_src_pixel_(0), | 29 bytes_per_src_pixel_(0), |
28 row_pos_(0), | 30 row_pos_(0), |
29 row_y_(0), | 31 row_y_(0), |
30 // TODO(hclam): We should use the information from the update stream | 32 // TODO(hclam): We should use the information from the update stream |
31 // to determine whether we should reverse the rows or not. | 33 // to determine whether we should reverse the rows or not. |
32 // But for simplicity we set to be always true. | 34 // But for simplicity we set to be always true. |
33 reverse_rows_(true) { | 35 reverse_rows_(true) { |
(...skipping 11 matching lines...) Expand all Loading... |
45 bool DecoderRowBased::IsReadyForData() { | 47 bool DecoderRowBased::IsReadyForData() { |
46 return state_ == kReady; | 48 return state_ == kReady; |
47 } | 49 } |
48 | 50 |
49 void DecoderRowBased::Initialize(scoped_refptr<media::VideoFrame> frame, | 51 void DecoderRowBased::Initialize(scoped_refptr<media::VideoFrame> frame, |
50 const gfx::Rect& clip, | 52 const gfx::Rect& clip, |
51 int bytes_per_src_pixel) { | 53 int bytes_per_src_pixel) { |
52 // Make sure we are not currently initialized. | 54 // Make sure we are not currently initialized. |
53 CHECK_EQ(kUninitialized, state_); | 55 CHECK_EQ(kUninitialized, state_); |
54 | 56 |
55 if (static_cast<PixelFormat>(frame->format()) != PixelFormatRgb32) { | 57 if (static_cast<PixelFormat>(frame->format()) != PIXEL_FORMAT_RGB32) { |
56 LOG(WARNING) << "DecoderRowBased only supports RGB32."; | 58 LOG(WARNING) << "DecoderRowBased only supports RGB32."; |
57 state_ = kError; | 59 state_ = kError; |
58 return; | 60 return; |
59 } | 61 } |
60 | 62 |
61 frame_ = frame; | 63 frame_ = frame; |
62 | 64 |
63 // Reset the buffer location status variables. | 65 // Reset the buffer location status variables. |
64 clip_ = clip; | 66 clip_ = clip; |
65 row_pos_ = 0; | 67 row_pos_ = 0; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // If this row is completely filled then move onto the next row. | 110 // If this row is completely filled then move onto the next row. |
109 if (row_pos_ == row_size) { | 111 if (row_pos_ == row_size) { |
110 ++row_y_; | 112 ++row_y_; |
111 row_pos_ = 0; | 113 row_pos_ = 0; |
112 out += stride; | 114 out += stride; |
113 } | 115 } |
114 } | 116 } |
115 } | 117 } |
116 | 118 |
117 } // namespace remoting | 119 } // namespace remoting |
OLD | NEW |