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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5948>
This commit is contained in:
Robert Mader 2023-12-22 11:40:37 +01:00 committed by GStreamer Marge Bot
parent 143f661318
commit 7495db8855

View file

@ -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) {