From c02d41c2591bbb67b0237981359e0c2f712c050b Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 25 Oct 2024 21:46:45 +1100 Subject: [PATCH] subtitleoverlay: Check for memory capsfeature on video/x-raw Don't assume that video/x-raw caps means buffers are mappable or can be processed by videoconvert and friends. Only plug those converters for real system memory, and treat other memory capsfeatures as hardware surfaces Part-of: --- .../gst/playback/gstsubtitleoverlay.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c b/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c index 2f2dfcc81d..2c0ab98601 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c +++ b/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c @@ -272,11 +272,18 @@ _is_video_pad (GstPad * pad, gboolean * hw_accelerated) for (i = 0; i < gst_caps_get_size (caps) && !ret; i++) { name = gst_structure_get_name (gst_caps_get_structure (caps, i)); + GstCapsFeatures *features = gst_caps_get_features (caps, i); + if (g_str_equal (name, "video/x-raw")) { ret = TRUE; - if (hw_accelerated) - *hw_accelerated = FALSE; - + if (hw_accelerated) { + if (gst_caps_features_contains (features, + GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY)) { + *hw_accelerated = FALSE; + } else { + *hw_accelerated = TRUE; + } + } } else if (g_str_has_prefix (name, "video/x-surface")) { ret = TRUE; if (hw_accelerated)