Skip to content

Commit 4325332

Browse files
committed
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted-segmented.https.html is failing https://bugs.webkit.org/show_bug.cgi?id=211375
Reviewed by Xabier Rodriguez-Calvar. Wrap the decryptor in a new bin along with parsebin. This should allow seamless switching between encrypted and clear content processing. As this new parser is auto-plugged by parsebin in urisourcebin we have to be cautious regarding the infinite auto-plugging outcome by removing our new parser from the autoplug-factories passed to the inner parsebin element. Canonical link: https://commits.webkit.org/295500@main
1 parent 2f4fef0 commit 4325332

13 files changed

Lines changed: 355 additions & 19 deletions

File tree

LayoutTests/platform/glib/TestExpectations

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,12 +2619,9 @@ webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4
26192619
webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-retrieve-persistent-usage-record.https.html [ Skip ]
26202620
webkit.org/b/211840 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-retrieve-persistent-license.https.html [ Failure ]
26212621
webkit.org/b/211840 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-destroy-persistent-license.https.html [ Failure ]
2622-
webkit.org/b/211375 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted-segmented.https.html [ Skip ]
26232622
webkit.org/b/210113 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-reset-src-after-setmediakeys.https.html [ Failure ]
26242623
webkit.org/b/178707 imported/w3c/web-platform-tests/encrypted-media/encrypted-media-default-feature-policy.https.sub.html [ Skip ]
26252624

2626-
# Doesn't recover from media decode error.
2627-
26282625
imported/w3c/web-platform-tests/encrypted-media/idlharness.https.html [ Pass ]
26292626
imported/w3c/web-platform-tests/encrypted-media/clearkey-check-encryption-scheme.https.html [ Pass ]
26302627
imported/w3c/web-platform-tests/encrypted-media/clearkey-check-initdata-type.https.html [ Pass ]
@@ -2633,6 +2630,7 @@ imported/w3c/web-platform-tests/encrypted-media/clearkey-events-session-closed-e
26332630
imported/w3c/web-platform-tests/encrypted-media/clearkey-invalid-license.https.html [ Pass ]
26342631
imported/w3c/web-platform-tests/encrypted-media/clearkey-keystatuses.https.html [ Pass ]
26352632
imported/w3c/web-platform-tests/encrypted-media/clearkey-keystatuses-multiple-sessions.https.html [ Pass ]
2633+
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted-segmented.https.html [ Pass ]
26362634
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted.https.html [ Pass ]
26372635
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear.https.html [ Pass ]
26382636
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear-sources.https.html [ Pass ]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
PASS org.w3.clearkey, temporary, mp4, playback, encrypted and clear sources in separate segments
3+

Source/WebCore/platform/SourcesGStreamer.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ platform/graphics/gstreamer/eme/CDMThunder.cpp
8787
platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp
8888
platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp
8989
platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp @no-unify
90+
platform/graphics/gstreamer/eme/WebKitThunderParser.cpp @no-unify
9091

9192
platform/graphics/gstreamer/mse/AppendPipeline.cpp
9293
platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp

Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
8080
#include "CDMThunder.h"
8181
#include "WebKitThunderDecryptorGStreamer.h"
82+
#include "WebKitThunderParser.h"
8283
#endif
8384

8485
#if ENABLE(VIDEO)
@@ -424,8 +425,12 @@ void registerWebKitGStreamerElements()
424425
// - Use GST_RANK_NONE for elements explicitely created by WebKit (no auto-plugging).
425426

426427
#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
427-
if (!CDMFactoryThunder::singleton().supportedKeySystems().isEmpty())
428+
if (!CDMFactoryThunder::singleton().supportedKeySystems().isEmpty()) {
429+
// The Thunder parser is auto-plugged by parsebin and its internal parsebin can
430+
// auto-plug the Thunder decryptor.
428431
gst_element_register(nullptr, "webkitthunder", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_MEDIA_THUNDER_DECRYPT);
432+
gst_element_register(nullptr, "webkitthunderparser", GST_RANK_PRIMARY + 101, WEBKIT_TYPE_MEDIA_THUNDER_PARSER);
433+
}
429434
#endif
430435

431436
#if ENABLE(MEDIA_STREAM)

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
#include "GStreamerEMEUtilities.h"
7272
#include "SharedBuffer.h"
7373
#include "WebKitCommonEncryptionDecryptorGStreamer.h"
74+
#if ENABLE(THUNDER)
75+
#include "CDMThunder.h"
76+
#endif
7477
#endif
7578

