summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPhilippe Normand <philn@igalia.com>2021-08-29 10:30:53 +0100
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-08-31 17:59:06 +0000
commit2b6f0404a7305ac5e1006ac280906e0be3c09e47 (patch)
tree2fe033bdbfac19792c70ac8d7d6338c36fc565cf /ext
parentedc04df13c4ec4610768bc3b877d361fae492166 (diff)
downloadgstreamer-plugins-bad-2b6f0404a7305ac5e1006ac280906e0be3c09e47.tar.gz
wpevideosrc: Implement basic heuristic for raw caps negotiation
Before this patch raw caps could be negotiated already with a capsfilter, but in cases where wpesrc is being auto-plugged this approach can't be used. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2498>
Diffstat (limited to 'ext')
-rw-r--r--ext/wpe/gstwpevideosrc.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/ext/wpe/gstwpevideosrc.cpp b/ext/wpe/gstwpevideosrc.cpp
index 0bab056f8..9b00d78b2 100644
--- a/ext/wpe/gstwpevideosrc.cpp
+++ b/ext/wpe/gstwpevideosrc.cpp
@@ -140,22 +140,22 @@ GST_DEBUG_CATEGORY_EXTERN (wpe_video_src_debug);
#define gst_wpe_video_src_parent_class parent_class
G_DEFINE_TYPE(GstWpeVideoSrc, gst_wpe_video_src, GST_TYPE_GL_BASE_SRC);
-#define WPE_RAW_CAPS "; video/x-raw, " \
+#define WPE_RAW_CAPS "video/x-raw, " \
"format = (string) BGRA, " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE ", " \
"pixel-aspect-ratio = (fraction)1/1"
-#define WPE_BASIC_CAPS "video/x-raw(memory:GLMemory), " \
+#define WPE_GL_CAPS "video/x-raw(memory:GLMemory), " \
"format = (string) RGBA, " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE ", " \
"pixel-aspect-ratio = (fraction)1/1, texture-target = (string)2D"
-#define WPE_VIDEO_SRC_CAPS WPE_BASIC_CAPS WPE_RAW_CAPS
-#define WPE_VIDEO_SRC_DOC_CAPS WPE_BASIC_CAPS "; video/x-raw, format = (string) BGRA"
+#define WPE_VIDEO_SRC_CAPS WPE_GL_CAPS "; " WPE_RAW_CAPS
+#define WPE_VIDEO_SRC_DOC_CAPS WPE_GL_CAPS "; video/x-raw, format = (string) BGRA"
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
@@ -373,13 +373,24 @@ gst_wpe_video_src_stop (GstBaseSrc * base_src)
}
static GstCaps *
-gst_wpe_video_src_fixate (GstBaseSrc * base_src, GstCaps * caps)
+gst_wpe_video_src_fixate (GstBaseSrc * base_src, GstCaps * combined_caps)
{
GstWpeVideoSrc *src = GST_WPE_VIDEO_SRC (base_src);
GstStructure *structure;
gint width, height;
+ GstCaps *caps;
+
+ /* In situation where software GL support is explicitly requested, select raw
+ * caps, otherwise perform default caps negotiation. Unfortunately at this
+ * point we don't know yet if a GL context will be usable or not, so we can't
+ * check the element GstContext.
+ */
+ if (!g_strcmp0 (g_getenv ("LIBGL_ALWAYS_SOFTWARE"), "true")) {
+ caps = gst_caps_from_string (WPE_RAW_CAPS);
+ } else {
+ caps = gst_caps_make_writable (combined_caps);
+ }
- caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (structure, "width", DEFAULT_WIDTH);