| 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_CDM_WRAPPER_H_ | 5 #ifndef MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ |
| 6 #define MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ | 6 #define MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 void* cdm_instance = ::CreateCdmInstance( | 109 void* cdm_instance = ::CreateCdmInstance( |
| 110 CdmInterface::kVersion, key_system, key_system_size, get_cdm_host_func, | 110 CdmInterface::kVersion, key_system, key_system_size, get_cdm_host_func, |
| 111 user_data); | 111 user_data); |
| 112 if (!cdm_instance) | 112 if (!cdm_instance) |
| 113 return NULL; | 113 return NULL; |
| 114 | 114 |
| 115 return new CdmWrapperImpl<CdmInterface>( | 115 return new CdmWrapperImpl<CdmInterface>( |
| 116 static_cast<CdmInterface*>(cdm_instance)); | 116 static_cast<CdmInterface*>(cdm_instance)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 virtual ~CdmWrapperImpl() { | 119 ~CdmWrapperImpl() override { |
| 120 cdm_->Destroy(); | 120 cdm_->Destroy(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual void Initialize(bool allow_distinctive_identifier, | 123 void Initialize(bool allow_distinctive_identifier, |
| 124 bool allow_persistent_state) override { | 124 bool allow_persistent_state) override { |
| 125 cdm_->Initialize(allow_distinctive_identifier, allow_persistent_state); | 125 cdm_->Initialize(allow_distinctive_identifier, allow_persistent_state); |
| 126 } | 126 } |
| 127 | 127 |
| 128 virtual void SetServerCertificate( | 128 void SetServerCertificate( |
| 129 uint32_t promise_id, | 129 uint32_t promise_id, |
| 130 const uint8_t* server_certificate_data, | 130 const uint8_t* server_certificate_data, |
| 131 uint32_t server_certificate_data_size) override { | 131 uint32_t server_certificate_data_size) override { |
| 132 cdm_->SetServerCertificate( | 132 cdm_->SetServerCertificate( |
| 133 promise_id, server_certificate_data, server_certificate_data_size); | 133 promise_id, server_certificate_data, server_certificate_data_size); |
| 134 } | 134 } |
| 135 | 135 |
| 136 virtual void CreateSessionAndGenerateRequest( | 136 void CreateSessionAndGenerateRequest( |
| 137 uint32_t promise_id, | 137 uint32_t promise_id, |
| 138 cdm::SessionType session_type, | 138 cdm::SessionType session_type, |
| 139 cdm::InitDataType init_data_type, | 139 cdm::InitDataType init_data_type, |
| 140 const uint8_t* init_data, | 140 const uint8_t* init_data, |
| 141 uint32_t init_data_size) override { | 141 uint32_t init_data_size) override { |
| 142 cdm_->CreateSessionAndGenerateRequest( | 142 cdm_->CreateSessionAndGenerateRequest( |
| 143 promise_id, session_type, init_data_type, init_data, init_data_size); | 143 promise_id, session_type, init_data_type, init_data, init_data_size); |
| 144 } | 144 } |
| 145 | 145 |
| 146 virtual void LoadSession(uint32_t promise_id, | 146 void LoadSession(uint32_t promise_id, |
| 147 cdm::SessionType session_type, | 147 cdm::SessionType session_type, |
| 148 const char* session_id, | 148 const char* session_id, |
| 149 uint32_t session_id_size) override { | 149 uint32_t session_id_size) override { |
| 150 cdm_->LoadSession(promise_id, session_type, session_id, session_id_size); | 150 cdm_->LoadSession(promise_id, session_type, session_id, session_id_size); |
| 151 } | 151 } |
| 152 | 152 |
| 153 virtual void UpdateSession(uint32_t promise_id, | 153 void UpdateSession(uint32_t promise_id, |
| 154 const char* session_id, | 154 const char* session_id, |
| 155 uint32_t session_id_size, | 155 uint32_t session_id_size, |
| 156 const uint8_t* response, | 156 const uint8_t* response, |
| 157 uint32_t response_size) override { | 157 uint32_t response_size) override { |
| 158 cdm_->UpdateSession(promise_id, session_id, session_id_size, response, | 158 cdm_->UpdateSession(promise_id, session_id, session_id_size, response, |
| 159 response_size); | 159 response_size); |
| 160 } | 160 } |
| 161 | 161 |
| 162 virtual void CloseSession(uint32_t promise_id, | 162 void CloseSession(uint32_t promise_id, |
| 163 const char* session_id, | 163 const char* session_id, |
| 164 uint32_t session_id_size) override { | 164 uint32_t session_id_size) override { |
| 165 cdm_->CloseSession(promise_id, session_id, session_id_size); | 165 cdm_->CloseSession(promise_id, session_id, session_id_size); |
| 166 } | 166 } |
| 167 | 167 |
| 168 virtual void RemoveSession(uint32_t promise_id, | 168 void RemoveSession(uint32_t promise_id, |
| 169 const char* session_id, | 169 const char* session_id, |
| 170 uint32_t session_id_size) override { | 170 uint32_t session_id_size) override { |
| 171 cdm_->RemoveSession(promise_id, session_id, session_id_size); | 171 cdm_->RemoveSession(promise_id, session_id, session_id_size); |
| 172 } | 172 } |
| 173 | 173 |
| 174 virtual void TimerExpired(void* context) override { | 174 void TimerExpired(void* context) override { |
| 175 cdm_->TimerExpired(context); | 175 cdm_->TimerExpired(context); |
| 176 } | 176 } |
| 177 | 177 |
| 178 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, | 178 cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, |
| 179 cdm::DecryptedBlock* decrypted_buffer) override { | 179 cdm::DecryptedBlock* decrypted_buffer) override { |
| 180 return cdm_->Decrypt(encrypted_buffer, decrypted_buffer); | 180 return cdm_->Decrypt(encrypted_buffer, decrypted_buffer); |
| 181 } | 181 } |
| 182 | 182 |
| 183 virtual cdm::Status InitializeAudioDecoder( | 183 cdm::Status InitializeAudioDecoder( |
| 184 const cdm::AudioDecoderConfig& audio_decoder_config) override { | 184 const cdm::AudioDecoderConfig& audio_decoder_config) override { |
| 185 return cdm_->InitializeAudioDecoder(audio_decoder_config); | 185 return cdm_->InitializeAudioDecoder(audio_decoder_config); |
| 186 } | 186 } |
| 187 | 187 |
| 188 virtual cdm::Status InitializeVideoDecoder( | 188 cdm::Status InitializeVideoDecoder( |
| 189 const cdm::VideoDecoderConfig& video_decoder_config) override { | 189 const cdm::VideoDecoderConfig& video_decoder_config) override { |
| 190 return cdm_->InitializeVideoDecoder(video_decoder_config); | 190 return cdm_->InitializeVideoDecoder(video_decoder_config); |
| 191 } | 191 } |
| 192 | 192 |
| 193 virtual void DeinitializeDecoder(cdm::StreamType decoder_type) override { | 193 void DeinitializeDecoder(cdm::StreamType decoder_type) override { |
| 194 cdm_->DeinitializeDecoder(decoder_type); | 194 cdm_->DeinitializeDecoder(decoder_type); |
| 195 } | 195 } |
| 196 | 196 |
| 197 virtual void ResetDecoder(cdm::StreamType decoder_type) override { | 197 void ResetDecoder(cdm::StreamType decoder_type) override { |
| 198 cdm_->ResetDecoder(decoder_type); | 198 cdm_->ResetDecoder(decoder_type); |
| 199 } | 199 } |
| 200 | 200 |
| 201 virtual cdm::Status DecryptAndDecodeFrame( | 201 cdm::Status DecryptAndDecodeFrame( |
| 202 const cdm::InputBuffer& encrypted_buffer, | 202 const cdm::InputBuffer& encrypted_buffer, |
| 203 cdm::VideoFrame* video_frame) override { | 203 cdm::VideoFrame* video_frame) override { |
| 204 return cdm_->DecryptAndDecodeFrame(encrypted_buffer, video_frame); | 204 return cdm_->DecryptAndDecodeFrame(encrypted_buffer, video_frame); |
| 205 } | 205 } |
| 206 | 206 |
| 207 virtual cdm::Status DecryptAndDecodeSamples( | 207 cdm::Status DecryptAndDecodeSamples( |
| 208 const cdm::InputBuffer& encrypted_buffer, | 208 const cdm::InputBuffer& encrypted_buffer, |
| 209 cdm::AudioFrames* audio_frames) override { | 209 cdm::AudioFrames* audio_frames) override { |
| 210 return cdm_->DecryptAndDecodeSamples(encrypted_buffer, audio_frames); | 210 return cdm_->DecryptAndDecodeSamples(encrypted_buffer, audio_frames); |
| 211 } | 211 } |
| 212 | 212 |
| 213 virtual void OnPlatformChallengeResponse( | 213 void OnPlatformChallengeResponse( |
| 214 const cdm::PlatformChallengeResponse& response) override { | 214 const cdm::PlatformChallengeResponse& response) override { |
| 215 cdm_->OnPlatformChallengeResponse(response); | 215 cdm_->OnPlatformChallengeResponse(response); |
| 216 } | 216 } |
| 217 | 217 |
| 218 virtual void OnQueryOutputProtectionStatus( | 218 void OnQueryOutputProtectionStatus( |
| 219 cdm::QueryResult result, | 219 cdm::QueryResult result, |
| 220 uint32_t link_mask, | 220 uint32_t link_mask, |
| 221 uint32_t output_protection_mask) override { | 221 uint32_t output_protection_mask) override { |
| 222 cdm_->OnQueryOutputProtectionStatus(result, link_mask, | 222 cdm_->OnQueryOutputProtectionStatus(result, link_mask, |
| 223 output_protection_mask); | 223 output_protection_mask); |
| 224 } | 224 } |
| 225 | 225 |
| 226 private: | 226 private: |
| 227 CdmWrapperImpl(CdmInterface* cdm) : cdm_(cdm) { | 227 CdmWrapperImpl(CdmInterface* cdm) : cdm_(cdm) { |
| 228 PP_DCHECK(cdm_); | 228 PP_DCHECK(cdm_); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // stub implementations for new or modified methods that the older CDM interface | 307 // stub implementations for new or modified methods that the older CDM interface |
| 308 // does not have. | 308 // does not have. |
| 309 // Also update supported_cdm_versions.h. | 309 // Also update supported_cdm_versions.h. |
| 310 static_assert(cdm::ContentDecryptionModule::kVersion == | 310 static_assert(cdm::ContentDecryptionModule::kVersion == |
| 311 cdm::ContentDecryptionModule_8::kVersion, | 311 cdm::ContentDecryptionModule_8::kVersion, |
| 312 "ensure cdm wrapper templates have old version support"); | 312 "ensure cdm wrapper templates have old version support"); |
| 313 | 313 |
| 314 } // namespace media | 314 } // namespace media |
| 315 | 315 |
| 316 #endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ | 316 #endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ |
| OLD | NEW |