| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VPX_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_DECODER_VPX_H_ |
| 6 #define REMOTING_CODEC_VIDEO_DECODER_VPX_H_ | 6 #define REMOTING_CODEC_VIDEO_DECODER_VPX_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/scoped_vpx_codec.h" | 10 #include "remoting/codec/scoped_vpx_codec.h" |
| 11 #include "remoting/codec/video_decoder.h" | 11 #include "remoting/codec/video_decoder.h" |
| 12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 13 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" | 13 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
| 14 | 14 |
| 15 typedef const struct vpx_codec_iface vpx_codec_iface_t; |
| 15 typedef struct vpx_image vpx_image_t; | 16 typedef struct vpx_image vpx_image_t; |
| 16 | 17 |
| 17 namespace remoting { | 18 namespace remoting { |
| 18 | 19 |
| 19 class VideoDecoderVpx : public VideoDecoder { | 20 class VideoDecoderVpx : public VideoDecoder { |
| 20 public: | 21 public: |
| 21 // Create decoders for the specified protocol. | 22 // Create decoders for the specified protocol. |
| 22 static scoped_ptr<VideoDecoderVpx> CreateForVP8(); | 23 static scoped_ptr<VideoDecoderVpx> CreateForVP8(); |
| 23 static scoped_ptr<VideoDecoderVpx> CreateForVP9(); | 24 static scoped_ptr<VideoDecoderVpx> CreateForVP9(); |
| 24 | 25 |
| 25 ~VideoDecoderVpx() override; | 26 ~VideoDecoderVpx() override; |
| 26 | 27 |
| 27 // VideoDecoder interface. | 28 // VideoDecoder interface. |
| 28 void Initialize(const webrtc::DesktopSize& screen_size) override; | 29 void Initialize(const webrtc::DesktopSize& source_size) override; |
| 29 bool DecodePacket(const VideoPacket& packet) override; | 30 bool DecodePacket(const VideoPacket& packet) override; |
| 30 void Invalidate(const webrtc::DesktopSize& view_size, | 31 void Invalidate(const webrtc::DesktopSize& view_size, |
| 31 const webrtc::DesktopRegion& region) override; | 32 const webrtc::DesktopRegion& region) override; |
| 32 void RenderFrame(const webrtc::DesktopSize& view_size, | 33 void RenderFrame(const webrtc::DesktopSize& view_size, |
| 33 const webrtc::DesktopRect& clip_area, | 34 const webrtc::DesktopRect& clip_area, |
| 34 uint8* image_buffer, | 35 uint8* image_buffer, |
| 35 int image_stride, | 36 int image_stride, |
| 36 webrtc::DesktopRegion* output_region) override; | 37 webrtc::DesktopRegion* output_region) override; |
| 37 const webrtc::DesktopRegion* GetImageShape() override; | 38 const webrtc::DesktopRegion* GetImageShape() override; |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 explicit VideoDecoderVpx(ScopedVpxCodec codec); | 41 explicit VideoDecoderVpx(vpx_codec_iface_t* codec); |
| 41 | 42 |
| 42 // Calculates the difference between the desktop shape regions in two | 43 // Returns the dimensions of the most recent frame as a DesktopSize. |
| 43 // consecutive frames and updates |updated_region_| and |transparent_region_| | 44 webrtc::DesktopSize image_size() const; |
| 44 // accordingly. | |
| 45 void UpdateImageShapeRegion(webrtc::DesktopRegion* new_desktop_shape); | |
| 46 | 45 |
| 47 ScopedVpxCodec codec_; | 46 ScopedVpxCodec codec_; |
| 48 | 47 |
| 49 // Pointer to the last decoded image. | 48 // Pointer to the most recently decoded image. |
| 50 vpx_image_t* last_image_; | 49 vpx_image_t* image_; |
| 51 | 50 |
| 52 // The region updated that hasn't been copied to the screen yet. | 51 // Area of the source that has changed since the last RenderFrame call. |
| 53 webrtc::DesktopRegion updated_region_; | 52 webrtc::DesktopRegion updated_region_; |
| 54 | 53 |
| 55 // Output dimensions. | 54 // The shape of the most-recent frame, if any. |
| 56 webrtc::DesktopSize screen_size_; | 55 scoped_ptr<webrtc::DesktopRegion> desktop_shape_; |
| 57 | |
| 58 // The region occupied by the top level windows. | |
| 59 webrtc::DesktopRegion desktop_shape_; | |
| 60 | |
| 61 // The region that should be make transparent. | |
| 62 webrtc::DesktopRegion transparent_region_; | |
| 63 | 56 |
| 64 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVpx); | 57 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVpx); |
| 65 }; | 58 }; |
| 66 | 59 |
| 67 } // namespace remoting | 60 } // namespace remoting |
| 68 | 61 |
| 69 #endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_ | 62 #endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_ |
| OLD | NEW |