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