1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef EME_LOG_H_
#define EME_LOG_H_
#include "mozilla/Logging.h"
#include "mozilla/dom/MediaKeyStatusMapBinding.h"
#include "mozilla/dom/MediaKeySystemAccessBinding.h"
#include "nsString.h"
#include "nsTArray.h"
namespace mozilla {
enum class CryptoScheme : uint8_t;
#ifdef MOZ_WMF_CDM
class MFCDMCapabilitiesIPDL;
#endif
struct KeySystemConfig;
namespace dom {
class ArrayBufferViewOrArrayBuffer;
}
#ifndef EME_LOG
LogModule* GetEMELog();
# define EME_LOG(...) \
MOZ_LOG(GetEMELog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
# define EME_LOG_ENABLED() MOZ_LOG_TEST(GetEMELog(), mozilla::LogLevel::Debug)
#endif
#ifndef EME_VERBOSE_LOG
LogModule* GetEMEVerboseLog();
# define EME_VERBOSE_LOG(...) \
MOZ_LOG(GetEMEVerboseLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#else
# ifndef EME_LOG
# define EME_LOG(...)
# endif
# ifndef EME_VERBOSE_LOG
# define EME_VERBOSE_LOG(...)
# endif
#endif
// Helper function to extract a copy of data coming in from JS in an
// (ArrayBuffer or ArrayBufferView) IDL typed function argument.
//
// Only call this on a properly initialized ArrayBufferViewOrArrayBuffer.
void CopyArrayBufferViewOrArrayBufferData(
const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView,
nsTArray<uint8_t>& aOutData);
nsString KeySystemToProxyName(const nsAString& aKeySystem);
bool IsClearkeyKeySystem(const nsAString& aKeySystem);
bool IsWidevineKeySystem(const nsAString& aKeySystem);
#ifdef MOZ_WMF_CDM
bool IsPlayReadyKeySystemAndSupported(const nsAString& aKeySystem);
bool IsPlayReadyKeySystem(const nsAString& aKeySystem);
bool IsWidevineExperimentKeySystemAndSupported(const nsAString& aKeySystem);
bool IsWidevineExperimentKeySystem(const nsAString& aKeySystem);
bool IsWMFClearKeySystemAndSupported(const nsAString& aKeySystem);
#endif
// Note: Primetime is now unsupported, but we leave it in the enum so
// that the telemetry enum values are not changed; doing so would break
// existing telemetry probes.
enum CDMType {
eClearKey = 0,
ePrimetime = 1, // Note: Unsupported.
eWidevine = 2,
eUnknown = 3
};
CDMType ToCDMTypeTelemetryEnum(const nsString& aKeySystem);
const char* ToMediaKeyStatusStr(dom::MediaKeyStatus aStatus);
// Return true if given config supports hardware decryption (SL3000 or L1).
bool IsHardwareDecryptionSupported(
const dom::MediaKeySystemConfiguration& aConfig);
bool IsHardwareDecryptionSupported(const KeySystemConfig& aConfig);
const char* EncryptionSchemeStr(const CryptoScheme& aScheme);
#ifdef MOZ_WMF_CDM
void MFCDMCapabilitiesIPDLToKeySystemConfig(
const MFCDMCapabilitiesIPDL& aCDMConfig, KeySystemConfig& aKeySystemConfig);
#endif
bool DoesKeySystemSupportClearLead(const nsAString& aKeySystem);
// Return true if there is any config in the given configs has hardware DRM
// associated robustness.
bool CheckIfHarewareDRMConfigExists(
const nsTArray<dom::MediaKeySystemConfiguration>& aConfigs);
bool DoesKeySystemSupportHardwareDecryption(const nsAString& aKeySystem);
} // namespace mozilla
#endif // EME_LOG_H_
|