From 7495db8855b723a7e15bf59458a1f78564628fde Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Fri, 22 Dec 2023 11:40:37 +0100 Subject: [PATCH] gl: colorbalance: Add DMA_DRM passthrough support By adding them to additional caps that are only supported in passthrough mode. They get filtered out otherwise. This can easily extended to support other caps later. Part-of: --- .../ext/gl/gstglcolorbalance.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-base/ext/gl/gstglcolorbalance.c b/subprojects/gst-plugins-base/ext/gl/gstglcolorbalance.c index 3af45696c0..e5619e3a3f 100644 --- a/subprojects/gst-plugins-base/ext/gl/gstglcolorbalance.c +++ b/subprojects/gst-plugins-base/ext/gl/gstglcolorbalance.c @@ -71,17 +71,21 @@ GST_DEBUG_CATEGORY_STATIC (glcolorbalance_debug); "framerate = " GST_VIDEO_FPS_RANGE ", " \ "texture-target = (string) { 2D, external-oes }" +#define GST_GL_COLOR_BALANCE_VIDEO_CAPS_FULL \ + GST_GL_COLOR_BALANCE_VIDEO_CAPS " ; " \ + GST_VIDEO_DMA_DRM_CAPS_MAKE + static GstStaticPadTemplate gst_gl_color_balance_element_src_pad_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_GL_COLOR_BALANCE_VIDEO_CAPS)); + GST_STATIC_CAPS (GST_GL_COLOR_BALANCE_VIDEO_CAPS_FULL)); static GstStaticPadTemplate gst_gl_color_balance_element_sink_pad_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_GL_COLOR_BALANCE_VIDEO_CAPS)); + GST_STATIC_CAPS (GST_GL_COLOR_BALANCE_VIDEO_CAPS_FULL)); /* *INDENT-OFF* */ static const gchar glsl_external_image_extension[] = @@ -139,12 +143,26 @@ static GstCaps * gcb_transform_internal_caps (GstGLFilter * filter, GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps) { - GstCaps *tmp = gst_caps_copy (caps); + static GstStaticCaps static_caps = + GST_STATIC_CAPS (GST_GL_COLOR_BALANCE_VIDEO_CAPS); + GstCaps *non_passthrough_caps = gst_static_caps_get (&static_caps); + GstCaps *tmp; gint i; + /* If we're not in passthrough mode, we can only output 2D textures, * but can always receive any compatible texture. * This function is not called in passthrough mode, so we can do the * transform unconditionally */ + + non_passthrough_caps = gst_caps_make_writable (non_passthrough_caps); + for (i = 0; i < gst_caps_get_size (non_passthrough_caps); i++) { + GstStructure *outs = gst_caps_get_structure (non_passthrough_caps, i); + gst_structure_remove_field (outs, "texture-target"); + } + tmp = gst_caps_intersect_full (caps, non_passthrough_caps, + GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (non_passthrough_caps); + for (i = 0; i < gst_caps_get_size (tmp); i++) { GstStructure *outs = gst_caps_get_structure (tmp, i); if (direction == GST_PAD_SINK) {