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
3 // found in the LICENSE file.
5 #ifndef REMOTING_CODEC_VIDEO_DECODER_VPX_H_
6 #define REMOTING_CODEC_VIDEO_DECODER_VPX_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "remoting/codec/scoped_vpx_codec.h"
11 #include "remoting/codec/video_decoder.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
13 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
15 typedef const struct vpx_codec_iface vpx_codec_iface_t
;
16 typedef struct vpx_image vpx_image_t
;
20 class VideoDecoderVpx
: public VideoDecoder
{
22 // Create decoders for the specified protocol.
23 static scoped_ptr
<VideoDecoderVpx
> CreateForVP8();
24 static scoped_ptr
<VideoDecoderVpx
> CreateForVP9();
26 ~VideoDecoderVpx() override
;
28 // VideoDecoder interface.
29 void Initialize(const webrtc::DesktopSize
& source_size
) override
;
30 bool DecodePacket(const VideoPacket
& packet
) override
;
31 void Invalidate(const webrtc::DesktopSize
& view_size
,
32 const webrtc::DesktopRegion
& region
) override
;
33 void RenderFrame(const webrtc::DesktopSize
& view_size
,
34 const webrtc::DesktopRect
& clip_area
,
37 webrtc::DesktopRegion
* output_region
) override
;
38 const webrtc::DesktopRegion
* GetImageShape() override
;
41 explicit VideoDecoderVpx(vpx_codec_iface_t
* codec
);
43 // Returns the dimensions of the most recent frame as a DesktopSize.
44 webrtc::DesktopSize
image_size() const;
46 ScopedVpxCodec codec_
;
48 // Pointer to the most recently decoded image.
51 // Area of the source that has changed since the last RenderFrame call.
52 webrtc::DesktopRegion updated_region_
;
54 // The shape of the most-recent frame, if any.
55 scoped_ptr
<webrtc::DesktopRegion
> desktop_shape_
;
57 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVpx
);
60 } // namespace remoting
62 #endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_