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