summaryrefslogtreecommitdiffstats
path: root/dom/media/eme/KeySystemConfig.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/eme/KeySystemConfig.h')
-rw-r--r--dom/media/eme/KeySystemConfig.h36
1 files changed, 29 insertions, 7 deletions
diff --git a/dom/media/eme/KeySystemConfig.h b/dom/media/eme/KeySystemConfig.h
index cc35ba76de..39027d4401 100644
--- a/dom/media/eme/KeySystemConfig.h
+++ b/dom/media/eme/KeySystemConfig.h
@@ -9,12 +9,23 @@
#include "nsString.h"
#include "nsTArray.h"
+#include "mozilla/MozPromise.h"
#include "mozilla/dom/MediaKeysBinding.h"
+#include "mozilla/dom/MediaKeySystemAccessBinding.h"
namespace mozilla {
+struct KeySystemConfigRequest;
+
struct KeySystemConfig {
public:
+ using SupportedConfigsPromise =
+ MozPromise<nsTArray<KeySystemConfig>, bool /* aIgnored */,
+ /* IsExclusive = */ true>;
+ using KeySystemConfigPromise =
+ MozPromise<dom::MediaKeySystemConfiguration, bool /* aIgnored */,
+ /* IsExclusive = */ true>;
+
// EME MediaKeysRequirement:
// https://www.w3.org/TR/encrypted-media/#dom-mediakeysrequirement
enum class Requirement {
@@ -129,9 +140,8 @@ struct KeySystemConfig {
Software,
Hardware,
};
- static bool CreateKeySystemConfigs(const nsAString& aKeySystem,
- const DecryptionInfo aDecryption,
- nsTArray<KeySystemConfig>& aOutConfigs);
+ static RefPtr<SupportedConfigsPromise> CreateKeySystemConfigs(
+ const nsTArray<KeySystemConfigRequest>& aRequests);
static void GetGMPKeySystemConfigs(dom::Promise* aPromise);
KeySystemConfig() = default;
@@ -169,10 +179,6 @@ struct KeySystemConfig {
nsString GetDebugInfo() const;
- // Return true if the given key system is equal to `mKeySystem`, or it can be
- // mapped to the same key system
- bool IsSameKeySystem(const nsAString& aKeySystem) const;
-
nsString mKeySystem;
nsTArray<nsString> mInitDataTypes;
Requirement mPersistentState = Requirement::NotAllowed;
@@ -184,6 +190,22 @@ struct KeySystemConfig {
ContainerSupport mMP4;
ContainerSupport mWebM;
bool mIsHDCP22Compatible = false;
+
+ private:
+ static void CreateClearKeyKeySystemConfigs(
+ const KeySystemConfigRequest& aRequest,
+ nsTArray<KeySystemConfig>& aOutConfigs);
+ static void CreateWivineL3KeySystemConfigs(
+ const KeySystemConfigRequest& aRequest,
+ nsTArray<KeySystemConfig>& aOutConfigs);
+};
+
+struct KeySystemConfigRequest final {
+ KeySystemConfigRequest(const nsAString& aKeySystem,
+ KeySystemConfig::DecryptionInfo aDecryption)
+ : mKeySystem(aKeySystem), mDecryption(aDecryption) {}
+ const nsString mKeySystem;
+ const KeySystemConfig::DecryptionInfo mDecryption;
};
KeySystemConfig::SessionType ConvertToKeySystemConfigSessionType(