blob: 800c873b91877b93d590b7d94f4f9a6477eb9f31 [file] [log] [blame]
[email protected]a43cfae2013-10-19 22:14:541// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]622b7882010-09-29 17:34:322// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]a43cfae2013-10-19 22:14:545#ifndef REMOTING_CODEC_VIDEO_DECODER_VPX_H_
6#define REMOTING_CODEC_VIDEO_DECODER_VPX_H_
[email protected]622b7882010-09-29 17:34:327
[email protected]71f40a72012-05-16 07:26:598#include "base/compiler_specific.h"
[email protected]a43cfae2013-10-19 22:14:549#include "base/memory/scoped_ptr.h"
10#include "remoting/codec/scoped_vpx_codec.h"
[email protected]38609832012-08-23 01:36:1011#include "remoting/codec/video_decoder.h"
[email protected]e59d6592013-09-25 22:16:2112#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
13#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
[email protected]622b7882010-09-29 17:34:3214
[email protected]47379e92011-07-26 15:33:1515typedef struct vpx_image vpx_image_t;
[email protected]622b7882010-09-29 17:34:3216
17namespace remoting {
18
[email protected]a43cfae2013-10-19 22:14:5419class VideoDecoderVpx : public VideoDecoder {
[email protected]622b7882010-09-29 17:34:3220 public:
[email protected]a43cfae2013-10-19 22:14:5421 // Creates a decoder for VP8.
22 static scoped_ptr<VideoDecoderVpx> CreateForVP8();
[email protected]622b7882010-09-29 17:34:3223
[email protected]a43cfae2013-10-19 22:14:5424 virtual ~VideoDecoderVpx();
25
26 // VideoDecoder interface.
[email protected]e59d6592013-09-25 22:16:2127 virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE;
[email protected]41b93ad32013-09-23 18:53:5228 virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE;
[email protected]e59d6592013-09-25 22:16:2129 virtual void Invalidate(const webrtc::DesktopSize& view_size,
30 const webrtc::DesktopRegion& region) OVERRIDE;
31 virtual void RenderFrame(const webrtc::DesktopSize& view_size,
32 const webrtc::DesktopRect& clip_area,
[email protected]55d3688e2012-02-24 23:05:5633 uint8* image_buffer,
34 int image_stride,
[email protected]e59d6592013-09-25 22:16:2135 webrtc::DesktopRegion* output_region) OVERRIDE;
36 virtual const webrtc::DesktopRegion* GetImageShape() OVERRIDE;
[email protected]622b7882010-09-29 17:34:3237
38 private:
[email protected]a43cfae2013-10-19 22:14:5439 explicit VideoDecoderVpx(ScopedVpxCodec codec);
[email protected]da4daa7f2013-06-21 10:16:4140
41 // Calculates the difference between the desktop shape regions in two
42 // consecutive frames and updates |updated_region_| and |transparent_region_|
43 // accordingly.
[email protected]e59d6592013-09-25 22:16:2144 void UpdateImageShapeRegion(webrtc::DesktopRegion* new_desktop_shape);
[email protected]da4daa7f2013-06-21 10:16:4145
[email protected]a43cfae2013-10-19 22:14:5446 ScopedVpxCodec codec_;
[email protected]622b7882010-09-29 17:34:3247
[email protected]47379e92011-07-26 15:33:1548 // Pointer to the last decoded image.
49 vpx_image_t* last_image_;
50
[email protected]55d3688e2012-02-24 23:05:5651 // The region updated that hasn't been copied to the screen yet.
[email protected]e59d6592013-09-25 22:16:2152 webrtc::DesktopRegion updated_region_;
[email protected]50686142011-02-04 02:08:3253
[email protected]15e7b6c2011-12-22 10:20:3354 // Output dimensions.
[email protected]e59d6592013-09-25 22:16:2155 webrtc::DesktopSize screen_size_;
[email protected]47379e92011-07-26 15:33:1556
[email protected]da4daa7f2013-06-21 10:16:4157 // The region occupied by the top level windows.
[email protected]e59d6592013-09-25 22:16:2158 webrtc::DesktopRegion desktop_shape_;
[email protected]da4daa7f2013-06-21 10:16:4159
60 // The region that should be make transparent.
[email protected]e59d6592013-09-25 22:16:2161 webrtc::DesktopRegion transparent_region_;
[email protected]da4daa7f2013-06-21 10:16:4162
[email protected]a43cfae2013-10-19 22:14:5463 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVpx);
[email protected]622b7882010-09-29 17:34:3264};
65
66} // namespace remoting
67
[email protected]38609832012-08-23 01:36:1068#endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_