diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c index 0c0642acab..2091f4de08 100644 --- a/gst-libs/gst/gl/gstglutils.c +++ b/gst-libs/gst/gl/gstglutils.c @@ -24,6 +24,7 @@ #include #include +#include #include "gl.h" #include "gstglutils.h" @@ -932,3 +933,29 @@ gst_gl_caps_replace_all_caps_features (const GstCaps * caps, return tmp; } + +#ifndef GST_DISABLE_GST_DEBUG +void +gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...) +{ + const GstGLFuncs *gl = context->gl_vtable; + gchar *string; + gint len; + va_list args; + + va_start (args, format); + len = g_vasprintf (&string, format, args); + va_end (args); + +#if defined (GL_DEBUG_TYPE_MARKER) + if (gl->DebugMessageInsert) { + gl->DebugMessageInsert (GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_MARKER, + 0, GL_DEBUG_SEVERITY_LOW, (gsize) len, string); + } else +#endif + if (gl->InsertEventMarker) + gl->InsertEventMarker (len, string); + else if (gl->StringMarker) + gl->StringMarker (len, string); +} +#endif diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h index ee606e0614..90ddd8efa9 100644 --- a/gst-libs/gst/gl/gstglutils.h +++ b/gst-libs/gst/gl/gstglutils.h @@ -109,6 +109,24 @@ gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps, const gchar * feature_name); +#ifndef GST_DISABLE_GST_DEBUG +void gst_gl_insert_debug_marker (GstGLContext * context, + const gchar * format, ...) G_GNUC_PRINTF (2, 3); +#else /* GST_DISABLE_GST_DEBUG */ +#if G_HAVE_ISO_VARARGS +#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END +#else /* G_HAVE_ISO_VARARGS */ +#if G_HAVE_GNUC_VARARGS +#define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END +#else /* G_HAVE_GNUC_VARARGS */ +static inline void +gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...) +{ +} +#endif /* G_HAVE_GNUC_VARARGS */ +#endif /* G_HAVE_ISO_VARARGS */ +#endif /* GST_DISABLE_GST_DEBUG */ + G_END_DECLS #endif /* __GST_GL_UTILS_H__ */