OLD | NEW |
1 // Copyright (c) 2011 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_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); | 21 virtual void Initialize(scoped_refptr<media::VideoFrame> frame) OVERRIDE; |
22 virtual DecodeResult DecodePacket(const VideoPacket* packet); | 22 virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; |
23 virtual void GetUpdatedRects(UpdatedRects* rects); | 23 virtual void GetUpdatedRects(RectVector* rects) OVERRIDE; |
24 virtual bool IsReadyForData(); | 24 virtual bool IsReadyForData() OVERRIDE; |
25 virtual void Reset(); | 25 virtual void Reset() OVERRIDE; |
26 virtual VideoPacketFormat::Encoding Encoding(); | 26 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; |
27 virtual void SetScaleRatios(double horizontal_ratio, double vertical_ratio); | 27 virtual void SetScaleRatios(double horizontal_ratio, |
28 virtual void SetClipRect(const gfx::Rect& clip_rect); | 28 double vertical_ratio) OVERRIDE; |
29 virtual void RefreshRects(const std::vector<gfx::Rect>& rects); | 29 virtual void SetClipRect(const SkIRect& clip_rect) OVERRIDE; |
| 30 virtual void RefreshRects(const RectVector& rects) OVERRIDE; |
30 | 31 |
31 private: | 32 private: |
32 enum State { | 33 enum State { |
33 kUninitialized, | 34 kUninitialized, |
34 kReady, | 35 kReady, |
35 kError, | 36 kError, |
36 }; | 37 }; |
37 | 38 |
38 // Return true if scaling is enabled | 39 // Return true if scaling is enabled |
39 bool DoScaling() const; | 40 bool DoScaling() const; |
40 | 41 |
41 // Perform color space conversion on the specified rectangles. | 42 // Perform color space conversion on the specified rectangles. |
42 // Write the updated rectangles to |output_rects|. | 43 // Write the updated rectangles to |output_rects|. |
43 void ConvertRects(const UpdatedRects& rects, | 44 void ConvertRects(const RectVector& rects, |
44 UpdatedRects* output_rects); | 45 RectVector* output_rects); |
45 | 46 |
46 // Perform scaling and color space conversion on the specified | 47 // Perform scaling and color space conversion on the specified |
47 // rectangles. | 48 // rectangles. |
48 // Write the updated rectangles to |output_rects|. | 49 // Write the updated rectangles to |output_rects|. |
49 void ScaleAndConvertRects(const UpdatedRects& rects, | 50 void ScaleAndConvertRects(const RectVector& rects, |
50 UpdatedRects* output_rects); | 51 RectVector* output_rects); |
51 | 52 |
52 // The internal state of the decoder. | 53 // The internal state of the decoder. |
53 State state_; | 54 State state_; |
54 | 55 |
55 // The video frame to write to. | 56 // The video frame to write to. |
56 scoped_refptr<media::VideoFrame> frame_; | 57 scoped_refptr<media::VideoFrame> frame_; |
57 | 58 |
58 vpx_codec_ctx_t* codec_; | 59 vpx_codec_ctx_t* codec_; |
59 | 60 |
60 // Pointer to the last decoded image. | 61 // Pointer to the last decoded image. |
61 vpx_image_t* last_image_; | 62 vpx_image_t* last_image_; |
62 | 63 |
63 // Record the updated rects in the last decode. | 64 // Record the updated rects in the last decode. |
64 UpdatedRects updated_rects_; | 65 RectVector updated_rects_; |
65 | 66 |
66 // Clipping rect for the output of the decoder. | 67 // Clipping rect for the output of the decoder. |
67 gfx::Rect clip_rect_; | 68 SkIRect clip_rect_; |
68 | 69 |
69 // Scale factors of the decoded output. | 70 // Scale factors of the decoded output. |
70 double horizontal_scale_ratio_; | 71 double horizontal_scale_ratio_; |
71 double vertical_scale_ratio_; | 72 double vertical_scale_ratio_; |
72 | 73 |
73 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); | 74 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |
74 }; | 75 }; |
75 | 76 |
76 } // namespace remoting | 77 } // namespace remoting |
77 | 78 |
78 #endif // REMOTING_BASE_DECODER_VP8_H_ | 79 #endif // REMOTING_BASE_DECODER_VP8_H_ |
OLD | NEW |