Title: [219978] trunk/Source/WebCore
Revision
219978
Author
[email protected]
Date
2017-07-27 01:55:09 -0700 (Thu, 27 Jul 2017)

Log Message

[EME][GStreamer] Add barebones CDM interface implementations for ClearKey
https://bugs.webkit.org/show_bug.cgi?id=174887

Reviewed by Xabier Rodriguez-Calvar.

Add empty ClearKey derivations of CDMFactory, CDMPrivate and CDMInstance
classes. These will be enhanced as the implementation progresses.

ClearKey is added to CDMInstance::ImplementationType, and the
CDMInstanceClearKey::implementationType() override returns that value.
Type traits specialization for the CDMInstanceClearKey class is also
added, utilizing the CDMInstance::ImplementationType::ClearKey value.

The implementation file is added to the WPE build, along with the
necessary inclusion directory.

* PlatformWPE.cmake:
* platform/encryptedmedia/CDMInstance.h:
* platform/encryptedmedia/clearkey/CDMClearKey.cpp: Added.
(WebCore::CDMFactoryClearKey::createCDM):
(WebCore::CDMFactoryClearKey::supportsKeySystem):
(WebCore::CDMPrivateClearKey::supportsInitDataType):
(WebCore::CDMPrivateClearKey::supportsConfiguration):
(WebCore::CDMPrivateClearKey::supportsConfigurationWithRestrictions):
(WebCore::CDMPrivateClearKey::supportsSessionTypeWithConfiguration):
(WebCore::CDMPrivateClearKey::supportsRobustness):
(WebCore::CDMPrivateClearKey::distinctiveIdentifiersRequirement):
(WebCore::CDMPrivateClearKey::persistentStateRequirement):
(WebCore::CDMPrivateClearKey::distinctiveIdentifiersAreUniquePerOriginAndClearable):
(WebCore::CDMPrivateClearKey::createInstance):
(WebCore::CDMPrivateClearKey::loadAndInitialize):
(WebCore::CDMPrivateClearKey::supportsServerCertificates):
(WebCore::CDMPrivateClearKey::supportsSessions):
(WebCore::CDMPrivateClearKey::supportsInitData):
(WebCore::CDMPrivateClearKey::sanitizeResponse):
(WebCore::CDMPrivateClearKey::sanitizeSessionId):
(WebCore::CDMInstanceClearKey::initializeWithConfiguration):
(WebCore::CDMInstanceClearKey::setDistinctiveIdentifiersAllowed):
(WebCore::CDMInstanceClearKey::setPersistentStateAllowed):
(WebCore::CDMInstanceClearKey::setServerCertificate):
(WebCore::CDMInstanceClearKey::requestLicense):
(WebCore::CDMInstanceClearKey::updateLicense):
(WebCore::CDMInstanceClearKey::loadSession):
(WebCore::CDMInstanceClearKey::closeSession):
(WebCore::CDMInstanceClearKey::removeSessionData):
(WebCore::CDMInstanceClearKey::storeRecordOfKeyUsage):
* platform/encryptedmedia/clearkey/CDMClearKey.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219977 => 219978)


--- trunk/Source/WebCore/ChangeLog	2017-07-27 08:13:55 UTC (rev 219977)
+++ trunk/Source/WebCore/ChangeLog	2017-07-27 08:55:09 UTC (rev 219978)
@@ -1,5 +1,55 @@
 2017-07-27  Zan Dobersek  <[email protected]>
 
+        [EME][GStreamer] Add barebones CDM interface implementations for ClearKey
+        https://bugs.webkit.org/show_bug.cgi?id=174887
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Add empty ClearKey derivations of CDMFactory, CDMPrivate and CDMInstance
+        classes. These will be enhanced as the implementation progresses.
+
+        ClearKey is added to CDMInstance::ImplementationType, and the
+        CDMInstanceClearKey::implementationType() override returns that value.
+        Type traits specialization for the CDMInstanceClearKey class is also
+        added, utilizing the CDMInstance::ImplementationType::ClearKey value.
+
+        The implementation file is added to the WPE build, along with the
+        necessary inclusion directory.
+
+        * PlatformWPE.cmake:
+        * platform/encryptedmedia/CDMInstance.h:
+        * platform/encryptedmedia/clearkey/CDMClearKey.cpp: Added.
+        (WebCore::CDMFactoryClearKey::createCDM):
+        (WebCore::CDMFactoryClearKey::supportsKeySystem):
+        (WebCore::CDMPrivateClearKey::supportsInitDataType):
+        (WebCore::CDMPrivateClearKey::supportsConfiguration):
+        (WebCore::CDMPrivateClearKey::supportsConfigurationWithRestrictions):
+        (WebCore::CDMPrivateClearKey::supportsSessionTypeWithConfiguration):
+        (WebCore::CDMPrivateClearKey::supportsRobustness):
+        (WebCore::CDMPrivateClearKey::distinctiveIdentifiersRequirement):
+        (WebCore::CDMPrivateClearKey::persistentStateRequirement):
+        (WebCore::CDMPrivateClearKey::distinctiveIdentifiersAreUniquePerOriginAndClearable):
+        (WebCore::CDMPrivateClearKey::createInstance):
+        (WebCore::CDMPrivateClearKey::loadAndInitialize):
+        (WebCore::CDMPrivateClearKey::supportsServerCertificates):
+        (WebCore::CDMPrivateClearKey::supportsSessions):
+        (WebCore::CDMPrivateClearKey::supportsInitData):
+        (WebCore::CDMPrivateClearKey::sanitizeResponse):
+        (WebCore::CDMPrivateClearKey::sanitizeSessionId):
+        (WebCore::CDMInstanceClearKey::initializeWithConfiguration):
+        (WebCore::CDMInstanceClearKey::setDistinctiveIdentifiersAllowed):
+        (WebCore::CDMInstanceClearKey::setPersistentStateAllowed):
+        (WebCore::CDMInstanceClearKey::setServerCertificate):
+        (WebCore::CDMInstanceClearKey::requestLicense):
+        (WebCore::CDMInstanceClearKey::updateLicense):
+        (WebCore::CDMInstanceClearKey::loadSession):
+        (WebCore::CDMInstanceClearKey::closeSession):
+        (WebCore::CDMInstanceClearKey::removeSessionData):
+        (WebCore::CDMInstanceClearKey::storeRecordOfKeyUsage):
+        * platform/encryptedmedia/clearkey/CDMClearKey.h: Added.
+
+2017-07-27  Zan Dobersek  <[email protected]>
+
         [EME] Allow CDMInstance type traits specialization
         https://bugs.webkit.org/show_bug.cgi?id=174886
 

