| OLD | NEW | 
|   1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
|   2 // Use of this source code is governed by a BSD-style license that can be |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 #ifndef REMOTING_BASE_DECODER_VP8_H_ |   5 #ifndef REMOTING_BASE_DECODER_VP8_H_ | 
|   6 #define REMOTING_BASE_DECODER_VP8_H_ |   6 #define REMOTING_BASE_DECODER_VP8_H_ | 
|   7  |   7  | 
|   8 #include "remoting/base/decoder.h" |   8 #include "remoting/base/decoder.h" | 
|   9  |   9  | 
|  10 typedef struct vpx_codec_ctx vpx_codec_ctx_t; |  10 typedef struct vpx_codec_ctx vpx_codec_ctx_t; | 
|  11 typedef struct vpx_image vpx_image_t; |  11 typedef struct vpx_image vpx_image_t; | 
|  12  |  12  | 
|  13 namespace remoting { |  13 namespace remoting { | 
|  14  |  14  | 
|  15 class DecoderVp8 : public Decoder { |  15 class DecoderVp8 : public Decoder { | 
|  16  public: |  16  public: | 
|  17   DecoderVp8(); |  17   DecoderVp8(); | 
|  18   virtual ~DecoderVp8(); |  18   virtual ~DecoderVp8(); | 
|  19  |  19  | 
|  20   // Decoder implementations. |  20   // Decoder implementations. | 
|  21   virtual void Initialize(scoped_refptr<media::VideoFrame> frame) OVERRIDE; |  21   virtual void Initialize(scoped_refptr<media::VideoFrame> frame) OVERRIDE; | 
|  22   virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; |  22   virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE; | 
|  23   virtual void GetUpdatedRegion(SkRegion* region) OVERRIDE; |  23   virtual void GetUpdatedRects(RectVector* rects) OVERRIDE; | 
|  24   virtual bool IsReadyForData() OVERRIDE; |  24   virtual bool IsReadyForData() OVERRIDE; | 
|  25   virtual void Reset() OVERRIDE; |  25   virtual void Reset() OVERRIDE; | 
|  26   virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; |  26   virtual VideoPacketFormat::Encoding Encoding() OVERRIDE; | 
|  27   virtual void SetOutputSize(const SkISize& size) OVERRIDE; |  27   virtual void SetOutputSize(const SkISize& size) OVERRIDE; | 
|  28   virtual void SetClipRect(const SkIRect& clip_rect) OVERRIDE; |  28   virtual void SetClipRect(const SkIRect& clip_rect) OVERRIDE; | 
|  29   virtual void RefreshRegion(const SkRegion& region) OVERRIDE; |  29   virtual void RefreshRects(const RectVector& rects) OVERRIDE; | 
|  30  |  30  | 
|  31  private: |  31  private: | 
|  32   enum State { |  32   enum State { | 
|  33     kUninitialized, |  33     kUninitialized, | 
|  34     kReady, |  34     kReady, | 
|  35     kError, |  35     kError, | 
|  36   }; |  36   }; | 
|  37  |  37  | 
|  38   // Return true if scaling is enabled |  38   // Return true if scaling is enabled | 
|  39   bool DoScaling() const; |  39   bool DoScaling() const; | 
|  40  |  40  | 
|  41   // Perform color space conversion on the specified region. |  41   // Perform color space conversion on the specified rectangles. | 
|  42   // Writes the updated region to |output_region|. |  42   // Write the updated rectangles to |output_rects|. | 
|  43   void ConvertRegion(const SkRegion& region, |  43   void ConvertRects(const RectVector& rects, | 
|  44                      SkRegion* output_region); |  44                     RectVector* output_rects); | 
|  45  |  45  | 
|  46   // Perform scaling and color space conversion on the specified |  46   // Perform scaling and color space conversion on the specified | 
|  47   // region.  Writes the updated rectangles to |output_region|. |  47   // rectangles. | 
|  48   void ScaleAndConvertRegion(const SkRegion& region, |  48   // Write the updated rectangles to |output_rects|. | 
|  49                              SkRegion* output_region); |  49   void ScaleAndConvertRects(const RectVector& rects, | 
 |  50                             RectVector* output_rects); | 
|  50  |  51  | 
|  51   // The internal state of the decoder. |  52   // The internal state of the decoder. | 
|  52   State state_; |  53   State state_; | 
|  53  |  54  | 
|  54   // The video frame to write to. |  55   // The video frame to write to. | 
|  55   scoped_refptr<media::VideoFrame> frame_; |  56   scoped_refptr<media::VideoFrame> frame_; | 
|  56  |  57  | 
|  57   vpx_codec_ctx_t* codec_; |  58   vpx_codec_ctx_t* codec_; | 
|  58  |  59  | 
|  59   // Pointer to the last decoded image. |  60   // Pointer to the last decoded image. | 
|  60   vpx_image_t* last_image_; |  61   vpx_image_t* last_image_; | 
|  61  |  62  | 
|  62   // The region updated by the most recent decode. |  63   // Record the updated rects in the last decode. | 
|  63   SkRegion updated_region_; |  64   RectVector updated_rects_; | 
|  64  |  65  | 
|  65   // Clipping rect for the output of the decoder. |  66   // Clipping rect for the output of the decoder. | 
|  66   SkIRect clip_rect_; |  67   SkIRect clip_rect_; | 
|  67  |  68  | 
|  68   // Output dimensions. |  69   // Output dimensions. | 
|  69   SkISize output_size_; |  70   SkISize output_size_; | 
|  70  |  71  | 
|  71   DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |  72   DISALLOW_COPY_AND_ASSIGN(DecoderVp8); | 
|  72 }; |  73 }; | 
|  73  |  74  | 
|  74 }  // namespace remoting |  75 }  // namespace remoting | 
|  75  |  76  | 
|  76 #endif  // REMOTING_BASE_DECODER_VP8_H_ |  77 #endif  // REMOTING_BASE_DECODER_VP8_H_ | 
| OLD | NEW |