OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_BASE_DECODER_ROW_BASED_H_ |
| 6 #define REMOTING_BASE_DECODER_ROW_BASED_H_ |
| 7 |
| 8 #include "remoting/base/decoder.h" |
| 9 |
| 10 namespace remoting { |
| 11 |
| 12 class Decompressor; |
| 13 |
| 14 class DecoderRowBased : public Decoder { |
| 15 public: |
| 16 virtual ~DecoderRowBased(); |
| 17 |
| 18 static DecoderRowBased* CreateZlibDecoder(); |
| 19 static DecoderRowBased* CreateVerbatimDecoder(); |
| 20 |
| 21 // Decoder implementation. |
| 22 virtual void Reset(); |
| 23 virtual bool IsReadyForData(); |
| 24 virtual void Initialize(scoped_refptr<media::VideoFrame> frame, |
| 25 const gfx::Rect& clip, int bytes_per_src_pixel); |
| 26 virtual void DecodeBytes(const std::string& encoded_bytes); |
| 27 virtual UpdateStreamEncoding Encoding() { return encoding_; } |
| 28 |
| 29 // TODO(hclam): Should make this into the Decoder interface. |
| 30 // TODO(ajwong): Before putting into the interface, we should decide if the |
| 31 // Host should normalize the coordinate system. |
| 32 void set_reverse_rows(bool reverse) { reverse_rows_ = reverse; } |
| 33 |
| 34 private: |
| 35 DecoderRowBased(Decompressor* decompressor, UpdateStreamEncoding encoding); |
| 36 |
| 37 enum State { |
| 38 kUninitialized, |
| 39 kReady, |
| 40 kError, |
| 41 }; |
| 42 |
| 43 // The internal state of the decoder. |
| 44 State state_; |
| 45 |
| 46 // Keeps track of the updating rect. |
| 47 gfx::Rect clip_; |
| 48 |
| 49 // The video frame to write to. |
| 50 scoped_refptr<media::VideoFrame> frame_; |
| 51 |
| 52 // The compression for the input byte stream. |
| 53 scoped_ptr<Decompressor> decompressor_; |
| 54 |
| 55 // The encoding of the incoming stream. |
| 56 UpdateStreamEncoding encoding_; |
| 57 |
| 58 // Number of bytes per pixel from source stream. |
| 59 int bytes_per_src_pixel_; |
| 60 |
| 61 // The position in the row that we are updating. |
| 62 int row_pos_; |
| 63 |
| 64 // The current row in the rect that we are updaing. |
| 65 int row_y_; |
| 66 |
| 67 // True if we should decode the image upside down. |
| 68 bool reverse_rows_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); |
| 71 }; |
| 72 |
| 73 } // namespace remoting |
| 74 |
| 75 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ |
OLD | NEW |