OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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() OVERRIDE; | 22 virtual bool IsReadyForData() OVERRIDE; |
23 virtual void Initialize(scoped_refptr<media::VideoFrame> frame) OVERRIDE; | 23 virtual void Initialize(const SkISize& screen_size) OVERRIDE; |
24 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; | 24 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; |
25 virtual void GetUpdatedRegion(SkRegion* region) OVERRIDE; | |
26 virtual void Reset() OVERRIDE; | |
27 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; | 25 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; |
| 26 virtual void Invalidate(const SkISize& view_size, |
| 27 const SkRegion& region) OVERRIDE; |
| 28 virtual void RenderFrame(const SkISize& view_size, |
| 29 const SkIRect& clip_area, |
| 30 uint8* image_buffer, |
| 31 int image_stride, |
| 32 SkRegion* output_region) OVERRIDE; |
28 | 33 |
29 private: | 34 private: |
30 enum State { | 35 enum State { |
31 kUninitialized, | 36 kUninitialized, |
32 kReady, | 37 kReady, |
33 kProcessing, | 38 kProcessing, |
34 kPartitionDone, | 39 kPartitionDone, |
35 kDone, | 40 kDone, |
36 kError, | 41 kError, |
37 }; | 42 }; |
38 | 43 |
39 DecoderRowBased(Decompressor* decompressor, | 44 DecoderRowBased(Decompressor* decompressor, |
40 VideoPacketFormat::Encoding encoding); | 45 VideoPacketFormat::Encoding encoding); |
41 | 46 |
42 // Helper method. Called from DecodePacket to updated state of the decoder. | 47 // Helper method. Called from DecodePacket to updated state of the decoder. |
43 void UpdateStateForPacket(const VideoPacket* packet); | 48 void UpdateStateForPacket(const VideoPacket* packet); |
44 | 49 |
45 // The internal state of the decoder. | 50 // The internal state of the decoder. |
46 State state_; | 51 State state_; |
47 | 52 |
48 // Keeps track of the updating rect. | 53 // Keeps track of the updating rect. |
49 SkIRect clip_; | 54 SkIRect clip_; |
50 | 55 |
51 // The video frame to write to. | |
52 scoped_refptr<media::VideoFrame> frame_; | |
53 | |
54 // The compression for the input byte stream. | 56 // The compression for the input byte stream. |
55 scoped_ptr<Decompressor> decompressor_; | 57 scoped_ptr<Decompressor> decompressor_; |
56 | 58 |
57 // The encoding of the incoming stream. | 59 // The encoding of the incoming stream. |
58 VideoPacketFormat::Encoding encoding_; | 60 VideoPacketFormat::Encoding encoding_; |
59 | 61 |
60 // The position in the row that we are updating. | 62 // The position in the row that we are updating. |
61 int row_pos_; | 63 int row_pos_; |
62 | 64 |
63 // The current row in the rect that we are updaing. | 65 // The current row in the rect that we are updaing. |
64 int row_y_; | 66 int row_y_; |
65 | 67 |
| 68 // The region updated that hasn't been copied to the screen yet. |
66 SkRegion updated_region_; | 69 SkRegion updated_region_; |
67 | 70 |
| 71 // Size of the remote screen. |
| 72 SkISize screen_size_; |
| 73 |
| 74 // The bitmap holding the remote screen bits. |
| 75 scoped_array<uint8> screen_buffer_; |
| 76 |
68 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); | 77 DISALLOW_COPY_AND_ASSIGN(DecoderRowBased); |
69 }; | 78 }; |
70 | 79 |
71 } // namespace remoting | 80 } // namespace remoting |
72 | 81 |
73 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ | 82 #endif // REMOTING_BASE_DECODER_ROW_BASED_H_ |
OLD | NEW |