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_CODEC_VIDEO_DECODER_ROW_BASED_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_DECODER_VERBATIM_H_ |
6 #define REMOTING_CODEC_VIDEO_DECODER_ROW_BASED_H_ | 6 #define REMOTING_CODEC_VIDEO_DECODER_VERBATIM_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "remoting/codec/video_decoder.h" | 10 #include "remoting/codec/video_decoder.h" |
11 | 11 |
12 namespace remoting { | 12 namespace remoting { |
13 | 13 |
14 class Decompressor; | 14 class VideoDecoderVerbatim : public VideoDecoder { |
Wez
2012/10/17 22:25:16
nit: Add a comment explaining what this class does
Sergey Ulanov
2012/10/18 01:09:52
Done.
| |
15 public: | |
16 virtual ~VideoDecoderVerbatim(); | |
15 | 17 |
16 class VideoDecoderRowBased : public VideoDecoder { | 18 VideoDecoderVerbatim(); |
17 public: | |
18 virtual ~VideoDecoderRowBased(); | |
19 | |
20 static VideoDecoderRowBased* CreateZlibDecoder(); | |
21 static VideoDecoderRowBased* CreateVerbatimDecoder(); | |
22 | 19 |
23 // VideoDecoder implementation. | 20 // VideoDecoder implementation. |
24 virtual bool IsReadyForData() OVERRIDE; | 21 virtual bool IsReadyForData() OVERRIDE; |
25 virtual void Initialize(const SkISize& screen_size) OVERRIDE; | 22 virtual void Initialize(const SkISize& screen_size) OVERRIDE; |
26 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; | 23 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; |
27 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; | 24 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; |
28 virtual void Invalidate(const SkISize& view_size, | 25 virtual void Invalidate(const SkISize& view_size, |
29 const SkRegion& region) OVERRIDE; | 26 const SkRegion& region) OVERRIDE; |
30 virtual void RenderFrame(const SkISize& view_size, | 27 virtual void RenderFrame(const SkISize& view_size, |
31 const SkIRect& clip_area, | 28 const SkIRect& clip_area, |
32 uint8* image_buffer, | 29 uint8* image_buffer, |
33 int image_stride, | 30 int image_stride, |
34 SkRegion* output_region) OVERRIDE; | 31 SkRegion* output_region) OVERRIDE; |
35 | 32 |
36 private: | 33 private: |
37 enum State { | 34 enum State { |
38 kUninitialized, | 35 kUninitialized, |
39 kReady, | 36 kReady, |
40 kProcessing, | 37 kProcessing, |
41 kPartitionDone, | 38 kPartitionDone, |
42 kDone, | 39 kDone, |
43 kError, | 40 kError, |
44 }; | 41 }; |
45 | 42 |
46 VideoDecoderRowBased(Decompressor* decompressor, | |
47 VideoPacketFormat::Encoding encoding); | |
48 | 43 |
49 // Helper method. Called from DecodePacket to updated state of the decoder. | 44 // Helper method. Called from DecodePacket to updated state of the decoder. |
50 void UpdateStateForPacket(const VideoPacket* packet); | 45 void UpdateStateForPacket(const VideoPacket* packet); |
51 | 46 |
52 // The internal state of the decoder. | 47 // The internal state of the decoder. |
53 State state_; | 48 State state_; |
54 | 49 |
55 // Keeps track of the updating rect. | 50 // Keeps track of the updating rect. |
56 SkIRect clip_; | 51 SkIRect clip_; |
57 | 52 |
58 // The compression for the input byte stream. | |
59 scoped_ptr<Decompressor> decompressor_; | |
60 | |
61 // The encoding of the incoming stream. | |
62 VideoPacketFormat::Encoding encoding_; | |
63 | |
64 // The position in the row that we are updating. | 53 // The position in the row that we are updating. |
65 int row_pos_; | 54 int row_pos_; |
66 | 55 |
67 // The current row in the rect that we are updaing. | 56 // The current row in the rect that we are updaing. |
68 int row_y_; | 57 int row_y_; |
69 | 58 |
70 // The region updated that hasn't been copied to the screen yet. | 59 // The region updated that hasn't been copied to the screen yet. |
71 SkRegion updated_region_; | 60 SkRegion updated_region_; |
72 | 61 |
73 // Size of the remote screen. | 62 // Size of the remote screen. |
74 SkISize screen_size_; | 63 SkISize screen_size_; |
75 | 64 |
76 // The bitmap holding the remote screen bits. | 65 // The bitmap holding the remote screen bits. |
77 scoped_array<uint8> screen_buffer_; | 66 scoped_array<uint8> screen_buffer_; |
78 | 67 |
79 DISALLOW_COPY_AND_ASSIGN(VideoDecoderRowBased); | 68 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVerbatim); |
80 }; | 69 }; |
81 | 70 |
82 } // namespace remoting | 71 } // namespace remoting |
83 | 72 |
84 #endif // REMOTING_CODEC_VIDEO_DECODER_ROW_BASED_H_ | 73 #endif // REMOTING_CODEC_VIDEO_DECODER_VERBATIM_H_ |
OLD | NEW |