Bumping manifests a=b2g-bump
[gecko.git] / media / gmp-clearkey / 0.1 / gmp-clearkey.cpp
blob6dab6f92d91d2957499e7c379574c26e938d7fdd
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/. */
5 #include <assert.h>
6 #include <stdio.h>
7 #include <string.h>
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)
15 #include "WMFUtils.h"
16 #include "AudioDecoder.h"
17 #include "VideoDecoder.h"
18 #endif
20 static GMPPlatformAPI* sPlatform = nullptr;
21 GMPPlatformAPI*
22 GetPlatform()
24 return sPlatform;
27 extern "C" {
29 MOZ_EXPORT GMPErr
30 GMPInit(GMPPlatformAPI* aPlatformAPI)
32 sPlatform = aPlatformAPI;
33 return GMPNoErr;
36 MOZ_EXPORT GMPErr
37 GMPGetAPI(const char* aApiName, void* aHostAPI, void** aPluginAPI)
39 CK_LOGD("ClearKey GMPGetAPI |%s|", aApiName);
40 assert(!*aPluginAPI);
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));
53 #endif
54 else {
55 CK_LOGE("GMPGetAPI couldn't resolve API name |%s|\n", aApiName);
58 return *aPluginAPI ? GMPNoErr : GMPNotImplementedErr;
61 MOZ_EXPORT GMPErr
62 GMPShutdown(void)
64 CK_LOGD("ClearKey GMPShutdown");
65 return GMPNoErr;