1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "ClearKeySessionManager.h"
10 #include "gmp-api/gmp-decryption.h"
11 #include "gmp-api/gmp-platform.h"
12 #include "mozilla/Attributes.h"
14 #if defined(ENABLE_WMF)
16 #include "AudioDecoder.h"
17 #include "VideoDecoder.h"
20 static GMPPlatformAPI
* sPlatform
= nullptr;
30 GMPInit(GMPPlatformAPI
* aPlatformAPI
)
32 sPlatform
= aPlatformAPI
;
37 GMPGetAPI(const char* aApiName
, void* aHostAPI
, void** aPluginAPI
)
39 CK_LOGD("ClearKey GMPGetAPI |%s|", aApiName
);
42 if (!strcmp(aApiName
, GMP_API_DECRYPTOR
)) {
43 *aPluginAPI
= new ClearKeySessionManager();
45 #if defined(ENABLE_WMF)
46 else if (wmf::EnsureLibs()) {
47 if (!strcmp(aApiName
, GMP_API_AUDIO_DECODER
)) {
48 *aPluginAPI
= new AudioDecoder(static_cast<GMPAudioHost
*>(aHostAPI
));
49 } else if (!strcmp(aApiName
, GMP_API_VIDEO_DECODER
)) {
50 *aPluginAPI
= new VideoDecoder(static_cast<GMPVideoHost
*>(aHostAPI
));
55 CK_LOGE("GMPGetAPI couldn't resolve API name |%s|\n", aApiName
);
58 return *aPluginAPI
? GMPNoErr
: GMPNotImplementedErr
;
64 CK_LOGD("ClearKey GMPShutdown");