| 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 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" | 5 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 extern "C" { | 39 extern "C" { |
| 40 // Temporarily disable possible loss of data warning. | 40 // Temporarily disable possible loss of data warning. |
| 41 MSVC_PUSH_DISABLE_WARNING(4244); | 41 MSVC_PUSH_DISABLE_WARNING(4244); |
| 42 #include <libavformat/avformat.h> | 42 #include <libavformat/avformat.h> |
| 43 MSVC_POP_WARNING(); | 43 MSVC_POP_WARNING(); |
| 44 } // extern "C" | 44 } // extern "C" |
| 45 | 45 |
| 46 #if !defined COMPONENT_BUILD | 46 #if !defined COMPONENT_BUILD |
| 47 static base::AtExitManager g_at_exit_manager; | 47 static base::AtExitManager g_at_exit_manager; |
| 48 #endif | 48 #endif |
| 49 | |
| 50 // Prepare media library. | |
| 51 static bool InitializeFFmpegLibraries() { | |
| 52 media::InitializeMediaLibrary(); | |
| 53 return true; | |
| 54 } | |
| 55 static bool g_ffmpeg_lib_initialized = InitializeFFmpegLibraries(); | |
| 56 | |
| 57 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER | 49 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 58 | 50 |
| 59 const char kClearKeyCdmVersion[] = "0.1.0.1"; | 51 const char kClearKeyCdmVersion[] = "0.1.0.1"; |
| 60 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 52 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
| 61 | 53 |
| 62 // Variants of External Clear Key key system to test different scenarios. | 54 // Variants of External Clear Key key system to test different scenarios. |
| 63 const char kExternalClearKeyDecryptOnlyKeySystem[] = | 55 const char kExternalClearKeyDecryptOnlyKeySystem[] = |
| 64 "org.chromium.externalclearkey.decryptonly"; | 56 "org.chromium.externalclearkey.decryptonly"; |
| 65 const char kExternalClearKeyRenewalKeySystem[] = | 57 const char kExternalClearKeyRenewalKeySystem[] = |
| 66 "org.chromium.externalclearkey.renewal"; | 58 "org.chromium.externalclearkey.renewal"; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 key.key_id_size = key_info->key_id.size(); | 206 key.key_id_size = key_info->key_id.size(); |
| 215 key.status = ConvertKeyStatus(key_info->status); | 207 key.status = ConvertKeyStatus(key_info->status); |
| 216 key.system_code = key_info->system_code; | 208 key.system_code = key_info->system_code; |
| 217 keys_vector->push_back(key); | 209 keys_vector->push_back(key); |
| 218 } | 210 } |
| 219 } | 211 } |
| 220 | 212 |
| 221 void INITIALIZE_CDM_MODULE() { | 213 void INITIALIZE_CDM_MODULE() { |
| 222 DVLOG(1) << __FUNCTION__; | 214 DVLOG(1) << __FUNCTION__; |
| 223 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 215 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 216 media::InitializeMediaLibrary(); |
| 224 av_register_all(); | 217 av_register_all(); |
| 225 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER | 218 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 226 } | 219 } |
| 227 | 220 |
| 228 void DeinitializeCdmModule() { | 221 void DeinitializeCdmModule() { |
| 229 DVLOG(1) << __FUNCTION__; | 222 DVLOG(1) << __FUNCTION__; |
| 230 } | 223 } |
| 231 | 224 |
| 232 void* CreateCdmInstance(int cdm_interface_version, | 225 void* CreateCdmInstance(int cdm_interface_version, |
| 233 const char* key_system, uint32_t key_system_size, | 226 const char* key_system, uint32_t key_system_size, |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 is_running_platform_verification_test_ = true; | 976 is_running_platform_verification_test_ = true; |
| 984 | 977 |
| 985 std::string service_id = "test_service_id"; | 978 std::string service_id = "test_service_id"; |
| 986 std::string challenge = "test_challenge"; | 979 std::string challenge = "test_challenge"; |
| 987 | 980 |
| 988 host_->SendPlatformChallenge(service_id.data(), service_id.size(), | 981 host_->SendPlatformChallenge(service_id.data(), service_id.size(), |
| 989 challenge.data(), challenge.size()); | 982 challenge.data(), challenge.size()); |
| 990 } | 983 } |
| 991 | 984 |
| 992 } // namespace media | 985 } // namespace media |
| OLD | NEW |