blob: 6912ab0361e4cd753d063559b1f8115a88e11ce7 [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]622b7882010-09-29 17:34:3210
11typedef struct vpx_codec_ctx vpx_codec_ctx_t;
[email protected]47379e92011-07-26 15:33:1512typedef struct vpx_image vpx_image_t;
[email protected]622b7882010-09-29 17:34:3213
14namespace remoting {
15
[email protected]d9004e42012-08-24 01:47:3716class VideoDecoderVp8 : public VideoDecoder {
[email protected]622b7882010-09-29 17:34:3217 public:
[email protected]d9004e42012-08-24 01:47:3718 VideoDecoderVp8();
19 virtual ~VideoDecoderVp8();
[email protected]622b7882010-09-29 17:34:3220
[email protected]d9004e42012-08-24 01:47:3721 // VideoDecoder implementations.
[email protected]b4e505942013-09-19 21:24:2822 virtual void Initialize(const SkISize& screen_size) OVERRIDE;
[email protected]41b93ad32013-09-23 18:53:5223 virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE;
[email protected]b4e505942013-09-19 21:24:2824 virtual void Invalidate(const SkISize& view_size,
25 const SkRegion& region) OVERRIDE;
26 virtual void RenderFrame(const SkISize& view_size,
27 const SkIRect& clip_area,
[email protected]55d3688e2012-02-24 23:05:5628 uint8* image_buffer,
29 int image_stride,
[email protected]b4e505942013-09-19 21:24:2830 SkRegion* output_region) OVERRIDE;
31 virtual const SkRegion* GetImageShape() OVERRIDE;
[email protected]622b7882010-09-29 17:34:3232
33 private:
[email protected]04b36142010-11-02 01:08:1934 enum State {
35 kUninitialized,
36 kReady,
37 kError,
38 };
[email protected]622b7882010-09-29 17:34:3239
[email protected]da4daa7f2013-06-21 10:16:4140 // Fills the rectangle |rect| with the given ARGB color |color| in |buffer|.
[email protected]b4e505942013-09-19 21:24:2841 void FillRect(uint8* buffer, int stride, const SkIRect& rect, uint32 color);
[email protected]da4daa7f2013-06-21 10:16:4142
43 // Calculates the difference between the desktop shape regions in two
44 // consecutive frames and updates |updated_region_| and |transparent_region_|
45 // accordingly.
[email protected]b4e505942013-09-19 21:24:2846 void UpdateImageShapeRegion(SkRegion* new_desktop_shape);
[email protected]da4daa7f2013-06-21 10:16:4147
[email protected]622b7882010-09-29 17:34:3248 // The internal state of the decoder.
49 State state_;
50
[email protected]622b7882010-09-29 17:34:3251 vpx_codec_ctx_t* codec_;
52
[email protected]47379e92011-07-26 15:33:1553 // Pointer to the last decoded image.
54 vpx_image_t* last_image_;
55
[email protected]55d3688e2012-02-24 23:05:5656 // The region updated that hasn't been copied to the screen yet.
[email protected]b4e505942013-09-19 21:24:2857 SkRegion updated_region_;
[email protected]50686142011-02-04 02:08:3258
[email protected]15e7b6c2011-12-22 10:20:3359 // Output dimensions.
[email protected]b4e505942013-09-19 21:24:2860 SkISize screen_size_;
[email protected]47379e92011-07-26 15:33:1561
[email protected]da4daa7f2013-06-21 10:16:4162 // The region occupied by the top level windows.
[email protected]b4e505942013-09-19 21:24:2863 SkRegion desktop_shape_;
[email protected]da4daa7f2013-06-21 10:16:4164
65 // The region that should be make transparent.
[email protected]b4e505942013-09-19 21:24:2866 SkRegion transparent_region_;
[email protected]da4daa7f2013-06-21 10:16:4167
[email protected]d9004e42012-08-24 01:47:3768 DISALLOW_COPY_AND_ASSIGN(VideoDecoderVp8);
[email protected]622b7882010-09-29 17:34:3269};
70
71} // namespace remoting
72
[email protected]38609832012-08-23 01:36:1073#endif // REMOTING_CODEC_VIDEO_DECODER_VP8_H_