Diff
Modified: trunk/Source/WebCore/ChangeLog (221181 => 221182)
--- trunk/Source/WebCore/ChangeLog 2017-08-25 07:20:34 UTC (rev 221181)
+++ trunk/Source/WebCore/ChangeLog 2017-08-25 07:50:30 UTC (rev 221182)
@@ -1,3 +1,20 @@
+2017-08-25 Xabier Rodriguez Calvar <[email protected]>
+
+ [EME][GStreamer] Move createDescryptor function to GStreamerEMEUtilities
+ https://bugs.webkit.org/show_bug.cgi?id=175930
+
+ Reviewed by Žan Doberšek.
+
+ * platform/graphics/gstreamer/GStreamerUtilities.cpp:
+ (WebCore::createGstDecryptor): Deleted.
+ * platform/graphics/gstreamer/GStreamerUtilities.h:
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
+ (WebCore::GStreamerEMEUtilities::createDecryptor): Created.
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
+ * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+ (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use
+ GStreamerEMEUtilities::createDecryptor instead.
+
2017-08-25 Zan Dobersek <[email protected]>
[WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp (221181 => 221182)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp 2017-08-25 07:20:34 UTC (rev 221181)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp 2017-08-25 07:50:30 UTC (rev 221182)
@@ -197,46 +197,6 @@
return result;
}
-#if GST_CHECK_VERSION(1, 5, 3) && ENABLE(ENCRYPTED_MEDIA)
-GstElement* createGstDecryptor(const gchar* protectionSystem)
-{
- GstElement* decryptor = nullptr;
- GList* decryptors = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECRYPTOR, GST_RANK_MARGINAL);
-
- GST_TRACE("looking for decryptor for %s", protectionSystem);
-
- for (GList* walk = decryptors; !decryptor && walk; walk = g_list_next(walk)) {
- GstElementFactory* factory = reinterpret_cast<GstElementFactory*>(walk->data);
-
- GST_TRACE("checking factory %s", GST_OBJECT_NAME(factory));
-
- for (const GList* current = gst_element_factory_get_static_pad_templates(factory); current && !decryptor; current = g_list_next(current)) {
- GstStaticPadTemplate* staticPadTemplate = static_cast<GstStaticPadTemplate*>(current->data);
- GRefPtr<GstCaps> caps = adoptGRef(gst_static_pad_template_get_caps(staticPadTemplate));
- unsigned length = gst_caps_get_size(caps.get());
-
- GST_TRACE("factory %s caps has size %u", GST_OBJECT_NAME(factory), length);
- for (unsigned i = 0; !decryptor && i < length; ++i) {
- GstStructure* structure = gst_caps_get_structure(caps.get(), i);
- GST_TRACE("checking structure %s", gst_structure_get_name(structure));
- if (gst_structure_has_field_typed(structure, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD, G_TYPE_STRING)) {
- const gchar* sysId = gst_structure_get_string(structure, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD);
- GST_TRACE("structure %s has protection system %s", gst_structure_get_name(structure), sysId);
- if (!g_ascii_strcasecmp(protectionSystem, sysId)) {
- GST_DEBUG("found decryptor %s for %s", GST_OBJECT_NAME(factory), protectionSystem);
- decryptor = gst_element_factory_create(factory, nullptr);
- break;
- }
- }
- }
- }
- }
- gst_plugin_feature_list_free(decryptors);
- GST_TRACE("returning decryptor %p", decryptor);
- return decryptor;
}
-#endif
-}
-
#endif // USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h (221181 => 221182)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h 2017-08-25 07:20:34 UTC (rev 221181)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h 2017-08-25 07:50:30 UTC (rev 221182)
@@ -63,8 +63,4 @@
unsigned getGstPlayFlag(const char* nick);
GstClockTime toGstClockTime(float time);
bool gstRegistryHasElementForMediaType(GList* elementFactories, const char* capsString);
-
-#if GST_CHECK_VERSION(1, 5, 3) && ENABLE(ENCRYPTED_MEDIA)
-GstElement* createGstDecryptor(const gchar* protectionSystem);
-#endif
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp (221181 => 221182)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp 2017-08-25 07:20:34 UTC (rev 221181)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp 2017-08-25 07:50:30 UTC (rev 221182)
@@ -22,13 +22,60 @@
#include "config.h"
#include "GStreamerEMEUtilities.h"
+#include <wtf/glib/GRefPtr.h>
+
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
+GST_DEBUG_CATEGORY_EXTERN(webkit_media_player_debug);
+#define GST_CAT_DEFAULT webkit_media_player_debug
+
namespace WebCore {
const char* GStreamerEMEUtilities::s_ClearKeyUUID = WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID;
const char* GStreamerEMEUtilities::s_ClearKeyKeySystem = "org.w3.clearkey";
+#if GST_CHECK_VERSION(1, 5, 3)
+GstElement* GStreamerEMEUtilities::createDecryptor(const char* protectionSystem)
+{
+ GstElement* decryptor = nullptr;
+ GList* decryptors = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECRYPTOR, GST_RANK_MARGINAL);
+
+ GST_TRACE("looking for decryptor for %s", protectionSystem);
+
+ for (GList* walk = decryptors; !decryptor && walk; walk = g_list_next(walk)) {
+ GstElementFactory* factory = reinterpret_cast<GstElementFactory*>(walk->data);
+
+ GST_TRACE("checking factory %s", GST_OBJECT_NAME(factory));
+
+ for (const GList* current = gst_element_factory_get_static_pad_templates(factory); current && !decryptor; current = g_list_next(current)) {
+ GstStaticPadTemplate* staticPadTemplate = static_cast<GstStaticPadTemplate*>(current->data);
+ GRefPtr<GstCaps> caps = adoptGRef(gst_static_pad_template_get_caps(staticPadTemplate));
+ unsigned length = gst_caps_get_size(caps.get());
+
+ GST_TRACE("factory %s caps has size %u", GST_OBJECT_NAME(factory), length);
+ for (unsigned i = 0; !decryptor && i < length; ++i) {
+ GstStructure* structure = gst_caps_get_structure(caps.get(), i);
+ GST_TRACE("checking structure %s", gst_structure_get_name(structure));
+ if (gst_structure_has_field_typed(structure, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD, G_TYPE_STRING)) {
+ const char* sysId = gst_structure_get_string(structure, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD);
+ GST_TRACE("structure %s has protection system %s", gst_structure_get_name(structure), sysId);
+ if (!g_ascii_strcasecmp(protectionSystem, sysId)) {
+ GST_DEBUG("found decryptor %s for %s", GST_OBJECT_NAME(factory), protectionSystem);
+ decryptor = gst_element_factory_create(factory, nullptr);
+ break;
+ }
+ }
+ }
+ }
+ }
+ gst_plugin_feature_list_free(decryptors);
+ GST_TRACE("returning decryptor %p", decryptor);
+ return decryptor;
}
+#else
+#error "At least a GStreamer version 1.5.3 is required to enable ENCRYPTED_MEDIA."
+#endif
+}
+
#endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h (221181 => 221182)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2017-08-25 07:20:34 UTC (rev 221181)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2017-08-25 07:50:30 UTC (rev 221182)
@@ -23,6 +23,7 @@
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#include <gst/gst.h>
#include <wtf/text/WTFString.h>
#define WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID "58147ec8-0423-4659-92e6-f52c5ce8c3cc"
@@ -48,6 +49,8 @@
ASSERT_NOT_REACHED();
return { };
}
+
+ static GstElement* createDecryptor(const char* protectionSystem);
};
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (221181 => 221182)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2017-08-25 07:20:34 UTC (rev 221181)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2017-08-25 07:50:30 UTC (rev 221182)
@@ -25,9 +25,9 @@
#include "AudioTrackPrivateGStreamer.h"
#include "GRefPtrGStreamer.h"
+#include "GStreamerEMEUtilities.h"
#include "GStreamerMediaDescription.h"
#include "GStreamerMediaSample.h"
-#include "GStreamerUtilities.h"
#include "InbandTextTrackPrivateGStreamer.h"
#include "MediaDescription.h"
#include "SourceBufferPrivateGStreamer.h"
@@ -527,7 +527,7 @@
// Any previous decryptor should have been removed from the pipeline by disconnectFromAppSinkFromStreamingThread()
ASSERT(!m_decryptor);
- m_decryptor = WebCore::createGstDecryptor(gst_structure_get_string(structure, "protection-system"));
+ m_decryptor = GStreamerEMEUtilities::createDecryptor(gst_structure_get_string(structure, "protection-system"));
if (!m_decryptor) {
GST_ERROR("decryptor not found for caps: %" GST_PTR_FORMAT, m_demuxerSrcPadCaps.get());
return;