Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "webkit/media/crypto/ppapi/clear_key_cdm.h" | 5 #include "webkit/media/crypto/ppapi/clear_key_cdm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 void INITIALIZE_CDM_MODULE() { | 118 void INITIALIZE_CDM_MODULE() { |
| 119 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 119 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 120 DVLOG(2) << "FFmpeg libraries initialized: " << g_ffmpeg_lib_initialized; | 120 DVLOG(2) << "FFmpeg libraries initialized: " << g_ffmpeg_lib_initialized; |
| 121 av_register_all(); | 121 av_register_all(); |
| 122 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER | 122 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 123 } | 123 } |
| 124 | 124 |
| 125 void DeinitializeCdmModule() { | 125 void DeinitializeCdmModule() { |
| 126 } | 126 } |
| 127 | 127 |
| 128 cdm::ContentDecryptionModule* CreateCdmInstance(const char* key_system_arg, | 128 cdm::ContentDecryptionModule* CreateCdmInstance( |
| 129 int key_system_size, | 129 const char* key_system_arg, |
| 130 cdm::Allocator* allocator, | 130 int key_system_size, |
| 131 cdm::Host* host) { | 131 cdm::Allocator* allocator, |
| 132 cdm::HostFactory* host_factory) { | |
| 132 DVLOG(1) << "CreateCdmInstance()"; | 133 DVLOG(1) << "CreateCdmInstance()"; |
| 133 DCHECK_EQ(std::string(key_system_arg, key_system_size), kExternalClearKey); | 134 DCHECK_EQ(std::string(key_system_arg, key_system_size), kExternalClearKey); |
| 134 return new webkit_media::ClearKeyCdm(allocator, host); | 135 |
| 136 void* host = host_factory->GetCdmHost(CDM_HOST_INTERFACE); | |
|
ddorwin
2013/02/07 23:50:21
Do you think it is worth putting this call and the
xhwang
2013/02/08 01:23:12
Done.
| |
| 137 if (!host) | |
| 138 return NULL; | |
| 139 | |
| 140 return new webkit_media::ClearKeyCdm(allocator, | |
| 141 reinterpret_cast<cdm::Host*>(host)); | |
| 135 } | 142 } |
| 136 | 143 |
| 137 void DestroyCdmInstance(cdm::ContentDecryptionModule* instance) { | 144 void DestroyCdmInstance(cdm::ContentDecryptionModule* instance) { |
| 138 DVLOG(1) << "DestroyCdmInstance()"; | 145 DVLOG(1) << "DestroyCdmInstance()"; |
| 139 delete instance; | 146 delete instance; |
| 140 } | 147 } |
| 141 | 148 |
| 142 const char* GetCdmVersion() { | 149 const char* GetCdmVersion() { |
| 143 return kClearKeyCdmVersion; | 150 return kClearKeyCdmVersion; |
| 144 } | 151 } |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 int samples_generated = GenerateFakeAudioFramesFromDuration( | 556 int samples_generated = GenerateFakeAudioFramesFromDuration( |
| 550 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), | 557 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), |
| 551 audio_frames); | 558 audio_frames); |
| 552 total_samples_generated_ += samples_generated; | 559 total_samples_generated_ += samples_generated; |
| 553 | 560 |
| 554 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; | 561 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; |
| 555 } | 562 } |
| 556 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | 563 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER |
| 557 | 564 |
| 558 } // namespace webkit_media | 565 } // namespace webkit_media |
| OLD | NEW |