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_VP8_H_ | 5 #ifndef REMOTING_BASE_DECODER_VP8_H_ |
6 #define REMOTING_BASE_DECODER_VP8_H_ | 6 #define REMOTING_BASE_DECODER_VP8_H_ |
7 | 7 |
8 #include "remoting/base/decoder.h" | 8 #include "remoting/base/decoder.h" |
9 | 9 |
10 typedef struct vpx_codec_ctx vpx_codec_ctx_t; | 10 typedef struct vpx_codec_ctx vpx_codec_ctx_t; |
11 typedef struct vpx_image vpx_image_t; | 11 typedef struct vpx_image vpx_image_t; |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 | 14 |
15 class DecoderVp8 : public Decoder { | 15 class DecoderVp8 : public Decoder { |
16 public: | 16 public: |
17 DecoderVp8(); | 17 DecoderVp8(); |
18 virtual ~DecoderVp8(); | 18 virtual ~DecoderVp8(); |
19 | 19 |
20 // Decoder implementations. | 20 // Decoder implementations. |
21 virtual void Initialize(scoped_refptr<media::VideoFrame> frame) OVERRIDE; | 21 virtual void Initialize(const SkISize& screen_size) OVERRIDE; |
22 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; | 22 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; |
23 virtual void GetUpdatedRegion(SkRegion* region) OVERRIDE; | |
24 virtual bool IsReadyForData() OVERRIDE; | 23 virtual bool IsReadyForData() OVERRIDE; |
25 virtual void Reset() OVERRIDE; | 24 virtual void Reset() OVERRIDE; |
26 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; | 25 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; |
27 virtual void SetOutputSize(const SkISize& size) OVERRIDE; | 26 virtual void UpdateRegion(const SkRegion& region) OVERRIDE; |
28 virtual void SetClipRect(const SkIRect& clip_rect) OVERRIDE; | 27 virtual void Draw(const SkISize& view_size, |
29 virtual void RefreshRegion(const SkRegion& region) OVERRIDE; | 28 const SkIRect& clip_area, |
29 uint8* image_buffer, | |
30 int image_stride, | |
31 SkRegion* output_region) OVERRIDE; | |
30 | 32 |
31 private: | 33 private: |
32 enum State { | 34 enum State { |
33 kUninitialized, | 35 kUninitialized, |
34 kReady, | 36 kReady, |
35 kError, | 37 kError, |
36 }; | 38 }; |
37 | 39 |
38 // Return true if scaling is enabled | |
39 bool DoScaling() const; | |
40 | |
41 // Perform color space conversion on the specified region. | |
42 // Writes the updated region to |output_region|. | |
43 void ConvertRegion(const SkRegion& region, | |
44 SkRegion* output_region); | |
45 | |
46 // Perform scaling and color space conversion on the specified | |
47 // region. Writes the updated rectangles to |output_region|. | |
48 void ScaleAndConvertRegion(const SkRegion& region, | |
49 SkRegion* output_region); | |
50 | |
51 // The internal state of the decoder. | 40 // The internal state of the decoder. |
52 State state_; | 41 State state_; |
53 | 42 |
54 // The video frame to write to. | |
55 scoped_refptr<media::VideoFrame> frame_; | |
56 | |
57 vpx_codec_ctx_t* codec_; | 43 vpx_codec_ctx_t* codec_; |
58 | 44 |
59 // Pointer to the last decoded image. | 45 // Pointer to the last decoded image. |
60 vpx_image_t* last_image_; | 46 vpx_image_t* last_image_; |
61 | 47 |
62 // The region updated by the most recent decode. | 48 // The region updated that hasn't been copied to the screen yet. |
63 SkRegion updated_region_; | 49 SkRegion updated_region_; |
Wez
2012/02/07 01:56:31
I think this needs renaming, and the semantics cla
alexeypa (please no reviews)
2012/02/15 23:06:22
Now we validate only the painted area.
| |
64 | 50 |
65 // Clipping rect for the output of the decoder. | |
66 SkIRect clip_rect_; | |
67 | |
68 // Output dimensions. | 51 // Output dimensions. |
69 SkISize output_size_; | 52 SkISize screen_size_; |
70 | 53 |
71 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); | 54 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |
72 }; | 55 }; |
73 | 56 |
74 } // namespace remoting | 57 } // namespace remoting |
75 | 58 |
76 #endif // REMOTING_BASE_DECODER_VP8_H_ | 59 #endif // REMOTING_BASE_DECODER_VP8_H_ |
OLD | NEW |