Modified: trunk/Source/WebCore/PlatformWPE.cmake (219977 => 219978)


--- trunk/Source/WebCore/PlatformWPE.cmake	2017-07-27 08:13:55 UTC (rev 219977)
+++ trunk/Source/WebCore/PlatformWPE.cmake	2017-07-27 08:55:09 UTC (rev 219978)
@@ -150,6 +150,15 @@
     platform/wpe/WidgetWPE.cpp
 )
 
+if (ENABLE_ENCRYPTED_MEDIA)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        "${WEBCORE_DIR}/platform/encryptedmedia/clearkey"
+    )
+    list(APPEND WebCore_SOURCES
+        platform/encryptedmedia/clearkey/CDMClearKey.cpp
+    )
+endif ()
+
 list(APPEND WebCore_USER_AGENT_STYLE_SHEETS
     ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsBase.css
 )

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h (219977 => 219978)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h	2017-07-27 08:13:55 UTC (rev 219977)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h	2017-07-27 08:55:09 UTC (rev 219978)
@@ -49,6 +49,7 @@
 
     enum class ImplementationType {
         Mock,
+        ClearKey,
     };
 
     virtual ImplementationType implementationType() const = 0;

Added: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp (0 => 219978)


--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp	2017-07-27 08:55:09 UTC (rev 219978)
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2016 Metrological Group B.V.
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CDMClearKey.h"
+
+#if ENABLE(ENCRYPTED_MEDIA)
+
+namespace WebCore {
+
+CDMFactoryClearKey::CDMFactoryClearKey() = default;
+CDMFactoryClearKey::~CDMFactoryClearKey() = default;
+
+std::unique_ptr<CDMPrivate> CDMFactoryClearKey::createCDM(CDM&)
+{
+    return std::unique_ptr<CDMPrivate>(new CDMPrivateClearKey);
+}
+
+bool CDMFactoryClearKey::supportsKeySystem(const String&)
+{
+    return false;
+}
+
+CDMPrivateClearKey::CDMPrivateClearKey() = default;
+CDMPrivateClearKey::~CDMPrivateClearKey() = default;
+
+bool CDMPrivateClearKey::supportsInitDataType(const AtomicString&) const
+{
+    return false;
+}
+
+bool CDMPrivateClearKey::supportsConfiguration(const CDMKeySystemConfiguration&) const
+{
+    return false;
+}
+
+bool CDMPrivateClearKey::supportsConfigurationWithRestrictions(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
+{
+    return false;
+}
+
+bool CDMPrivateClearKey::supportsSessionTypeWithConfiguration(CDMSessionType&, const CDMKeySystemConfiguration&) const
+{
+    return false;
+}
+
+bool CDMPrivateClearKey::supportsRobustness(const String&) const
+{
+    return false;
+}
+
+CDMRequirement CDMPrivateClearKey::distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
+{
+    return CDMRequirement::Optional;
+}
+
+CDMRequirement CDMPrivateClearKey::persistentStateRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
+{
+    return CDMRequirement::Optional;
+}
+
+bool CDMPrivateClearKey::distinctiveIdentifiersAreUniquePerOriginAndClearable(const CDMKeySystemConfiguration&) const
+{
+    return false;
+}
+
+RefPtr<CDMInstance> CDMPrivateClearKey::createInstance()
+{
+    return adoptRef(new CDMInstanceClearKey);
+}
+
+void CDMPrivateClearKey::loadAndInitialize()
+{
+}
+
+bool CDMPrivateClearKey::supportsServerCertificates() const
+{
+    return false;
+}
+
+bool CDMPrivateClearKey::supportsSessions() const
+{
+    return false;
+}
+
+bool CDMPrivateClearKey::supportsInitData(const AtomicString&, const SharedBuffer&) const
+{
+    return false;
+}
+
+RefPtr<SharedBuffer> CDMPrivateClearKey::sanitizeResponse(const SharedBuffer&) const
+{
+    return nullptr;
+}
+
+std::optional<String> CDMPrivateClearKey::sanitizeSessionId(const String&) const
+{
+    return std::nullopt;
+}
+
+CDMInstanceClearKey::CDMInstanceClearKey() = default;
+CDMInstanceClearKey::~CDMInstanceClearKey() = default;
+
+CDMInstance::SuccessValue CDMInstanceClearKey::initializeWithConfiguration(const CDMKeySystemConfiguration&)
+{
+    return Failed;
+}
+
+CDMInstance::SuccessValue CDMInstanceClearKey::setDistinctiveIdentifiersAllowed(bool)
+{
+    return Failed;
+}
+
+CDMInstance::SuccessValue CDMInstanceClearKey::setPersistentStateAllowed(bool)
+{
+    return Failed;
+}
+
+CDMInstance::SuccessValue CDMInstanceClearKey::setServerCertificate(Ref<SharedBuffer>&&)
+{
+    return Failed;
+}
+
+void CDMInstanceClearKey::requestLicense(LicenseType, const AtomicString&, Ref<SharedBuffer>&&, LicenseCallback)
+{
+}
+
+void CDMInstanceClearKey::updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback)
+{
+}
+
+void CDMInstanceClearKey::loadSession(LicenseType, const String&, const String&, LoadSessionCallback)
+{
+}
+
+void CDMInstanceClearKey::closeSession(const String&, CloseSessionCallback)
+{
+}
+
+void CDMInstanceClearKey::removeSessionData(const String&, LicenseType, RemoveSessionDataCallback)
+{
+}
+
+void CDMInstanceClearKey::storeRecordOfKeyUsage(const String&)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(ENCRYPTED_MEDIA)

Added: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h (0 => 219978)


--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h	2017-07-27 08:55:09 UTC (rev 219978)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2016 Metrological Group B.V.
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(ENCRYPTED_MEDIA)
+
+#include "CDM.h"
+#include "CDMInstance.h"
+#include "CDMPrivate.h"
+
+namespace WebCore {
+
+class CDMFactoryClearKey final : public CDMFactory {
+public:
+    CDMFactoryClearKey();
+    virtual ~CDMFactoryClearKey();
+
+    std::unique_ptr<CDMPrivate> createCDM(CDM&) override;
+    bool supportsKeySystem(const String&) override;
+};
+
+class CDMPrivateClearKey final : public CDMPrivate {
+public:
+    CDMPrivateClearKey();
+    virtual ~CDMPrivateClearKey();
+
+    bool supportsInitDataType(const AtomicString&) const override;
+    bool supportsConfiguration(const CDMKeySystemConfiguration&) const override;
+    bool supportsConfigurationWithRestrictions(const CDMKeySystemConfiguration&, const CDMRestrictions&) const override;
+    bool supportsSessionTypeWithConfiguration(CDMSessionType&, const CDMKeySystemConfiguration&) const override;
+    bool supportsRobustness(const String&) const override;
+    CDMRequirement distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const override;
+    CDMRequirement persistentStateRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const override;
+    bool distinctiveIdentifiersAreUniquePerOriginAndClearable(const CDMKeySystemConfiguration&) const override;
+    RefPtr<CDMInstance> createInstance() override;
+    void loadAndInitialize() override;
+    bool supportsServerCertificates() const override;
+    bool supportsSessions() const override;
+    bool supportsInitData(const AtomicString&, const SharedBuffer&) const override;
+    RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const override;
+    std::optional<String> sanitizeSessionId(const String&) const override;
+};
+
+class CDMInstanceClearKey final : public CDMInstance {
+public:
+    CDMInstanceClearKey();
+    virtual ~CDMInstanceClearKey();
+
+    ImplementationType implementationType() const { return ImplementationType::ClearKey; }
+
+    SuccessValue initializeWithConfiguration(const CDMKeySystemConfiguration&) override;
+    SuccessValue setDistinctiveIdentifiersAllowed(bool) override;
+    SuccessValue setPersistentStateAllowed(bool) override;
+    SuccessValue setServerCertificate(Ref<SharedBuffer>&&) override;
+
+    void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback) override;
+    void updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback) override;
+    void loadSession(LicenseType, const String&, const String&, LoadSessionCallback) override;
+    void closeSession(const String&, CloseSessionCallback) override;
+    void removeSessionData(const String&, LicenseType, RemoveSessionDataCallback) override;
+    void storeRecordOfKeyUsage(const String&) override;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CDM_INSTANCE(WebCore::CDMInstanceClearKey, WebCore::CDMInstance::ImplementationType::ClearKey);
+
+#endif // ENABLE(ENCRYPTED_MEDIA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to