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 VideoPacketFormat::Encoding Encoding() { return encoding_; } | 27 virtual UpdateStreamEncoding 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, | 35 DecoderRowBased(Decompressor* decompressor, UpdateStreamEncoding encoding); |
36 VideoPacketFormat::Encoding encoding); | |
37 | 36 |
38 enum State { | 37 enum State { |
39 kUninitialized, | 38 kUninitialized, |
40 kReady, | 39 kReady, |
41 kError, | 40 kError, |
42 }; | 41 }; |
43 | 42 |
44 // The internal state of the decoder. | 43 // The internal state of the decoder. |
45 State state_; | 44 State state_; |
46 | 45 |
47 // Keeps track of the updating rect. | 46 // Keeps track of the updating rect. |
48 gfx::Rect clip_; | 47 gfx::Rect clip_; |
49 | 48 |
50 // The video frame to write to. | 49 // The video frame to write to. |
51 scoped_refptr<media::VideoFrame> frame_; | 50 scoped_refptr<media::VideoFrame> frame_; |
52 | 51 |
53 // The compression for the input byte stream. | 52 // The compression for the input byte stream. |
54 scoped_ptr<Decompressor> decompressor_; | 53 scoped_ptr<Decompressor> decompressor_; |
55 | 54 |
56 // The encoding of the incoming stream. | 55 // The encoding of the incoming stream. |
57 VideoPacketFormat::Encoding encoding_; | 56 UpdateStreamEncoding encoding_; |
58 | 57 |
59 // Number of bytes per pixel from source stream. | 58 // Number of bytes per pixel from source stream. |
60 int bytes_per_src_pixel_; | 59 int bytes_per_src_pixel_; |
61 | 60 |
62 // The position in the row that we are updating. | 61 // The position in the row that we are updating. |
63 int row_pos_; | 62 int row_pos_; |
64 | 63 |
65 // The current row in the rect that we are updaing. | 64 // The current row in the rect that we are updaing. |
66 int row_y_; | 65 int row_y_; |
67 | 66 |
68 // True if we should decode the image upside down. | 67 // True if we should decode the image upside down. |
69 bool reverse_rows_; | 68 bool reverse_rows_; |
70 | 69 |
71 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); | 70 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); |
72 }; | 71 }; |
73 | 72 |
74 } // namespace remoting | 73 } // namespace remoting |
75 | 74 |
76 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ | 75 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ |
OLD | NEW |