7679
#if ENABLE(WEB_AUDIO)
@@ -2513,8 +2516,13 @@ void MediaPlayerPrivateGStreamer::configureParsebin(GstElement* parsebin)
25132516
g_signal_connect(parsebin, "autoplug-select",
25142517
G_CALLBACK(+[](GstElement*, GstPad*, GstCaps* caps, GstElementFactory* factory, MediaPlayerPrivateGStreamer* player) -> unsigned {
25152518
static auto tryAutoPlug = *gstGetAutoplugSelectResult("try"_s);
2519+
static auto skipAutoPlug = *gstGetAutoplugSelectResult("skip"_s);
25162520
static auto exposeAutoPlug = *gstGetAutoplugSelectResult("expose"_s);
25172521

2522+
auto name = StringView::fromLatin1(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE_CAST(factory)));
2523+
if (name == "webkitthunderparser"_s && player->m_url.protocolIsBlob())
2524+
return skipAutoPlug;
2525+
25182526
auto* structure = gst_caps_get_structure(caps, 0);
25192527
if (!structure)
25202528
return tryAutoPlug;
@@ -2543,6 +2551,26 @@ void MediaPlayerPrivateGStreamer::configureParsebin(GstElement* parsebin)
25432551
}), this);
25442552
}
25452553

2554+
void MediaPlayerPrivateGStreamer::configureUriDecodebin2(GstElement* element)
2555+
{
2556+
ASSERT(m_isLegacyPlaybin);
2557+
#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
2558+
if (CDMFactoryThunder::singleton().supportedKeySystems().isEmpty())
2559+
return;
2560+
2561+
g_signal_connect(element, "autoplug-select", G_CALLBACK(+[](GstElement*, GstPad*, GstCaps*, GstElementFactory* factory, gpointer) -> unsigned {
2562+
static auto tryAutoPlug = *gstGetAutoplugSelectResult("try"_s);
2563+
static auto skipAutoPlug = *gstGetAutoplugSelectResult("skip"_s);
2564+
auto name = StringView::fromLatin1(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE_CAST(factory)));
2565+
if (name == "webkitthunderparser"_s)
2566+
return skipAutoPlug;
2567+
return tryAutoPlug;
2568+
}), nullptr);
2569+
#else
2570+
UNUSED_PARAM(element);
2571+
#endif
2572+
}
2573+
25462574
void MediaPlayerPrivateGStreamer::configureElement(GstElement* element)
25472575
{
25482576
configureElementPlatformQuirks(element);
@@ -2561,6 +2589,11 @@ void MediaPlayerPrivateGStreamer::configureElement(GstElement* element)
25612589
if (nameView.startsWith("parsebin"_s))
25622590
configureParsebin(element);
25632591

2592+
// The legacy decodebin2 stack doesn't integrate well with parsebin, so prevent auto-plugging of
2593+
// the webkitthunderparser.
2594+
if (nameView.startsWith("uridecodebin"_s) && m_isLegacyPlaybin)
2595+
configureUriDecodebin2(element);
2596+
25642597
// In case of playbin3 with <video ... preload="auto">, instantiate
25652598
// downloadbuffer element, otherwise the playbin3 would instantiate
25662599
// a queue element instead .

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ class MediaPlayerPrivateGStreamer
579579
void configureVideoDecoder(GstElement*);
580580
void configureElement(GstElement*);
581581
void configureParsebin(GstElement*);
582+
void configureUriDecodebin2(GstElement*);
582583

583584
void configureElementPlatformQuirks(GstElement*);
584585

Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ class GStreamerEMEUtilities {
114114
static constexpr auto s_unspecifiedUUID = GST_PROTECTION_UNSPECIFIED_SYSTEM_ID ""_s;
115115
static constexpr auto s_unspecifiedKeySystem = GST_PROTECTION_UNSPECIFIED_SYSTEM_ID ""_s;
116116

117+
static constexpr std::array<ASCIILiteral, 11> s_cencEncryptionMediaTypes = { "video/mp4"_s, "audio/mp4"_s, "video/x-h264"_s, "video/x-h265"_s, "audio/mpeg"_s,
118+
"audio/x-eac3"_s, "audio/x-ac3"_s, "audio/x-flac"_s, "audio/x-opus"_s, "video/x-vp9"_s, "video/x-av1"_s };
119+
static constexpr std::array<ASCIILiteral, 7> s_webmEncryptionMediaTypes = { "video/webm"_s, "audio/webm"_s, "video/x-vp9"_s, "video/x-av1"_s, "audio/x-opus"_s, "audio/x-vorbis"_s, "video/x-vp8"_s };
120+
117121
static bool isClearKeyKeySystem(const String& keySystem)
118122
{
119123
return equalIgnoringASCIICase(keySystem, s_ClearKeyKeySystem);
@@ -191,6 +195,6 @@ class GStreamerEMEUtilities {
191195
}
192196
};
193197

194-
}
198+
} // namespace WebCore
195199

