blob: 9c969984dd4eef451d469bd42dc50ae8d09a968a [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]87196ce2013-10-22 01:53:3921 // Create decoders for the specified protocol.
[email protected]a43cfae2013-10-19 22:14:5422 static scoped_ptr<VideoDecoderVpx> CreateForVP8();
[email protected]87196ce2013-10-22 01:53:3923 static scoped_ptr<VideoDecoderVpx> CreateForVP9();
[email protected]622b7882010-09-29 17:34:3224
dcheng562aba52014-10-21 12:30:1425 ~VideoDecoderVpx() override;
[email protected]a43cfae2013-10-19 22:14:5426
27 // VideoDecoder interface.
dcheng562aba52014-10-21 12:30:1428 void Initialize(const webrtc::DesktopSize& screen_size) override;
29 bool DecodePacket(const VideoPacket& packet) override;
30 void Invalidate(const webrtc::DesktopSize& view_size,
31 const webrtc::DesktopRegion& region) override;
32 void RenderFrame(const webrtc::DesktopSize& view_size,
33 const webrtc::DesktopRect& clip_area,
34 uint8* image_buffer,
35 int image_stride,
36 webrtc::DesktopRegion* output_region) override;
37 const webrtc::DesktopRegion* GetImageShape() override;
[email protected]622b7882010-09-29 17:34:3238
39 private:
[email protected]a43cfae2013-10-19 22:14:5440 explicit VideoDecoderVpx(ScopedVpxCodec codec);
[email protected]da4daa7f2013-06-21 10:16:4141
42 // Calculates the difference between the desktop shape regions in two
43 // consecutive frames and updates |updated_region_| and |transparent_region_|
44 // accordingly.
[email protected]e59d6592013-09-25 22:16:2145 void UpdateImageShapeRegion(webrtc::DesktopRegion* new_desktop_shape);
[email protected]da4daa7f2013-06-21 10:16:4146
[email protected]a43cfae2013-10-19 22:14:5447 ScopedVpxCodec codec_;
[email protected]622b7882010-09-29 17:34:3248
[email protected]47379e92011-07-26 15:33:1549 // Pointer to the last decoded image.
50 vpx_image_t* last_image_;
51
[email protected]55d3688e2012-02-24 23:05:5652 // The region updated that hasn't been copied to the screen yet.
[email protected]e59d6592013-09-25 22:16:2153 webrtc::DesktopRegion updated_region_;
[email protected]50686142011-02-04 02:08:3254
[email protected]15e7b6c2011-12-22 10:20:3355 // Output dimensions.
[email protected]e59d6592013-09-25 22:16:2156 webrtc::DesktopSize screen_size_;
[email protected]47379e92011-07-26 15:33:1557
[email protected]da4daa7f2013-06-21 10:16:4158 // The region occupied by the top level windows.
[email protected]e59d6592013-09-25 22:16:2159 webrtc::DesktopRegion desktop_shape_;
[email protected]da4daa7f2013-06-21 10:16:4160
61 // The region that should be make transparent.
[email protected]e59d6592013-09-25 22:16:2162 webrtc::DesktopRegion transparent_region_;
[email protected]da4daa7f2013-06-21 10:16:4163
[email protected]a43cfae2013-10-19 22:14:5464 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVpx);
[email protected]622b7882010-09-29 17:34:3265};
66
67} // namespace remoting
68
[email protected]38609832012-08-23 01:36:1069#endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_