From 22bb3107d71baa269deef177a5dcf5d2b2b49121 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 19 May 2023 16:20:56 +0800 Subject: [PATCH] gl: add a method to check whether DMA modifier is supported in EGL Part-of: --- .../gst-libs/gst/gl/egl/gstglcontext_egl.c | 20 +++++++++++++++++++ .../gst-libs/gst/gl/egl/gstglcontext_egl.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c index 28400c6734..3719b9feed 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -1826,3 +1826,23 @@ beach: #endif return FALSE; } + +/** + * gst_gl_context_egl_supports_modifier: (skip) + * @context: an EGL #GStGLContext + * + * Returns: %TRUE if the @context supports the modifiers. + * + * Since: 1.24 + */ +gboolean +gst_gl_context_egl_supports_modifier (GstGLContext * context) +{ +#if GST_GL_HAVE_DMABUF + g_return_val_if_fail (GST_IS_GL_CONTEXT_EGL (context), FALSE); + + return gst_gl_context_egl_fetch_dma_formats (context); +#else + return FALSE; +#endif +} diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.h b/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.h index 72385170dc..7732885b76 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.h @@ -113,6 +113,8 @@ G_GNUC_INTERNAL gboolean gst_gl_context_egl_get_format_modifiers (GstGLContext * context, gint fourcc, const GArray ** modifiers); +G_GNUC_INTERNAL +gboolean gst_gl_context_egl_supports_modifier (GstGLContext * context); G_END_DECLS #endif /* __GST_GL_CONTEXT_EGL_H__ */