Skip to content
Permalink
Browse files
[GStreamer] Use imxvideoconvert_g2d element inside the sink when avai…
…lable

https://bugs.webkit.org/show_bug.cgi?id=223693

Patch by Zan Dobersek <zdobersek@igalia.com> on 2021-03-24
Reviewed by Philippe Normand.

On some iMX platforms we require the use of imxvideoconvert_g2d element
in order to properly convert the visual buffers before they can be
rendered through our pipeline. We expect to require this buffer if it's
present in the GStreamer plugin registry on the system.

We search for this element and, if found, add it to the sink and
position it at the beginning, before the glupload element.

Based on an approach outlined by Gabriel Valcazar.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):

Canonical link: https://commits.webkit.org/235700@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
commit-queue@webkit.org committed Mar 24, 2021
1 parent 04b247e commit 111e685dd7cff7e007099d735a93f64ce8506c7a
Showing 2 changed files with 40 additions and 1 deletion.
@@ -1,3 +1,23 @@
2021-03-24 Zan Dobersek <zdobersek@igalia.com>

[GStreamer] Use imxvideoconvert_g2d element inside the sink when available
https://bugs.webkit.org/show_bug.cgi?id=223693

Reviewed by Philippe Normand.

On some iMX platforms we require the use of imxvideoconvert_g2d element
in order to properly convert the visual buffers before they can be
rendered through our pipeline. We expect to require this buffer if it's
present in the GStreamer plugin registry on the system.

We search for this element and, if found, add it to the sink and
position it at the beginning, before the glupload element.

Based on an approach outlined by Gabriel Valcazar.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):

2021-03-24 Antoine Quint <graouts@webkit.org>

Support animation of the tab-size CSS property
@@ -68,6 +68,17 @@ static void webKitGLVideoSinkConstructed(GObject* object)
ASSERT(sink->priv->appSink);
g_object_set(sink->priv->appSink.get(), "enable-last-sample", FALSE, "emit-signals", TRUE, "max-buffers", 1, nullptr);

auto* imxVideoConvertG2D =
[]() -> GstElement*
{
auto elementFactor = adoptGRef(gst_element_factory_find("imxvideoconvert_g2d"));
if (elementFactor)
return gst_element_factory_create(elementFactor.get(), nullptr);
return nullptr;
}();
if (imxVideoConvertG2D)
gst_bin_add(GST_BIN_CAST(sink), imxVideoConvertG2D);

GstElement* upload = gst_element_factory_make("glupload", nullptr);
GstElement* colorconvert = gst_element_factory_make("glcolorconvert", nullptr);
ASSERT(upload);
@@ -96,9 +107,17 @@ static void webKitGLVideoSinkConstructed(GObject* object)
gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, nullptr));
g_object_set(sink->priv->appSink.get(), "caps", caps.get(), nullptr);

if (imxVideoConvertG2D)
gst_element_link(imxVideoConvertG2D, upload);
gst_element_link_many(upload, colorconvert, sink->priv->appSink.get(), nullptr);

GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink"));
GstElement* sinkElement =
[&] {
if (imxVideoConvertG2D)
return imxVideoConvertG2D;
return upload;
}();
GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(sinkElement, "sink"));
gst_element_add_pad(GST_ELEMENT_CAST(sink), gst_ghost_pad_new("sink", pad.get()));
}

0 comments on commit 111e685

Please sign in to comment.