Diff
Modified: trunk/Source/WebCore/ChangeLog (220789 => 220790)
--- trunk/Source/WebCore/ChangeLog 2017-08-16 07:49:36 UTC (rev 220789)
+++ trunk/Source/WebCore/ChangeLog 2017-08-16 08:25:45 UTC (rev 220790)
@@ -1,3 +1,25 @@
+2017-08-16 Xabier Rodriguez Calvar <[email protected]>
+
+ [GStreamer][EME] Rework handling key systems and UUIDs
+ https://bugs.webkit.org/show_bug.cgi?id=175567
+
+ Reviewed by Žan Doberšek.
+
+ The UUIDs and key system strings were moved to the
+ GStreamerEMEUtilities class because so far they were managed by
+ the decryptors and that was ugly.
+
+ * platform/GStreamer.cmake:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Added.
+ (WebCore::GStreamerEMEUtilities::isClearKeyKeySystem):
+ (WebCore::GStreamerEMEUtilities::keySystemToUuid):
+ * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
+ (webkit_media_clear_key_decrypt_class_init):
+ * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
+
2017-08-16 Andy Estes <[email protected]>
[Payment Request] Add an ENABLE flag and an experimental feature preference
Modified: trunk/Source/WebCore/platform/GStreamer.cmake (220789 => 220790)
--- trunk/Source/WebCore/platform/GStreamer.cmake 2017-08-16 07:49:36 UTC (rev 220789)
+++ trunk/Source/WebCore/platform/GStreamer.cmake 2017-08-16 08:25:45 UTC (rev 220790)
@@ -42,6 +42,7 @@
platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp
platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
+ platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp
platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp
platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (220789 => 220790)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2017-08-16 07:49:36 UTC (rev 220789)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2017-08-16 08:25:45 UTC (rev 220790)
@@ -111,6 +111,7 @@
#endif // USE(TEXTURE_MAPPER_GL)
#if ENABLE(ENCRYPTED_MEDIA)
+#include "GStreamerEMEUtilities.h"
#include "SharedBuffer.h"
#include "WebKitClearKeyDecryptorGStreamer.h"
#endif
@@ -1048,8 +1049,7 @@
bool result = false;
#if ENABLE(ENCRYPTED_MEDIA)
- if (equalLettersIgnoringASCIICase(keySystem, "org.w3.clearkey"))
- result = true;
+ result = GStreamerEMEUtilities::isClearKeyKeySystem(keySystem);
#endif
GST_DEBUG("checking for KeySystem support with %s and type %s: %s", keySystem.utf8().data(), mimeType.utf8().data(), boolForPrinting(result));
Added: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp (0 => 220790)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp 2017-08-16 08:25:45 UTC (rev 220790)
@@ -0,0 +1,34 @@
+/* GStreamer EME Utilities class
+ *
+ * Copyright (C) 2017 Metrological
+ * Copyright (C) 2017 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "GStreamerEMEUtilities.h"
+
+#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
+
+namespace WebCore {
+
+const char* GStreamerEMEUtilities::s_ClearKeyUUID = WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID;
+const char* GStreamerEMEUtilities::s_ClearKeyKeySystem = "org.w3.clearkey";
+
+}
+
+#endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
Added: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h (0 => 220790)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2017-08-16 08:25:45 UTC (rev 220790)
@@ -0,0 +1,55 @@
+/* GStreamer EME Utilities class
+ *
+ * Copyright (C) 2017 Metrological
+ * Copyright (C) 2017 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
+
+#include <wtf/text/WTFString.h>
+
+#define WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID "58147ec8-0423-4659-92e6-f52c5ce8c3cc"
+
+namespace WebCore {
+
+class GStreamerEMEUtilities {
+
+public:
+ static const char* s_ClearKeyUUID;
+ static const char* s_ClearKeyKeySystem;
+
+ static bool isClearKeyKeySystem(const String& keySystem)
+ {
+ return equalIgnoringASCIICase(keySystem, s_ClearKeyKeySystem);
+ }
+
+ static const char* keySystemToUuid(const String& keySystem)
+ {
+ if (isClearKeyKeySystem(keySystem))
+ return s_ClearKeyUUID;
+
+ ASSERT_NOT_REACHED();
+ return { };
+ }
+};
+
+}
+
+#endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp (220789 => 220790)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp 2017-08-16 07:49:36 UTC (rev 220789)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp 2017-08-16 08:25:45 UTC (rev 220790)
@@ -25,6 +25,7 @@
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
#include "GRefPtrGStreamer.h"
+#include "GStreamerEMEUtilities.h"
#include <gcrypt.h>
#include <gst/base/gstbytereader.h>
#include <wtf/RunLoop.h>
@@ -54,8 +55,8 @@
static GstStaticPadTemplate sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS("application/x-cenc, original-media-type=(string)video/x-h264, protection-system=(string)" CLEAR_KEY_PROTECTION_SYSTEM_UUID "; "
- "application/x-cenc, original-media-type=(string)audio/mpeg, protection-system=(string)" CLEAR_KEY_PROTECTION_SYSTEM_UUID));
+ GST_STATIC_CAPS("application/x-cenc, original-media-type=(string)video/x-h264, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID "; "
+ "application/x-cenc, original-media-type=(string)audio/mpeg, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID));
static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
GST_PAD_SRC,
@@ -84,7 +85,7 @@
"webkitclearkey", 0, "ClearKey decryptor");
WebKitMediaCommonEncryptionDecryptClass* cencClass = WEBKIT_MEDIA_CENC_DECRYPT_CLASS(klass);
- cencClass->protectionSystemId = CLEAR_KEY_PROTECTION_SYSTEM_UUID;
+ cencClass->protectionSystemId = WebCore::GStreamerEMEUtilities::s_ClearKeyUUID;
cencClass->handleKeyResponse = GST_DEBUG_FUNCPTR(webKitMediaClearKeyDecryptorHandleKeyResponse);
cencClass->setupCipher = GST_DEBUG_FUNCPTR(webKitMediaClearKeyDecryptorSetupCipher);
cencClass->decrypt = GST_DEBUG_FUNCPTR(webKitMediaClearKeyDecryptorDecrypt);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h (220789 => 220790)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h 2017-08-16 07:49:36 UTC (rev 220789)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h 2017-08-16 08:25:45 UTC (rev 220790)
@@ -25,9 +25,6 @@
#include "WebKitCommonEncryptionDecryptorGStreamer.h"
-#define CLEAR_KEY_PROTECTION_SYSTEM_UUID "58147ec8-0423-4659-92e6-f52c5ce8c3cc"
-#define CLEAR_KEY_PROTECTION_SYSTEM_ID "org.w3.clearkey"
-
G_BEGIN_DECLS
#define WEBKIT_TYPE_MEDIA_CK_DECRYPT (webkit_media_clear_key_decrypt_get_type())