OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 bool IsReadyForData(); | 22 virtual bool IsReadyForData(); |
23 virtual void Initialize(scoped_refptr<media::VideoFrame> frame); | 23 virtual void Initialize(scoped_refptr<media::VideoFrame> frame); |
24 virtual DecodeResult DecodePacket(const VideoPacket* packet); | 24 virtual DecodeResult DecodePacket(const VideoPacket* packet); |
25 virtual void GetUpdatedRects(UpdatedRects* rects); | 25 virtual void GetUpdatedRects(RectVector* rects); |
26 virtual void Reset(); | 26 virtual void Reset(); |
27 virtual VideoPacketFormat::Encoding Encoding(); | 27 virtual VideoPacketFormat::Encoding Encoding(); |
28 | 28 |
29 private: | 29 private: |
30 enum State { | 30 enum State { |
31 kUninitialized, | 31 kUninitialized, |
32 kReady, | 32 kReady, |
33 kProcessing, | 33 kProcessing, |
34 kPartitionDone, | 34 kPartitionDone, |
35 kDone, | 35 kDone, |
36 kError, | 36 kError, |
37 }; | 37 }; |
38 | 38 |
39 DecoderRowBased(Decompressor* decompressor, | 39 DecoderRowBased(Decompressor* decompressor, |
40 VideoPacketFormat::Encoding encoding); | 40 VideoPacketFormat::Encoding encoding); |
41 | 41 |
42 // Helper method. Called from DecodePacket to updated state of the decoder. | 42 // Helper method. Called from DecodePacket to updated state of the decoder. |
43 void UpdateStateForPacket(const VideoPacket* packet); | 43 void UpdateStateForPacket(const VideoPacket* packet); |
44 | 44 |
45 // The internal state of the decoder. | 45 // The internal state of the decoder. |
46 State state_; | 46 State state_; |
47 | 47 |
48 // Keeps track of the updating rect. | 48 // Keeps track of the updating rect. |
49 gfx::Rect clip_; | 49 SkIRect clip_; |
50 | 50 |
51 // The video frame to write to. | 51 // The video frame to write to. |
52 scoped_refptr<media::VideoFrame> frame_; | 52 scoped_refptr<media::VideoFrame> frame_; |
53 | 53 |
54 // The compression for the input byte stream. | 54 // The compression for the input byte stream. |
55 scoped_ptr<Decompressor> decompressor_; | 55 scoped_ptr<Decompressor> decompressor_; |
56 | 56 |
57 // The encoding of the incoming stream. | 57 // The encoding of the incoming stream. |
58 VideoPacketFormat::Encoding encoding_; | 58 VideoPacketFormat::Encoding encoding_; |
59 | 59 |
60 // The position in the row that we are updating. | 60 // The position in the row that we are updating. |
61 int row_pos_; | 61 int row_pos_; |
62 | 62 |
63 // The current row in the rect that we are updaing. | 63 // The current row in the rect that we are updaing. |
64 int row_y_; | 64 int row_y_; |
65 | 65 |
66 UpdatedRects updated_rects_; | 66 RectVector updated_rects_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); | 68 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace remoting | 71 } // namespace remoting |
72 | 72 |
73 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ | 73 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ |
OLD | NEW |