2015-04-02 20:08:27 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015, Mozilla Foundation and contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2014-09-23 22:04:49 +00:00
|
|
|
|
2015-01-15 21:37:54 +00:00
|
|
|
#include <assert.h>
|
2014-09-23 22:04:49 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
#include "ClearKeyCDM.h"
|
2015-01-12 07:15:55 +00:00
|
|
|
#include "ClearKeySessionManager.h"
|
2017-01-11 20:52:05 +00:00
|
|
|
// This include is required in order for content_decryption_module to work
|
|
|
|
// on Unix systems.
|
|
|
|
#include "stddef.h"
|
|
|
|
#include "content_decryption_module.h"
|
2014-09-23 22:04:49 +00:00
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
#ifdef ENABLE_WMF
|
2015-02-28 03:15:18 +00:00
|
|
|
#include "WMFUtils.h"
|
2017-01-11 20:52:05 +00:00
|
|
|
#endif // ENABLE_WMF
|
2014-09-23 22:04:49 +00:00
|
|
|
|
2017-01-13 21:23:31 +00:00
|
|
|
extern "C" {
|
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
CDM_EXPORT
|
|
|
|
void INITIALIZE_CDM_MODULE() {
|
|
|
|
|
2017-01-13 21:23:31 +00:00
|
|
|
}
|
2014-09-23 22:04:49 +00:00
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
CDM_EXPORT
|
|
|
|
void* CreateCdmInstance(int cdm_interface_version,
|
|
|
|
const char* key_system,
|
|
|
|
uint32_t key_system_size,
|
|
|
|
GetCdmHostFunc get_cdm_host_func,
|
|
|
|
void* user_data)
|
2017-01-13 21:23:31 +00:00
|
|
|
{
|
2017-01-11 20:52:05 +00:00
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
CK_LOGE("ClearKey CreateCDMInstance");
|
|
|
|
|
|
|
|
#ifdef ENABLE_WMF
|
|
|
|
if (!wmf::EnsureLibs()) {
|
|
|
|
CK_LOGE("Required libraries were not found");
|
|
|
|
return nullptr;
|
2015-01-15 21:37:54 +00:00
|
|
|
}
|
|
|
|
#endif
|
2014-09-23 22:04:49 +00:00
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
cdm::Host_8* host = static_cast<cdm::Host_8*>(
|
|
|
|
get_cdm_host_func(cdm_interface_version, user_data));
|
|
|
|
ClearKeyCDM* clearKey = new ClearKeyCDM(host);
|
2014-09-23 22:04:49 +00:00
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
CK_LOGE("Created ClearKeyCDM instance!");
|
2017-01-13 21:23:31 +00:00
|
|
|
|
2017-01-11 20:52:05 +00:00
|
|
|
return clearKey;
|
|
|
|
}
|
2014-09-23 22:04:49 +00:00
|
|
|
}
|