cdm_adapter.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file.
48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#ifndef MEDIA_CDM_PPAPI_CDM_ADAPTER_H_
68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#define MEDIA_CDM_PPAPI_CDM_ADAPTER_H_
78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include <string>
98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include <vector>
108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/basictypes.h"
128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/compiler_specific.h"
138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "build/build_config.h"
148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "media/cdm/ppapi/api/content_decryption_module.h"
158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "media/cdm/ppapi/cdm_helpers.h"
168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "media/cdm/ppapi/cdm_wrapper.h"
178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "media/cdm/ppapi/linked_ptr.h"
188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/c/pp_stdint.h"
198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/c/private/pp_content_decryptor.h"
208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/completion_callback.h"
218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/private/content_decryptor_private.h"
228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/var.h"
238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/var_array_buffer.h"
248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/utility/completion_callback_factory.h"
258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#if defined(OS_CHROMEOS)
278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/private/output_protection_private.h"
288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/private/platform_verification.h"
298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif
308bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)namespace media {
328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// GetCdmHostFunc implementation.
348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)void* GetCdmHost(int host_interface_version, void* user_data);
358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// An adapter class for abstracting away PPAPI interaction and threading for a
378bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Content Decryption Module (CDM).
388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class CdmAdapter : public pp::Instance,
398bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                   public pp::ContentDecryptor_Private,
408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                   public cdm::Host_1,
418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                   public cdm::Host_2 {
428bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public:
438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  CdmAdapter(PP_Instance instance, pp::Module* module);
448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual ~CdmAdapter();
458bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
468bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // pp::Instance implementation.
478bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    return true;
498bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  }
508bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
518bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // PPP_ContentDecryptor_Private implementation.
528bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Note: Results of calls to these methods must be reported through the
538bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // PPB_ContentDecryptor_Private interface.
548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // TODO(jrummell): |can_challenge_platform| should be removed.
558bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void Initialize(const std::string& key_system,
568bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                          bool can_challenge_platform) OVERRIDE;
578bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void GenerateKeyRequest(const std::string& type,
588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                                  pp::VarArrayBuffer init_data) OVERRIDE;
598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void AddKey(const std::string& session_id,
608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                      pp::VarArrayBuffer key,
618bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                      pp::VarArrayBuffer init_data) OVERRIDE;
628bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE;
638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void Decrypt(
648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      pp::Buffer_Dev encrypted_buffer,
658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE;
668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void InitializeAudioDecoder(
678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      const PP_AudioDecoderConfig& decoder_config,
688bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      pp::Buffer_Dev extra_data_buffer) OVERRIDE;
698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void InitializeVideoDecoder(
708bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      const PP_VideoDecoderConfig& decoder_config,
718bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      pp::Buffer_Dev extra_data_buffer) OVERRIDE;
728bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type,
738bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                                   uint32_t request_id) OVERRIDE;
748bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void ResetDecoder(PP_DecryptorStreamType decoder_type,
758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                            uint32_t request_id) OVERRIDE;
768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void DecryptAndDecode(
778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      PP_DecryptorStreamType decoder_type,
788bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      pp::Buffer_Dev encrypted_buffer,
798bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE;
808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // cdm::Host implementation.
821e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual cdm::Buffer* Allocate(uint32_t capacity) OVERRIDE;
838bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void SetTimer(int64_t delay_ms, void* context) OVERRIDE;
848bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual double GetCurrentWallTimeInSeconds() OVERRIDE;
858bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void SendKeyMessage(
861e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      const char* session_id, uint32_t session_id_length,
871e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      const char* message, uint32_t message_length,
881e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      const char* default_url, uint32_t default_url_length) OVERRIDE;
898bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void SendKeyError(const char* session_id,
901e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                            uint32_t session_id_length,
918bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                            cdm::MediaKeyError error_code,
928bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                            uint32_t system_code) OVERRIDE;
938bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void GetPrivateData(int32_t* instance,
948bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                              GetPrivateInterface* get_interface) OVERRIDE;
958bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
968bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // cdm::Host_2 implementation.
978bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void SendPlatformChallenge(
981e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      const char* service_id, uint32_t service_id_length,
991e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      const char* challenge, uint32_t challenge_length) OVERRIDE;
1008bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void EnableOutputProtection(
1018bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      uint32_t desired_protection_mask) OVERRIDE;
1028bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void QueryOutputProtectionStatus() OVERRIDE;
1031e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void OnDeferredInitializationDone(
1041e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      cdm::StreamType stream_type,
1051e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      cdm::Status decoder_status) OVERRIDE;
1068bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1078bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private:
1088bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  struct SessionInfo {
1098bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    SessionInfo(const std::string& key_system_in,
1108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                const std::string& session_id_in)
1118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)        : key_system(key_system_in),
1128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)          session_id(session_id_in) {}
1138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    const std::string key_system;
1148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    const std::string session_id;
1158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  };
1168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock;
1188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame;
1198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames;
1208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool CreateCdmInstance(const std::string& key_system);
1228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void SendUnknownKeyError(const std::string& key_system,
1248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                           const std::string& session_id);
1258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void SendKeyAdded(const std::string& key_system,
1278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const std::string& session_id);
1288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // TODO(jrummell): Drop the |key_system| parameter.
1308bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void SendKeyErrorInternal(const std::string& key_system,
1318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                            const std::string& session_id,
1328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                            cdm::MediaKeyError error_code,
1338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                            uint32_t system_code);
1348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to
1368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // <code>callback_factory_</code> to ensure that calls into
1378bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // <code>PPP_ContentDecryptor_Private</code> are asynchronous.
1388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void KeyAdded(int32_t result, const SessionInfo& session_info);
1398bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void KeyMessage(int32_t result,
1408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                  const SessionInfo& session_info,
1418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                  const std::vector<uint8>& message,
1428bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                  const std::string& default_url);
1438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void KeyError(int32_t result,
1448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                const SessionInfo& session_info,
1458bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                cdm::MediaKeyError error_code,
1468bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                uint32_t system_code);
1478bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void DeliverBlock(int32_t result,
1488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const cdm::Status& status,
1498bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const LinkedDecryptedBlock& decrypted_block,
1508bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const PP_DecryptTrackingInfo& tracking_info);
1518bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void DecoderInitializeDone(int32_t result,
1528bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                             PP_DecryptorStreamType decoder_type,
1538bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                             uint32_t request_id,
1548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                             bool success);
1558bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void DecoderDeinitializeDone(int32_t result,
1568bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                               PP_DecryptorStreamType decoder_type,
1578bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                               uint32_t request_id);
1588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void DecoderResetDone(int32_t result,
1598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                        PP_DecryptorStreamType decoder_type,
1608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                        uint32_t request_id);
1618bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void DeliverFrame(int32_t result,
1628bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const cdm::Status& status,
1638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const LinkedVideoFrame& video_frame,
1648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                    const PP_DecryptTrackingInfo& tracking_info);
1658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void DeliverSamples(int32_t result,
1668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                      const cdm::Status& status,
1678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                      const LinkedAudioFrames& audio_frames,
1688bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                      const PP_DecryptTrackingInfo& tracking_info);
1698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1708bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Helper for SetTimer().
1718bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void TimerExpired(int32_t result, void* context);
1728bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1738bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool IsValidVideoFrame(const LinkedVideoFrame& video_frame);
1748bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#if defined(OS_CHROMEOS)
1778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void SendPlatformChallengeDone(int32_t result);
1788bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void EnableProtectionDone(int32_t result);
1798bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  void QueryOutputProtectionStatusDone(int32_t result);
1808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  pp::OutputProtection_Private output_protection_;
1828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  pp::PlatformVerification platform_verification_;
1838bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1848bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Since PPAPI doesn't provide handlers for CompletionCallbacks with more than
1858bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // one output we need to manage our own.  These values are only read by
1868bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // SendPlatformChallengeDone().
1878bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  pp::Var signed_data_output_;
1888bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  pp::Var signed_data_signature_output_;
1898bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  pp::Var platform_key_certificate_output_;
1908bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool challenge_in_progress_;
1918bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1928bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Same as above, these are only read by QueryOutputProtectionStatusDone().
1938bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  uint32_t output_link_mask_;
1948bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  uint32_t output_protection_mask_;
1958bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool query_output_protection_in_progress_;
1968bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif
1978bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1988bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  PpbBufferAllocator allocator_;
1998bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  pp::CompletionCallbackFactory<CdmAdapter> callback_factory_;
2008bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  linked_ptr<CdmWrapper> cdm_;
2018bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  std::string key_system_;
2028bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2031e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // If the CDM returned kDeferredInitialization during InitializeAudioDecoder()
2041e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is
2051e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // saved for the future call to OnDeferredInitializationDone().
2061e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool deferred_initialize_audio_decoder_;
2071e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  uint32_t deferred_audio_decoder_config_id_;
2081e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool deferred_initialize_video_decoder_;
2091e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  uint32_t deferred_video_decoder_config_id_;
2101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
2118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(CdmAdapter);
2128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)};
2138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}  // namespace media
2158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif  // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_
217