3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef __GST_GL_DEBUG_H__
22 #define __GST_GL_DEBUG_H__
24 #include <gst/gl/gl.h>
28 typedef struct _GstGLAsyncDebug GstGLAsyncDebug;
30 typedef gchar * (*GstGLAsyncDebugLogGetMessage) (gpointer user_data);
35 * #GstGLAsyncDebug an opaque structure and should only be accessed through the
38 struct _GstGLAsyncDebug
42 GstDebugCategory *cat;
45 const gchar *function;
51 GstGLAsyncDebugLogGetMessage callback;
53 GDestroyNotify notify;
56 GstGLAsyncDebug * gst_gl_async_debug_new (void);
57 void gst_gl_async_debug_free (GstGLAsyncDebug * ad);
58 void gst_gl_async_debug_init (GstGLAsyncDebug * ad);
59 void gst_gl_async_debug_unset (GstGLAsyncDebug * ad);
60 void gst_gl_async_debug_freeze (GstGLAsyncDebug * ad);
61 void gst_gl_async_debug_thaw (GstGLAsyncDebug * ad);
64 * GST_GL_ASYNC_CAT_LEVEL_LOG_valist:
65 * @ad: the #GstGLAsyncDebug to store the message in
66 * @cat: the #GstDebugCategory to output the message in
67 * @level: the #GstLevel
68 * @file: the file where the debug message originates from
69 * @function: the function where the debug message originates from
70 * @line: the line in @file where the debug message originates from
71 * @object: (allow-none): a #GObject to associate with the debug message
72 * @format: a printf style format string
73 * @varargs: the list of arguments for @format
75 * Stores a debug message in @ad for later output
77 #define GST_GL_ASYNC_CAT_LEVEL_LOG_valist(ad,cat,level,object,format,varargs) \
78 gst_gl_async_debug_store_log_msg_valist (ad, cat, level, __FILE__, \
79 GST_FUNCTION, __LINE__, object, format, varargs)
82 * GST_GL_ASYNC_CAT_LEVEL_LOG:
83 * @ad: the #GstGLAsyncDebug to store the message in
84 * @cat: the #GstDebugCategory to output the message in
85 * @level: the #GstLevel
86 * @file: the file where the debug message originates from
87 * @function: the function where the debug message originates from
88 * @line: the line in @file where the debug message originates from
89 * @object: (allow-none): a #GObject to associate with the debug message
90 * @format: a printf style format string
91 * @...: the list of arguments for @format
93 * Stores a debug message in @ad for later output
95 #if G_HAVE_ISO_VARARGS
96 #define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,...) \
97 gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
98 __LINE__, object, format, __VA_ARGS__)
99 #else /* G_HAVE_ISO_VARARGS */
100 #if G_HAVE_GNUC_VARARGS
101 #define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,args...) \
102 gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
103 __LINE__, object, format, ##args)
104 #else /* G_HAVE_GNUC_VARARGS */
106 GST_GL_ASYNC_CAT_LEVEL_LOG(GstGLAsyncDebug * ad, GstDebugCategory * cat,
107 GstDebugLevel level, GObject * object, const gchar * format, ...)
111 va_start (varargs, format);
112 GST_GL_ASYNC_CAT_LEVEL_LOG_valist (ad, cat, level, object, format, varargs);
115 #endif /* G_HAVE_GNUC_VARARGS */
116 #endif /* G_HAVE_ISO_VARARGS */
118 #if !defined(GST_DISABLE_GST_DEBUG)
120 void gst_gl_insert_debug_marker (GstGLContext * context,
121 const gchar * format, ...) G_GNUC_PRINTF (2, 3);
122 void gst_gl_async_debug_output_log_msg (GstGLAsyncDebug * ad);
123 void gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
124 GstDebugCategory * cat,
127 const gchar * function,
130 const gchar * format, ...) G_GNUC_PRINTF (8, 9);
131 void gst_gl_async_debug_store_log_msg_valist (GstGLAsyncDebug * ad,
132 GstDebugCategory * cat,
135 const gchar * function,
138 const gchar * format,
139 va_list varargs) G_GNUC_PRINTF (8, 0);
141 #else /* GST_DISABLE_GST_DEBUG */
143 #define gst_gl_async_debug_output_log_msg(ad) G_STMT_START{ }G_STMT_END
144 #define gst_gl_async_debug_store_log_msg_valist(ad,cat,level,file,function,line,object,format,args) G_STMT_START{ }G_STMT_END
146 #if G_HAVE_ISO_VARARGS
148 #define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END
149 #define gst_gl_async_debug_store_log_msg(...) G_STMT_START{ }G_STMT_END
151 #else /* G_HAVE_ISO_VARARGS */
152 #if G_HAVE_GNUC_VARARGS
154 #define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END
155 #define gst_gl_async_debug_store_log_msg(args...) G_STMT_START{ }G_STMT_END
157 #else /* G_HAVE_GNUC_VARARGS */
160 gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
165 gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
166 GstDebugCategory * cat, GstDebugLevel level, const gchar * file,
167 const gchar * function, gint line, GstObject * object,
168 const gchar * format, ...)
172 #endif /* G_HAVE_GNUC_VARARGS */
173 #endif /* G_HAVE_ISO_VARARGS */
174 #endif /* GST_DISABLE_GST_DEBUG */
178 #endif /* __GST_GL_DEBUG_H__ */