1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
/*
* GStreamer
* Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_GL_QUERY_H__
#define __GST_GL_QUERY_H__
#include <gst/gl/gstgl_fwd.h>
#include <gst/gl/gstgldebug.h>
G_BEGIN_DECLS
/**
* GstGLQueryType:
* @GST_GL_QUERY_NONE: no query
* @GST_GL_QUERY_TIME_ELAPSED: query the time elapsed
* @GST_GL_QUERY_TIMESTAMP: query the current time
*/
typedef enum
{
GST_GL_QUERY_NONE,
GST_GL_QUERY_TIME_ELAPSED,
GST_GL_QUERY_TIMESTAMP,
} GstGLQueryType;
/**
* GstGLQuery:
*
* Opaque #GstGLQuery struct
*/
struct _GstGLQuery
{
/*< private >*/
GstGLContext * context;
guint query_type;
guint query_id;
gboolean supported;
gboolean start_called;
GstGLAsyncDebug debug;
gpointer _padding[GST_PADDING];
};
GST_GL_API
void gst_gl_query_init (GstGLQuery * query,
GstGLContext * context,
GstGLQueryType query_type);
GST_GL_API
void gst_gl_query_unset (GstGLQuery * query);
GST_GL_API
GstGLQuery * gst_gl_query_new (GstGLContext * context,
GstGLQueryType query_type);
GST_GL_API
void gst_gl_query_free (GstGLQuery * query);
GST_GL_API
void gst_gl_query_start (GstGLQuery * query);
GST_GL_API
void gst_gl_query_end (GstGLQuery * query);
GST_GL_API
void gst_gl_query_counter (GstGLQuery * query);
GST_GL_API
guint64 gst_gl_query_result (GstGLQuery * query);
#define gst_gl_query_start_log_valist(query,cat,level,object,format,varargs) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG_valist (&(query)->debug, cat, level, object, format, varargs); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_start (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#define gst_gl_query_counter_log_valist(query,cat,level,object,format,varargs) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG_valist (&(query)->debug, cat, level, object, format, varargs); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_counter (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#ifdef G_HAVE_ISO_VARARGS
#define gst_gl_query_start_log(query,cat,level,object,format,...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_start (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#define gst_gl_query_counter_log(query,cat,level,object,format,...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_counter (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#else /* G_HAVE_ISO_VARARGS */
#if G_HAVE_GNUC_VARARGS
#define gst_gl_query_start_log(query,cat,level,object,format,args...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_start (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#define gst_gl_query_counter_log(query,cat,level,object,format,args...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_counter (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
static inline void
gst_gl_query_start_log(GstGLQuery * query, GstDebugCategory * cat,
GstDebugLevel level, GObject * object, const gchar * format, ...)
{
va_list varargs;
va_start (varargs, format);
gst_gl_query_start_log_valist (query, cat, level, object, format, varargs);
va_end (varargs);
}
static inline void
gst_gl_query_counter_log(GstGLQuery * query, GstDebugCategory * cat,
GstDebugLevel level, GObject * object, const gchar * format, ...)
{
va_list varargs;
va_start (varargs, format);
gst_gl_query_counter_log_valist (query, cat, level, object, format, varargs);
va_end (varargs);
}
#endif /* G_HAVE_GNUC_VARARGS */
#endif /* G_HAVE_ISO_VARARGS */
G_END_DECLS
#endif /* __GST_GL_QUERY_H__ */
|