196200
#endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)

Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ static bool decrypt(WebKitMediaCommonEncryptionDecrypt*, GstBuffer* iv, GstBuffe
4747
GST_DEBUG_CATEGORY(webkitMediaThunderDecryptDebugCategory);
4848
#define GST_CAT_DEFAULT webkitMediaThunderDecryptDebugCategory
4949

50-
static const char* cencEncryptionMediaTypes[] = { "video/mp4", "audio/mp4", "video/x-h264", "video/x-h265", "audio/mpeg",
51-
"audio/x-eac3", "audio/x-ac3", "audio/x-flac", "audio/x-opus", "video/x-vp9", "video/x-av1", nullptr };
52-
static const char* webmEncryptionMediaTypes[] = { "video/webm", "audio/webm", "video/x-vp9", "video/x-av1", "audio/x-opus", "audio/x-vorbis", "video/x-vp8", nullptr };
53-
5450
static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
5551
GST_PAD_SRC,
5652
GST_PAD_ALWAYS,
@@ -79,25 +75,25 @@ static GRefPtr<GstCaps> createSinkPadTemplateCaps()
7975
auto& supportedKeySystems = CDMFactoryThunder::singleton().supportedKeySystems();
8076

8177
if (supportedKeySystems.isEmpty()) {
82-
GST_WARNING("no supported key systems in Thunder, we won't be able to decrypt anything with the its decryptor");
78+
GST_WARNING("no supported key systems in Thunder, we won't be able to decrypt anything with the decryptor");
8379
return caps;
8480
}
8581

86-
for (int i = 0; cencEncryptionMediaTypes[i]; ++i) {
82+
for (const auto& mediaType : GStreamerEMEUtilities::s_cencEncryptionMediaTypes) {
8783
gst_caps_append_structure(caps.get(), gst_structure_new("application/x-cenc", "original-media-type", G_TYPE_STRING,
88-
cencEncryptionMediaTypes[i], nullptr));
84+
mediaType.characters(), nullptr));
8985
}
9086
for (const auto& keySystem : supportedKeySystems) {
91-
for (int i = 0; cencEncryptionMediaTypes[i]; ++i) {
87+
for (const auto& mediaType : GStreamerEMEUtilities::s_cencEncryptionMediaTypes) {
9288
gst_caps_append_structure(caps.get(), gst_structure_new("application/x-cenc", "original-media-type", G_TYPE_STRING,
93-
cencEncryptionMediaTypes[i], "protection-system", G_TYPE_STRING, GStreamerEMEUtilities::keySystemToUuid(keySystem), nullptr));
89+
mediaType.characters(), "protection-system", G_TYPE_STRING, GStreamerEMEUtilities::keySystemToUuid(keySystem), nullptr));
9490
}
9591
}
9692

