| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ | 
| 6 #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ | 6 #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ | 
| 7 | 7 | 
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" | 
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" | 
| 10 #include "media/cdm/ppapi/api/content_decryption_module.h" | 10 #include "media/cdm/ppapi/api/content_decryption_module.h" | 
| 11 #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" | 11 #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" | 
| 12 | 12 | 
| 13 struct vpx_codec_ctx; | 13 struct vpx_codec_ctx; | 
| 14 struct vpx_image; | 14 struct vpx_image; | 
| 15 | 15 | 
| 16 namespace media { | 16 namespace media { | 
| 17 | 17 | 
| 18 class LibvpxCdmVideoDecoder : public CdmVideoDecoder { | 18 class LibvpxCdmVideoDecoder : public CdmVideoDecoder { | 
| 19  public: | 19  public: | 
| 20   explicit LibvpxCdmVideoDecoder(CdmHost* host); | 20   explicit LibvpxCdmVideoDecoder(CdmHost* host); | 
| 21   virtual ~LibvpxCdmVideoDecoder(); | 21   virtual ~LibvpxCdmVideoDecoder(); | 
| 22 | 22 | 
| 23   // CdmVideoDecoder implementation. | 23   // CdmVideoDecoder implementation. | 
| 24   virtual bool Initialize(const cdm::VideoDecoderConfig& config) OVERRIDE; | 24   virtual bool Initialize(const cdm::VideoDecoderConfig& config) override; | 
| 25   virtual void Deinitialize() OVERRIDE; | 25   virtual void Deinitialize() override; | 
| 26   virtual void Reset() OVERRIDE; | 26   virtual void Reset() override; | 
| 27   virtual cdm::Status DecodeFrame(const uint8_t* compressed_frame, | 27   virtual cdm::Status DecodeFrame(const uint8_t* compressed_frame, | 
| 28                                   int32_t compressed_frame_size, | 28                                   int32_t compressed_frame_size, | 
| 29                                   int64_t timestamp, | 29                                   int64_t timestamp, | 
| 30                                   cdm::VideoFrame* decoded_frame) OVERRIDE; | 30                                   cdm::VideoFrame* decoded_frame) override; | 
| 31   virtual bool is_initialized() const OVERRIDE { return is_initialized_; } | 31   virtual bool is_initialized() const override { return is_initialized_; } | 
| 32 | 32 | 
| 33   // Returns true when |format| and |data_size| specify a supported video | 33   // Returns true when |format| and |data_size| specify a supported video | 
| 34   // output configuration. | 34   // output configuration. | 
| 35   static bool IsValidOutputConfig(cdm::VideoFormat format, | 35   static bool IsValidOutputConfig(cdm::VideoFormat format, | 
| 36                                   const cdm::Size& data_size); | 36                                   const cdm::Size& data_size); | 
| 37 | 37 | 
| 38  private: | 38  private: | 
| 39   // Allocates storage, then copies video frame stored in |vpx_image_| to | 39   // Allocates storage, then copies video frame stored in |vpx_image_| to | 
| 40   // |cdm_video_frame|. Returns true when allocation and copy succeed. | 40   // |cdm_video_frame|. Returns true when allocation and copy succeed. | 
| 41   bool CopyVpxImageTo(cdm::VideoFrame* cdm_video_frame); | 41   bool CopyVpxImageTo(cdm::VideoFrame* cdm_video_frame); | 
| 42 | 42 | 
| 43   bool is_initialized_; | 43   bool is_initialized_; | 
| 44 | 44 | 
| 45   CdmHost* const host_; | 45   CdmHost* const host_; | 
| 46 | 46 | 
| 47   vpx_codec_ctx* vpx_codec_; | 47   vpx_codec_ctx* vpx_codec_; | 
| 48   vpx_image* vpx_image_; | 48   vpx_image* vpx_image_; | 
| 49 | 49 | 
| 50   DISALLOW_COPY_AND_ASSIGN(LibvpxCdmVideoDecoder); | 50   DISALLOW_COPY_AND_ASSIGN(LibvpxCdmVideoDecoder); | 
| 51 }; | 51 }; | 
| 52 | 52 | 
| 53 }  // namespace media | 53 }  // namespace media | 
| 54 | 54 | 
| 55 #endif  // MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ | 55 #endif  // MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ | 
| OLD | NEW | 
|---|