| 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_VP8_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_DECODER_VP8_H_ |
| 6 #define REMOTING_CODEC_VIDEO_DECODER_VP8_H_ | 6 #define REMOTING_CODEC_VIDEO_DECODER_VP8_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "remoting/codec/video_decoder.h" | 9 #include "remoting/codec/video_decoder.h" |
| 10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
| 10 | 12 |
| 11 typedef struct vpx_codec_ctx vpx_codec_ctx_t; | 13 typedef struct vpx_codec_ctx vpx_codec_ctx_t; |
| 12 typedef struct vpx_image vpx_image_t; | 14 typedef struct vpx_image vpx_image_t; |
| 13 | 15 |
| 14 namespace remoting { | 16 namespace remoting { |
| 15 | 17 |
| 16 class VideoDecoderVp8 : public VideoDecoder { | 18 class VideoDecoderVp8 : public VideoDecoder { |
| 17 public: | 19 public: |
| 18 VideoDecoderVp8(); | 20 VideoDecoderVp8(); |
| 19 virtual ~VideoDecoderVp8(); | 21 virtual ~VideoDecoderVp8(); |
| 20 | 22 |
| 21 // VideoDecoder implementations. | 23 // VideoDecoder implementations. |
| 22 virtual void Initialize(const SkISize& screen_size) OVERRIDE; | 24 virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE; |
| 23 virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE; | 25 virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE; |
| 24 virtual void Invalidate(const SkISize& view_size, | 26 virtual void Invalidate(const webrtc::DesktopSize& view_size, |
| 25 const SkRegion& region) OVERRIDE; | 27 const webrtc::DesktopRegion& region) OVERRIDE; |
| 26 virtual void RenderFrame(const SkISize& view_size, | 28 virtual void RenderFrame(const webrtc::DesktopSize& view_size, |
| 27 const SkIRect& clip_area, | 29 const webrtc::DesktopRect& clip_area, |
| 28 uint8* image_buffer, | 30 uint8* image_buffer, |
| 29 int image_stride, | 31 int image_stride, |
| 30 SkRegion* output_region) OVERRIDE; | 32 webrtc::DesktopRegion* output_region) OVERRIDE; |
| 31 virtual const SkRegion* GetImageShape() OVERRIDE; | 33 virtual const webrtc::DesktopRegion* GetImageShape() OVERRIDE; |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 enum State { | 36 enum State { |
| 35 kUninitialized, | 37 kUninitialized, |
| 36 kReady, | 38 kReady, |
| 37 kError, | 39 kError, |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 // Fills the rectangle |rect| with the given ARGB color |color| in |buffer|. | 42 // Fills the rectangle |rect| with the given ARGB color |color| in |buffer|. |
| 41 void FillRect(uint8* buffer, int stride, const SkIRect& rect, uint32 color); | 43 void FillRect(uint8* buffer, int stride, |
| 44 const webrtc::DesktopRect& rect, |
| 45 uint32 color); |
| 42 | 46 |
| 43 // Calculates the difference between the desktop shape regions in two | 47 // Calculates the difference between the desktop shape regions in two |
| 44 // consecutive frames and updates |updated_region_| and |transparent_region_| | 48 // consecutive frames and updates |updated_region_| and |transparent_region_| |
| 45 // accordingly. | 49 // accordingly. |
| 46 void UpdateImageShapeRegion(SkRegion* new_desktop_shape); | 50 void UpdateImageShapeRegion(webrtc::DesktopRegion* new_desktop_shape); |
| 47 | 51 |
| 48 // The internal state of the decoder. | 52 // The internal state of the decoder. |
| 49 State state_; | 53 State state_; |
| 50 | 54 |
| 51 vpx_codec_ctx_t* codec_; | 55 vpx_codec_ctx_t* codec_; |
| 52 | 56 |
| 53 // Pointer to the last decoded image. | 57 // Pointer to the last decoded image. |
| 54 vpx_image_t* last_image_; | 58 vpx_image_t* last_image_; |
| 55 | 59 |
| 56 // The region updated that hasn't been copied to the screen yet. | 60 // The region updated that hasn't been copied to the screen yet. |
| 57 SkRegion updated_region_; | 61 webrtc::DesktopRegion updated_region_; |
| 58 | 62 |
| 59 // Output dimensions. | 63 // Output dimensions. |
| 60 SkISize screen_size_; | 64 webrtc::DesktopSize screen_size_; |
| 61 | 65 |
| 62 // The region occupied by the top level windows. | 66 // The region occupied by the top level windows. |
| 63 SkRegion desktop_shape_; | 67 webrtc::DesktopRegion desktop_shape_; |
| 64 | 68 |
| 65 // The region that should be make transparent. | 69 // The region that should be make transparent. |
| 66 SkRegion transparent_region_; | 70 webrtc::DesktopRegion transparent_region_; |
| 67 | 71 |
| 68 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVp8); | 72 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVp8); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 } // namespace remoting | 75 } // namespace remoting |
| 72 | 76 |
| 73 #endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_ | 77 #endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_ |
| OLD | NEW |