9793
if (supportedKeySystems.contains(GStreamerEMEUtilities::s_WidevineKeySystem) || supportedKeySystems.contains(GStreamerEMEUtilities::s_ClearKeyKeySystem)) {
98-
for (int i = 0; webmEncryptionMediaTypes[i]; ++i) {
94+
for (const auto& mediaType : GStreamerEMEUtilities::s_webmEncryptionMediaTypes) {
9995
gst_caps_append_structure(caps.get(), gst_structure_new("application/x-webm-enc", "original-media-type", G_TYPE_STRING,
100-
webmEncryptionMediaTypes[i], nullptr));
96+
mediaType.characters(), nullptr));
10197
}
10298
}
10399

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/* GStreamer Thunder Parser
2+
*
3+
* Copyright (C) 2025 Comcast Inc.
4+
* Copyright (C) 2025 Igalia S.L.
5+
*
6+
* This library is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Library General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 2 of the License, or (at your option) any later version.
10+
*
11+
* This library is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Library General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Library General Public
17+
* License along with this library; if not, write to the
18+
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19+
* Boston, MA 02110-1301, USA.
20+
*/
21+
22+
#include "config.h"
23+
#include "WebKitThunderParser.h"
24+
25+
#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER) && USE(GSTREAMER)
26+
27+
#include "CDMProxyThunder.h"
28+
#include "GStreamerCommon.h"
29+
#include "GStreamerEMEUtilities.h"
30+
#include <wtf/glib/WTFGType.h>
31+
#include <wtf/text/StringView.h>
32+
33+
GST_DEBUG_CATEGORY(webkitMediaThunderParserDebugCategory);
34+
#define GST_CAT_DEFAULT webkitMediaThunderParserDebugCategory
35+
36+
typedef struct _WebKitMediaThunderParserPrivate {
37+
GRefPtr<GstElement> decryptor;
38+
GRefPtr<GstElement> parser;
39+
} WebKitMediaThunderParserPrivate;
40+
41+
typedef struct _WebKitMediaThunderParser {
42+
GstBin parent;
43+
WebKitMediaThunderParserPrivate* priv;
44+
} WebKitMediaThunderParser;
45+
46+
typedef struct _WebKitMediaThunderParserClass {
47+
GstBinClass parentClass;
48+
} WebKitMediaThunderParserClass;
49+
50+
using namespace WebCore;
51+
52+
WEBKIT_DEFINE_TYPE(WebKitMediaThunderParser, webkit_media_thunder_parser, GST_TYPE_BIN)
53+
54+
static GstStaticPadTemplate thunderParseSrcTemplate = GST_STATIC_PAD_TEMPLATE("src_%u",
55+
GST_PAD_SRC,
56+
GST_PAD_SOMETIMES,
57+
GST_STATIC_CAPS(
58+
"video/webm; "
59+
"audio/webm; "
60+
"video/mp4; "
61+
"audio/mp4; "
62+
"audio/mpeg; "
63+
"audio/x-flac; "
64+
"audio/x-eac3; "
65+
"audio/x-ac3; "
66+
"video/x-h264; "
67+
"video/x-h265; "
68+
"video/x-vp9; video/x-vp8; "
69+
"video/x-av1; "
70+
"audio/x-opus; audio/x-vorbis"));
71+
72+
static GRefPtr<GstCaps> createThunderParseSinkPadTemplateCaps()
73+
{
74+
GRefPtr<GstCaps> caps = adoptGRef(gst_caps_new_empty());
75+
76+
auto& supportedKeySystems = CDMFactoryThunder::singleton().supportedKeySystems();
77+
78+
if (supportedKeySystems.isEmpty()) {
79+
GST_WARNING("no supported key systems in Thunder, we won't be able to decrypt anything with the decryptor");
80+
return caps;
81+
}
82+
83+
for (const auto& mediaType : GStreamerEMEUtilities::s_cencEncryptionMediaTypes) {
84+
gst_caps_append_structure(caps.get(), gst_structure_new_empty(mediaType.characters()));
85+
gst_caps_append_structure(caps.get(), gst_structure_new("application/x-cenc", "original-media-type", G_TYPE_STRING, mediaType.characters(), nullptr));
86+
}
87+
for (const auto& keySystem : supportedKeySystems) {
88+
for (const auto& mediaType : GStreamerEMEUtilities::s_cencEncryptionMediaTypes) {
89+
gst_caps_append_structure(caps.get(), gst_structure_new("application/x-cenc", "original-media-type", G_TYPE_STRING,
90+
mediaType.characters(), "protection-system", G_TYPE_STRING, GStreamerEMEUtilities::keySystemToUuid(keySystem), nullptr));
91+
}
92+
}
93+
94+
if (supportedKeySystems.contains(GStreamerEMEUtilities::s_WidevineKeySystem) || supportedKeySystems.contains(GStreamerEMEUtilities::s_ClearKeyKeySystem)) {
95+
for (const auto& mediaType : GStreamerEMEUtilities::s_webmEncryptionMediaTypes) {
96+
gst_caps_append_structure(caps.get(), gst_structure_new_empty(mediaType.characters()));
97+
gst_caps_append_structure(caps.get(), gst_structure_new("application/x-webm-enc", "original-media-type", G_TYPE_STRING, mediaType.characters(), nullptr));
98+
}
99+
}
100+
101+
return caps;
102+
}
103+
104+
static void webkitMediaThunderParserConstructed(GObject* object)
105+
{
106+
G_OBJECT_CLASS(webkit_media_thunder_parser_parent_class)->constructed(object);
107+
108+
auto self = WEBKIT_MEDIA_THUNDER_PARSER(object);
109+
self->priv->parser = makeGStreamerElement("parsebin"_s, "inner-parser"_s);
110+
111+
auto factories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECRYPTOR, GST_RANK_MARGINAL);
112+
factories = g_list_sort(factories, gst_plugin_feature_rank_compare_func);
113+
for (GList* tmp = factories; tmp; tmp = tmp->next) {
114+
auto factory = GST_ELEMENT_FACTORY_CAST(tmp->data);
115+
self->priv->decryptor = gst_element_factory_create(factory, nullptr);
116+
if (self->priv->decryptor) {
117+
GST_DEBUG_OBJECT(self, "Using decryptor %" GST_PTR_FORMAT, self->priv->decryptor.get());
118+
break;
119+
}
120+
}
121+
gst_plugin_feature_list_free(factories);
122+
123+
if (!self->priv->decryptor) [[unlikely]] {
124+
GST_DEBUG_OBJECT(self, "Unable to find any decryptor, encrypted buffers will be passed-through");
125+
self->priv->decryptor = gst_element_factory_make("identity", nullptr);
126+
}
127+
128+
gst_bin_add_many(GST_BIN_CAST(self), self->priv->decryptor.get(), self->priv->parser.get(), nullptr);
129+
gst_element_link(self->priv->decryptor.get(), self->priv->parser.get());
130+
131+
g_signal_connect(self->priv->parser.get(), "autoplug-factories", G_CALLBACK(+[](GstElement*, GstPad*, GstCaps* caps, gpointer userData) -> GValueArray* {
132+
auto self = WEBKIT_MEDIA_THUNDER_PARSER(userData);
133+
ALLOW_DEPRECATED_DECLARATIONS_BEGIN;
134+
GValueArray* result;
135+
136+
auto factories = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_DECODABLE, GST_RANK_MARGINAL);
137+
auto list = gst_element_factory_list_filter(factories, caps, GST_PAD_SINK, gst_caps_is_fixed(caps));
138+
result = g_value_array_new(g_list_length(list));
139+
for (GList* tmp = list; tmp; tmp = tmp->next) {
140+
auto factory = GST_ELEMENT_FACTORY_CAST(tmp->data);
141+
auto name = StringView::fromLatin1(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE_CAST(factory)));
142+
if (name == "webkitthunderparser"_s)
143+
continue;
144+
145+
auto decryptorFactoryName = StringView::fromLatin1(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE_CAST(gst_element_get_factory(self->priv->decryptor.get()))));
146+
if (name == decryptorFactoryName)
147+
continue;
148+
149+
GValue value = G_VALUE_INIT;
150+
g_value_init(&value, G_TYPE_OBJECT);
151+
g_value_set_object(&value, factory);
152+
g_value_array_append(result, &value);
153+
g_value_unset(&value);
154+
}
155+
gst_plugin_feature_list_free(list);
156+
gst_plugin_feature_list_free(factories);
157+
return result;
158+
ALLOW_DEPRECATED_DECLARATIONS_END;
159+
}), self);
160+
161+
g_signal_connect(self->priv->parser.get(), "pad-added", G_CALLBACK(+[](GstElement*, GstPad* pad, gpointer userData) {
162+
static unsigned counter = 0;
163+
auto name = makeString("src_"_s, counter);
164+
counter++;
165+
gst_element_add_pad(GST_ELEMENT_CAST(userData), gst_ghost_pad_new(name.ascii().data(), pad));
166+
}), self);
167+
168+
auto decryptorSinkPad = adoptGRef(gst_element_get_static_pad(self->priv->decryptor.get(), "sink"));
169+
gst_element_add_pad(GST_ELEMENT_CAST(self), gst_ghost_pad_new("sink", decryptorSinkPad.get()));
170+
gst_bin_sync_children_states(GST_BIN_CAST(self));
171+
}
172+
173+
static void webkit_media_thunder_parser_class_init(WebKitMediaThunderParserClass* klass)
174+
{
175+
GST_DEBUG_CATEGORY_INIT(webkitMediaThunderParserDebugCategory, "webkitthunderparser", 0, "Thunder parser");
176+
177+
auto objectClass = G_OBJECT_CLASS(klass);
178+
objectClass->constructed = webkitMediaThunderParserConstructed;
179+
180+
auto elementClass = GST_ELEMENT_CLASS(klass);
181+
auto padTemplateCaps = createThunderParseSinkPadTemplateCaps();
182+
gst_element_class_add_pad_template(elementClass, gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, padTemplateCaps.get()));
183+
gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&thunderParseSrcTemplate));
184+
185+
gst_element_class_set_static_metadata(elementClass, "Parse potentially encrypted content", "Codec/Parser/Audio/Video",
186+
"Parse potentially encrypted content", "Philippe Normand <philn@igalia.com>");
187+
}
188+
189+
#undef GST_CAT_DEFAULT
190+
191+
#endif // ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER) && USE(GSTREAMER)

0 commit comments

Comments
 (0)