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_ZLIB_H_ | |
6 #define REMOTING_BASE_DECODER_ZLIB_H_ | |
7 | |
8 #include "remoting/base/decoder.h" | |
9 | |
10 namespace remoting { | |
11 | |
12 class DecompressorZlib; | |
13 | |
14 class DecoderZlib : public Decoder { | |
15 public: | |
16 DecoderZlib(); | |
17 | |
18 // Decoder implementations. | |
19 virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame, | |
20 UpdatedRects* update_rects, | |
21 Task* partial_decode_done, | |
22 Task* decode_done); | |
23 virtual bool PartialDecode(ChromotingHostMessage* message); | |
24 virtual void EndDecode(); | |
25 | |
26 // TODO(hclam): Should make this into the Decoder interface. | |
27 void set_reverse_rows(bool reverse) { reverse_rows_ = reverse; } | |
28 | |
29 private: | |
30 bool HandleBeginRect(ChromotingHostMessage* message); | |
31 bool HandleRectData(ChromotingHostMessage* message); | |
32 bool HandleEndRect(ChromotingHostMessage* message); | |
33 | |
34 // The internal state of the decoder. | |
35 State state_; | |
36 | |
37 // Keeps track of the updating rect. | |
38 int rect_x_; | |
39 int rect_y_; | |
40 int rect_width_; | |
41 int rect_height_; | |
42 int bytes_per_pixel_; | |
43 | |
44 // Tasks to call when decode is done. | |
45 scoped_ptr<Task> partial_decode_done_; | |
46 scoped_ptr<Task> decode_done_; | |
47 | |
48 // The video frame to write to. | |
49 scoped_refptr<media::VideoFrame> frame_; | |
50 UpdatedRects* updated_rects_; | |
51 | |
52 // A zlib decompressor used throughout one update sequence. | |
53 scoped_ptr<DecompressorZlib> decompressor_; | |
54 | |
55 // The position in the row that we are updating. | |
56 int row_pos_; | |
57 | |
58 // The row number in the rect that we are updaing. | |
59 int row_y_; | |
60 | |
61 // True if we should decode the image upside down. | |
62 bool reverse_rows_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(DecoderZlib); | |
65 }; | |
66 | |
67 } // namespace remoting | |
68 | |
69 #endif // REMOTING_BASE_DECODER_ZLIB_H_ | |
OLD | NEW |