| 1 |
/* |
| 2 |
* Copyright (C) 2023 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <bento4/Ap4.h> |
| 12 |
#include <jni/src/MediaDrm.h> |
| 13 |
#include <kodi/AddonBase.h> |
| 14 |
|
| 15 |
enum WV_KEYSYSTEM |
| 16 |
{ |
| 17 |
NONE, |
| 18 |
WIDEVINE, |
| 19 |
PLAYREADY, |
| 20 |
WISEPLAY |
| 21 |
}; |
| 22 |
|
| 23 |
class CWVDecrypterA; |
| 24 |
|
| 25 |
class ATTR_DLL_LOCAL CWVCdmAdapterA |
| 26 |
{ |
| 27 |
public: |
| 28 |
CWVCdmAdapterA(WV_KEYSYSTEM ks, |
| 29 |
std::string_view licenseURL, |
| 30 |
const std::vector<uint8_t>& serverCert, |
| 31 |
jni::CJNIMediaDrmOnEventListener* listener, |
| 32 |
CWVDecrypterA* host); |
| 33 |
~CWVCdmAdapterA(); |
| 34 |
|
| 35 |
jni::CJNIMediaDrm* GetMediaDrm() { return m_mediaDrm; }; |
| 36 |
|
| 37 |
const std::string& GetLicenseURL() const { return m_licenseUrl; }; |
| 38 |
|
| 39 |
const uint8_t* GetKeySystem() const |
| 40 |
{ |
| 41 |
static const uint8_t keysystemId[3][16] = { |
| 42 |
{0xed, 0xef, 0x8b, 0xa9, 0x79, 0xd6, 0x4a, 0xce, 0xa3, 0xc8, 0x27, 0xdc, 0xd5, 0x1d, 0x21, |
| 43 |
0xed}, |
| 44 |
{0x9A, 0x04, 0xF0, 0x79, 0x98, 0x40, 0x42, 0x86, 0xAB, 0x92, 0xE6, 0x5B, 0xE0, 0x88, 0x5F, |
| 45 |
0x95}, |
| 46 |
{0x3d, 0x5e, 0x6d, 0x35, 0x9b, 0x9a, 0x41, 0xe8, 0xb8, 0x43, 0xdd, 0x3c, 0x6e, 0x72, 0xc4, |
| 47 |
0x2c}, |
| 48 |
}; |
| 49 |
return keysystemId[m_keySystem - 1]; |
| 50 |
} |
| 51 |
WV_KEYSYSTEM GetKeySystemType() const { return m_keySystem; }; |
| 52 |
void SaveServiceCertificate(); |
| 53 |
|
| 54 |
private: |
| 55 |
void LoadServiceCertificate(); |
| 56 |
|
| 57 |
WV_KEYSYSTEM m_keySystem; |
| 58 |
jni::CJNIMediaDrm* m_mediaDrm; |
| 59 |
std::string m_licenseUrl; |
| 60 |
std::string m_strBasePath; |
| 61 |
CWVDecrypterA* m_host; |
| 62 |
}; |