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; | |
26 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; | 24 virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; |
27 virtual void SetOutputSize(const SkISize& size) OVERRIDE; | 25 virtual void Invalidate(const SkISize& view_size, |
28 virtual void SetClipRect(const SkIRect& clip_rect) OVERRIDE; | 26 const SkRegion& region) OVERRIDE; |
29 virtual void RefreshRegion(const SkRegion& region) OVERRIDE; | 27 virtual void RenderFrame(const SkISize& view_size, |
| 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 // The internal state of the decoder. | 40 // The internal state of the decoder. |
39 State state_; | 41 State state_; |
40 | 42 |
41 // The video frame to write to. | |
42 scoped_refptr<media::VideoFrame> frame_; | |
43 | |
44 vpx_codec_ctx_t* codec_; | 43 vpx_codec_ctx_t* codec_; |
45 | 44 |
46 // Pointer to the last decoded image. | 45 // Pointer to the last decoded image. |
47 vpx_image_t* last_image_; | 46 vpx_image_t* last_image_; |
48 | 47 |
49 // The region updated by the most recent decode. | 48 // The region updated that hasn't been copied to the screen yet. |
50 SkRegion updated_region_; | 49 SkRegion updated_region_; |
51 | 50 |
52 // Clipping rect for the output of the decoder. | |
53 SkIRect clip_rect_; | |
54 | |
55 // Output dimensions. | 51 // Output dimensions. |
56 SkISize output_size_; | 52 SkISize screen_size_; |
57 | 53 |
58 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); | 54 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |
59 }; | 55 }; |
60 | 56 |
61 } // namespace remoting | 57 } // namespace remoting |
62 | 58 |
63 #endif // REMOTING_BASE_DECODER_VP8_H_ | 59 #endif // REMOTING_BASE_DECODER_VP8_H_ |
OLD | NEW |