Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef WidevineAdapter_h_
7 : #define WidevineAdapter_h_
8 :
9 : #include "GMPLoader.h"
10 : #include "prlink.h"
11 : #include "GMPUtils.h"
12 :
13 : struct GMPPlatformAPI;
14 :
15 : namespace mozilla {
16 :
17 0 : class WidevineAdapter : public gmp::GMPAdapter {
18 : public:
19 :
20 : void SetAdaptee(PRLibrary* aLib) override;
21 :
22 : // These are called in place of the corresponding GMP API functions.
23 : GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) override;
24 : GMPErr GMPGetAPI(const char* aAPIName,
25 : void* aHostAPI,
26 : void** aPluginAPI,
27 : uint32_t aDecryptorId) override;
28 : void GMPShutdown() override;
29 :
30 : static bool Supports(int32_t aModuleVersion,
31 : int32_t aInterfaceVersion,
32 : int32_t aHostVersion);
33 :
34 : private:
35 : PRLibrary* mLib = nullptr;
36 : };
37 :
38 : GMPErr GMPCreateThread(GMPThread** aThread);
39 : GMPErr GMPRunOnMainThread(GMPTask* aTask);
40 : GMPErr GMPCreateMutex(GMPMutex** aMutex);
41 :
42 : // Call on main thread only.
43 : GMPErr GMPCreateRecord(const char* aRecordName,
44 : uint32_t aRecordNameSize,
45 : GMPRecord** aOutRecord,
46 : GMPRecordClient* aClient);
47 :
48 : // Call on main thread only.
49 : GMPErr GMPSetTimerOnMainThread(GMPTask* aTask, int64_t aTimeoutMS);
50 :
51 : GMPErr GMPGetCurrentTime(GMPTimestamp* aOutTime);
52 :
53 : } // namespace mozilla
54 :
55 : #endif // WidevineAdapter_h_
|