blob: 42a317659d93752a4f1adb1b1fa16bde2e1b2f43 [file] [log] [blame]
[email protected]a9c88d12012-01-29 03:45:171// Copyright (c) 2012 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]38609832012-08-23 01:36:105#ifndef REMOTING_CODEC_VIDEO_DECODER_VP8_H_
6#define REMOTING_CODEC_VIDEO_DECODER_VP8_H_
[email protected]622b7882010-09-29 17:34:327
[email protected]71f40a72012-05-16 07:26:598#include "base/compiler_specific.h"
[email protected]38609832012-08-23 01:36:109#include "remoting/codec/video_decoder.h"
[email protected]e59d6592013-09-25 22:16:2110#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
11#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
[email protected]622b7882010-09-29 17:34:3212
13typedef struct vpx_codec_ctx vpx_codec_ctx_t;
[email protected]47379e92011-07-26 15:33:1514typedef struct vpx_image vpx_image_t;
[email protected]622b7882010-09-29 17:34:3215
16namespace remoting {
17
[email protected]d9004e42012-08-24 01:47:3718class VideoDecoderVp8 : public VideoDecoder {
[email protected]622b7882010-09-29 17:34:3219 public:
[email protected]d9004e42012-08-24 01:47:3720 VideoDecoderVp8();
21 virtual ~VideoDecoderVp8();
[email protected]622b7882010-09-29 17:34:3222
[email protected]d9004e42012-08-24 01:47:3723 // VideoDecoder implementations.
[email protected]e59d6592013-09-25 22:16:2124 virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE;
[email protected]41b93ad32013-09-23 18:53:5225 virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE;
[email protected]e59d6592013-09-25 22:16:2126 virtual void Invalidate(const webrtc::DesktopSize& view_size,
27 const webrtc::DesktopRegion& region) OVERRIDE;
28 virtual void RenderFrame(const webrtc::DesktopSize& view_size,
29 const webrtc::DesktopRect& clip_area,
[email protected]55d3688e2012-02-24 23:05:5630 uint8* image_buffer,
31 int image_stride,
[email protected]e59d6592013-09-25 22:16:2132 webrtc::DesktopRegion* output_region) OVERRIDE;
33 virtual const webrtc::DesktopRegion* GetImageShape() OVERRIDE;
[email protected]622b7882010-09-29 17:34:3234
35 private:
[email protected]04b36142010-11-02 01:08:1936 enum State {
37 kUninitialized,
38 kReady,
39 kError,
40 };
[email protected]622b7882010-09-29 17:34:3241
[email protected]da4daa7f2013-06-21 10:16:4142 // Fills the rectangle |rect| with the given ARGB color |color| in |buffer|.
[email protected]e59d6592013-09-25 22:16:2143 void FillRect(uint8* buffer, int stride,
44 const webrtc::DesktopRect& rect,
45 uint32 color);
[email protected]da4daa7f2013-06-21 10:16:4146
47 // Calculates the difference between the desktop shape regions in two
48 // consecutive frames and updates |updated_region_| and |transparent_region_|
49 // accordingly.
[email protected]e59d6592013-09-25 22:16:2150 void UpdateImageShapeRegion(webrtc::DesktopRegion* new_desktop_shape);
[email protected]da4daa7f2013-06-21 10:16:4151
[email protected]622b7882010-09-29 17:34:3252 // The internal state of the decoder.
53 State state_;
54
[email protected]622b7882010-09-29 17:34:3255 vpx_codec_ctx_t* codec_;
56
[email protected]47379e92011-07-26 15:33:1557 // Pointer to the last decoded image.
58 vpx_image_t* last_image_;
59
[email protected]55d3688e2012-02-24 23:05:5660 // The region updated that hasn't been copied to the screen yet.
[email protected]e59d6592013-09-25 22:16:2161 webrtc::DesktopRegion updated_region_;
[email protected]50686142011-02-04 02:08:3262
[email protected]15e7b6c2011-12-22 10:20:3363 // Output dimensions.
[email protected]e59d6592013-09-25 22:16:2164 webrtc::DesktopSize screen_size_;
[email protected]47379e92011-07-26 15:33:1565
[email protected]da4daa7f2013-06-21 10:16:4166 // The region occupied by the top level windows.
[email protected]e59d6592013-09-25 22:16:2167 webrtc::DesktopRegion desktop_shape_;
[email protected]da4daa7f2013-06-21 10:16:4168
69 // The region that should be make transparent.
[email protected]e59d6592013-09-25 22:16:2170 webrtc::DesktopRegion transparent_region_;
[email protected]da4daa7f2013-06-21 10:16:4171
[email protected]d9004e42012-08-24 01:47:3772 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVp8);
[email protected]622b7882010-09-29 17:34:3273};
74
75} // namespace remoting
76
[email protected]38609832012-08-23 01:36:1077#endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_