mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 18:52:07 +00:00
[310/906] Global reindent
Indent parameters: INDENT_PARAMETERS="--braces-on-if-line \ --case-brace-indentation0 \ --case-indentation2 \ --braces-after-struct-decl-line \ --line-length80 \ --no-tabs \ --cuddle-else \ --dont-line-up-parentheses \ --honour-newlines \ --continuation-indentation4 \ --tab-size8 \ --indent-level2"
This commit is contained in:
parent
10494006b8
commit
2e2213fbd7
6 changed files with 1802 additions and 1808 deletions
|
@ -36,8 +36,8 @@ gst_gl_buffer_finalize (GstGLBuffer* buffer)
|
||||||
|
|
||||||
g_object_unref (buffer->display);
|
g_object_unref (buffer->display);
|
||||||
|
|
||||||
GST_MINI_OBJECT_CLASS (gst_gl_buffer_parent_class)->
|
GST_MINI_OBJECT_CLASS (gst_gl_buffer_parent_class)->finalize (GST_MINI_OBJECT
|
||||||
finalize (GST_MINI_OBJECT (buffer));
|
(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -88,10 +88,10 @@ gst_gl_buffer_get_type (void)
|
||||||
|
|
||||||
|
|
||||||
GstGLBuffer *
|
GstGLBuffer *
|
||||||
gst_gl_buffer_new (GstGLDisplay* display,
|
gst_gl_buffer_new (GstGLDisplay * display, gint gl_width, gint gl_height)
|
||||||
gint gl_width, gint gl_height)
|
|
||||||
{
|
{
|
||||||
GstGLBuffer* gl_buffer = (GstGLBuffer *) gst_mini_object_new (GST_TYPE_GL_BUFFER);
|
GstGLBuffer *gl_buffer =
|
||||||
|
(GstGLBuffer *) gst_mini_object_new (GST_TYPE_GL_BUFFER);
|
||||||
|
|
||||||
gl_buffer->display = g_object_ref (display);
|
gl_buffer->display = g_object_ref (display);
|
||||||
gl_buffer->width = gl_width;
|
gl_buffer->width = gl_width;
|
||||||
|
@ -102,7 +102,8 @@ gst_gl_buffer_new (GstGLDisplay* display,
|
||||||
GST_BUFFER_SIZE (gl_buffer) = gst_gl_buffer_get_size (gl_width, gl_height);
|
GST_BUFFER_SIZE (gl_buffer) = gst_gl_buffer_get_size (gl_width, gl_height);
|
||||||
|
|
||||||
//blocking call, generate a texture using the pool
|
//blocking call, generate a texture using the pool
|
||||||
gst_gl_display_gen_texture (gl_buffer->display, &gl_buffer->texture, gl_width, gl_height) ;
|
gst_gl_display_gen_texture (gl_buffer->display, &gl_buffer->texture, gl_width,
|
||||||
|
gl_height);
|
||||||
|
|
||||||
return gl_buffer;
|
return gl_buffer;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -132,8 +132,7 @@ gst_gl_filter_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
//GstGLFilter *filter = GST_GL_FILTER (object);
|
//GstGLFilter *filter = GST_GL_FILTER (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id) {
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -146,8 +145,7 @@ gst_gl_filter_get_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
//GstGLFilter *filter = GST_GL_FILTER (object);
|
//GstGLFilter *filter = GST_GL_FILTER (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id) {
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -159,17 +157,16 @@ gst_gl_filter_reset (GstGLFilter* filter)
|
||||||
{
|
{
|
||||||
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
|
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
|
||||||
|
|
||||||
if (filter->display)
|
if (filter->display) {
|
||||||
{
|
|
||||||
if (filter_class->onReset)
|
if (filter_class->onReset)
|
||||||
filter_class->onReset (filter);
|
filter_class->onReset (filter);
|
||||||
|
|
||||||
if (filter_class->display_reset_cb != NULL) {
|
if (filter_class->display_reset_cb != NULL) {
|
||||||
gst_gl_display_thread_add (filter->display, gst_gl_filter_stop_gl, filter);
|
gst_gl_display_thread_add (filter->display, gst_gl_filter_stop_gl,
|
||||||
|
filter);
|
||||||
}
|
}
|
||||||
//blocking call, delete the FBO
|
//blocking call, delete the FBO
|
||||||
gst_gl_display_del_fbo (filter->display, filter->fbo,
|
gst_gl_display_del_fbo (filter->display, filter->fbo, filter->depthbuffer);
|
||||||
filter->depthbuffer);
|
|
||||||
g_object_unref (filter->display);
|
g_object_unref (filter->display);
|
||||||
filter->display = NULL;
|
filter->display = NULL;
|
||||||
}
|
}
|
||||||
|
@ -240,13 +237,11 @@ gst_gl_filter_transform_caps (GstBaseTransform* bt,
|
||||||
|
|
||||||
gst_caps_merge_structure (ret, gst_structure_copy (structure));
|
gst_caps_merge_structure (ret, gst_structure_copy (structure));
|
||||||
|
|
||||||
if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio")))
|
if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) {
|
||||||
{
|
|
||||||
gst_structure_set (structure,
|
gst_structure_set (structure,
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
"pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
||||||
gst_caps_merge_structure (ret, structure);
|
gst_caps_merge_structure (ret, structure);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gst_structure_free (structure);
|
gst_structure_free (structure);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, ret);
|
GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, ret);
|
||||||
|
@ -280,8 +275,7 @@ gst_gl_filter_prepare_output_buffer (GstBaseTransform* trans,
|
||||||
|
|
||||||
filter = GST_GL_FILTER (trans);
|
filter = GST_GL_FILTER (trans);
|
||||||
|
|
||||||
if (filter->display == NULL)
|
if (filter->display == NULL) {
|
||||||
{
|
|
||||||
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
|
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
|
||||||
|
|
||||||
filter->display = g_object_ref (gl_inbuf->display);
|
filter->display = g_object_ref (gl_inbuf->display);
|
||||||
|
@ -291,7 +285,8 @@ gst_gl_filter_prepare_output_buffer (GstBaseTransform* trans,
|
||||||
&filter->fbo, &filter->depthbuffer);
|
&filter->fbo, &filter->depthbuffer);
|
||||||
|
|
||||||
if (filter_class->display_init_cb != NULL) {
|
if (filter_class->display_init_cb != NULL) {
|
||||||
gst_gl_display_thread_add (filter->display, gst_gl_filter_start_gl, filter);
|
gst_gl_display_thread_add (filter->display, gst_gl_filter_start_gl,
|
||||||
|
filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter_class->onInitFBO)
|
if (filter_class->onInitFBO)
|
||||||
|
@ -323,8 +318,7 @@ gst_gl_filter_set_caps (GstBaseTransform* bt, GstCaps* incaps,
|
||||||
if (filter_class->set_caps)
|
if (filter_class->set_caps)
|
||||||
filter_class->set_caps (filter, incaps, outcaps);
|
filter_class->set_caps (filter, incaps, outcaps);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
{
|
|
||||||
GST_DEBUG ("bad caps");
|
GST_DEBUG ("bad caps");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -364,14 +358,12 @@ gst_gl_filter_do_transform (GstGLFilter* filter,
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_gl_filter_render_to_target (GstGLFilter * filter,
|
gst_gl_filter_render_to_target (GstGLFilter * filter,
|
||||||
GLuint input, GLuint target,
|
GLuint input, GLuint target, GLCB func, gpointer data)
|
||||||
GLCB func, gpointer data)
|
|
||||||
{
|
{
|
||||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||||
filter->fbo, filter->depthbuffer, target,
|
filter->fbo, filter->depthbuffer, target,
|
||||||
func,
|
func,
|
||||||
filter->width, filter->height, input,
|
filter->width, filter->height, input,
|
||||||
0, filter->width, 0, filter->height,
|
0, filter->width, 0, filter->height,
|
||||||
GST_GL_DISPLAY_PROJECTION_ORTHO2D,
|
GST_GL_DISPLAY_PROJECTION_ORTHO2D, data);
|
||||||
data);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,10 @@
|
||||||
#define WM_GST_GL_WINDOW_QUIT (WM_APP+2)
|
#define WM_GST_GL_WINDOW_QUIT (WM_APP+2)
|
||||||
|
|
||||||
void gst_gl_window_set_pixel_format (GstGLWindow * window);
|
void gst_gl_window_set_pixel_format (GstGLWindow * window);
|
||||||
LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||||
LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LPARAM lParam);
|
||||||
|
LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||||
|
LPARAM lParam);
|
||||||
|
|
||||||
#define GST_GL_WINDOW_GET_PRIVATE(o) \
|
#define GST_GL_WINDOW_GET_PRIVATE(o) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_WINDOW, GstGLWindowPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_WINDOW, GstGLWindowPrivate))
|
||||||
|
@ -106,8 +108,7 @@ gst_gl_window_class_init (GstGLWindowClass * klass)
|
||||||
|
|
||||||
atom = GetClassInfo (hinstance, "GSTGL", &wc);
|
atom = GetClassInfo (hinstance, "GSTGL", &wc);
|
||||||
|
|
||||||
if (atom == 0)
|
if (atom == 0) {
|
||||||
{
|
|
||||||
ZeroMemory (&wc, sizeof (WNDCLASS));
|
ZeroMemory (&wc, sizeof (WNDCLASS));
|
||||||
|
|
||||||
wc.lpfnWndProc = window_proc;
|
wc.lpfnWndProc = window_proc;
|
||||||
|
@ -169,22 +170,16 @@ gst_gl_window_new (gint width, gint height)
|
||||||
priv->visible = FALSE;
|
priv->visible = FALSE;
|
||||||
|
|
||||||
width += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
width += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
||||||
height += 2 * GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION);
|
height +=
|
||||||
|
2 * GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION);
|
||||||
|
|
||||||
priv->internal_win_id = CreateWindowEx (
|
priv->internal_win_id = CreateWindowEx (0,
|
||||||
0,
|
|
||||||
"GSTGL",
|
"GSTGL",
|
||||||
"OpenGL renderer",
|
"OpenGL renderer",
|
||||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW,
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW,
|
||||||
x, y, width, height,
|
x, y, width, height, (HWND) NULL, (HMENU) NULL, hinstance, window);
|
||||||
(HWND) NULL,
|
|
||||||
(HMENU) NULL,
|
|
||||||
hinstance,
|
|
||||||
window
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!priv->internal_win_id)
|
if (!priv->internal_win_id) {
|
||||||
{
|
|
||||||
g_debug ("failed to create gl window: %d\n", priv->internal_win_id);
|
g_debug ("failed to create gl window: %d\n", priv->internal_win_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +204,8 @@ void
|
||||||
gst_gl_window_set_external_window_id (GstGLWindow * window, guint64 id)
|
gst_gl_window_set_external_window_id (GstGLWindow * window, guint64 id)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
WNDPROC window_parent_proc = (WNDPROC) (guint64) GetWindowLongPtr((HWND)id, GWL_WNDPROC);
|
WNDPROC window_parent_proc =
|
||||||
|
(WNDPROC) (guint64) GetWindowLongPtr ((HWND) id, GWL_WNDPROC);
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
SetProp (priv->internal_win_id, "gl_window_parent_id", (HWND) id);
|
SetProp (priv->internal_win_id, "gl_window_parent_id", (HWND) id);
|
||||||
|
@ -222,9 +218,12 @@ gst_gl_window_set_external_window_id (GstGLWindow *window, guint64 id)
|
||||||
|
|
||||||
//take changes into account: SWP_FRAMECHANGED
|
//take changes into account: SWP_FRAMECHANGED
|
||||||
GetClientRect ((HWND) id, &rect);
|
GetClientRect ((HWND) id, &rect);
|
||||||
SetWindowPos (priv->internal_win_id, HWND_TOP, rect.left, rect.top, rect.right, rect.bottom,
|
SetWindowPos (priv->internal_win_id, HWND_TOP, rect.left, rect.top,
|
||||||
SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
rect.right, rect.bottom,
|
||||||
MoveWindow (priv->internal_win_id, rect.left, rect.top, rect.right, rect.bottom, FALSE);
|
SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
||||||
|
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
||||||
|
MoveWindow (priv->internal_win_id, rect.left, rect.top, rect.right,
|
||||||
|
rect.bottom, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -235,7 +234,8 @@ gst_gl_window_set_external_gl_context (GstGLWindow *window, guint64 context)
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
void
|
void
|
||||||
gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_set_draw_callback (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
@ -245,7 +245,8 @@ gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gp
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
void
|
void
|
||||||
gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback , gpointer data)
|
gst_gl_window_set_resize_callback (GstGLWindow * window,
|
||||||
|
GstGLWindowCB2 callback, gpointer data)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
@ -255,7 +256,8 @@ gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
void
|
void
|
||||||
gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
@ -275,8 +277,7 @@ gst_gl_window_draw (GstGLWindow *window)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
if (!priv->visible)
|
if (!priv->visible) {
|
||||||
{
|
|
||||||
ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
||||||
priv->visible = TRUE;
|
priv->visible = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -295,15 +296,11 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
g_debug ("begin loop\n");
|
g_debug ("begin loop\n");
|
||||||
|
|
||||||
while (running && (bRet = GetMessage (&msg, NULL, 0, 0)) != 0)
|
while (running && (bRet = GetMessage (&msg, NULL, 0, 0)) != 0) {
|
||||||
{
|
if (bRet == -1) {
|
||||||
if (bRet == -1)
|
|
||||||
{
|
|
||||||
g_error ("Failed to get message %x\r\n", GetLastError ());
|
g_error ("Failed to get message %x\r\n", GetLastError ());
|
||||||
running = FALSE;
|
running = FALSE;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
TranslateMessage (&msg);
|
TranslateMessage (&msg);
|
||||||
DispatchMessage (&msg);
|
DispatchMessage (&msg);
|
||||||
}
|
}
|
||||||
|
@ -314,12 +311,13 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
/* Thread safe */
|
/* Thread safe */
|
||||||
void
|
void
|
||||||
gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_quit_loop (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
{
|
gpointer data)
|
||||||
if (window)
|
|
||||||
{
|
{
|
||||||
|
if (window) {
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = PostMessage(priv->internal_win_id, WM_GST_GL_WINDOW_QUIT, (WPARAM) data, (LPARAM) callback);
|
LRESULT res = PostMessage (priv->internal_win_id, WM_GST_GL_WINDOW_QUIT,
|
||||||
|
(WPARAM) data, (LPARAM) callback);
|
||||||
g_assert (SUCCEEDED (res));
|
g_assert (SUCCEEDED (res));
|
||||||
g_debug ("end loop requested\n");
|
g_debug ("end loop requested\n");
|
||||||
}
|
}
|
||||||
|
@ -327,12 +325,13 @@ gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer d
|
||||||
|
|
||||||
/* Thread safe */
|
/* Thread safe */
|
||||||
void
|
void
|
||||||
gst_gl_window_send_message (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
{
|
gpointer data)
|
||||||
if (window)
|
|
||||||
{
|
{
|
||||||
|
if (window) {
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM, (WPARAM) data, (LPARAM) callback);
|
LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM,
|
||||||
|
(WPARAM) data, (LPARAM) callback);
|
||||||
g_assert (SUCCEEDED (res));
|
g_assert (SUCCEEDED (res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,11 +384,13 @@ gst_gl_window_set_pixel_format (GstGLWindow *window)
|
||||||
g_assert (res);
|
g_assert (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK
|
||||||
|
window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (uMsg == WM_CREATE) {
|
if (uMsg == WM_CREATE) {
|
||||||
|
|
||||||
GstGLWindow *window = (GstGLWindow *) (((LPCREATESTRUCT) lParam)->lpCreateParams);
|
GstGLWindow *window =
|
||||||
|
(GstGLWindow *) (((LPCREATESTRUCT) lParam)->lpCreateParams);
|
||||||
|
|
||||||
g_debug ("WM_CREATE\n");
|
g_debug ("WM_CREATE\n");
|
||||||
|
|
||||||
|
@ -403,18 +404,19 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
if (priv->gl_context)
|
if (priv->gl_context)
|
||||||
g_debug ("gl context created: %d\n", priv->gl_context);
|
g_debug ("gl context created: %d\n", priv->gl_context);
|
||||||
else
|
else
|
||||||
g_debug ("failed to create glcontext %d, %x\r\n", hWnd, GetLastError());
|
g_debug ("failed to create glcontext %d, %x\r\n", hWnd,
|
||||||
|
GetLastError ());
|
||||||
g_assert (priv->gl_context);
|
g_assert (priv->gl_context);
|
||||||
ReleaseDC (hWnd, priv->device);
|
ReleaseDC (hWnd, priv->device);
|
||||||
if (!wglMakeCurrent (priv->device, priv->gl_context))
|
if (!wglMakeCurrent (priv->device, priv->gl_context))
|
||||||
g_debug ("failed to make opengl context current %d, %x\r\n", hWnd, GetLastError());
|
g_debug ("failed to make opengl context current %d, %x\r\n", hWnd,
|
||||||
|
GetLastError ());
|
||||||
}
|
}
|
||||||
|
|
||||||
SetProp (hWnd, "gl_window", window);
|
SetProp (hWnd, "gl_window", window);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (GetProp (hWnd, "gl_window")) {
|
||||||
else if (GetProp(hWnd, "gl_window")) {
|
|
||||||
|
|
||||||
GstGLWindow *window = GetProp (hWnd, "gl_window");
|
GstGLWindow *window = GetProp (hWnd, "gl_window");
|
||||||
GstGLWindowPrivate *priv = NULL;
|
GstGLWindowPrivate *priv = NULL;
|
||||||
|
@ -440,8 +442,7 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
if (priv->draw_cb)
|
if (priv->draw_cb) {
|
||||||
{
|
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
BeginPaint (hWnd, &ps);
|
BeginPaint (hWnd, &ps);
|
||||||
priv->draw_cb (priv->draw_data);
|
priv->draw_cb (priv->draw_data);
|
||||||
|
@ -477,13 +478,13 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
destroy_cb ((gpointer) wParam);
|
destroy_cb ((gpointer) wParam);
|
||||||
|
|
||||||
parent_id = GetProp (hWnd, "gl_window_parent_id");
|
parent_id = GetProp (hWnd, "gl_window_parent_id");
|
||||||
if (parent_id)
|
if (parent_id) {
|
||||||
{
|
|
||||||
WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc");
|
WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc");
|
||||||
|
|
||||||
g_assert (parent_proc);
|
g_assert (parent_proc);
|
||||||
|
|
||||||
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) (guint64) parent_proc);
|
SetWindowLongPtr (parent_id, GWL_WNDPROC,
|
||||||
|
(LONG) (guint64) parent_proc);
|
||||||
SetParent (hWnd, NULL);
|
SetParent (hWnd, NULL);
|
||||||
|
|
||||||
RemoveProp (parent_id, "gl_window_parent_proc");
|
RemoveProp (parent_id, "gl_window_parent_proc");
|
||||||
|
@ -496,17 +497,17 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
if (!wglMakeCurrent (NULL, NULL))
|
if (!wglMakeCurrent (NULL, NULL))
|
||||||
g_debug ("failed to make current %d, %x\r\n", hWnd, GetLastError ());
|
g_debug ("failed to make current %d, %x\r\n", hWnd, GetLastError ());
|
||||||
|
|
||||||
if (priv->gl_context)
|
if (priv->gl_context) {
|
||||||
{
|
|
||||||
if (!wglDeleteContext (priv->gl_context))
|
if (!wglDeleteContext (priv->gl_context))
|
||||||
g_debug ("failed to destroy context %d, %x\r\n", priv->gl_context, GetLastError());
|
g_debug ("failed to destroy context %d, %x\r\n", priv->gl_context,
|
||||||
|
GetLastError ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->internal_win_id)
|
if (priv->internal_win_id) {
|
||||||
{
|
|
||||||
g_debug ("BEFORE\n");
|
g_debug ("BEFORE\n");
|
||||||
if (!DestroyWindow (priv->internal_win_id))
|
if (!DestroyWindow (priv->internal_win_id))
|
||||||
g_debug ("failed to destroy window %d, %x\r\n", hWnd, GetLastError());
|
g_debug ("failed to destroy window %d, %x\r\n", hWnd,
|
||||||
|
GetLastError ());
|
||||||
g_debug ("AFTER\n");
|
g_debug ("AFTER\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,8 +525,7 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
case WM_GST_GL_WINDOW_CUSTOM:
|
case WM_GST_GL_WINDOW_CUSTOM:
|
||||||
{
|
{
|
||||||
if (!priv->is_closed)
|
if (!priv->is_closed) {
|
||||||
{
|
|
||||||
GstGLWindowCB custom_cb = (GstGLWindowCB) lParam;
|
GstGLWindowCB custom_cb = (GstGLWindowCB) lParam;
|
||||||
custom_cb ((gpointer) wParam);
|
custom_cb ((gpointer) wParam);
|
||||||
}
|
}
|
||||||
|
@ -540,21 +540,19 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT FAR PASCAL
|
||||||
|
sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
WNDPROC window_parent_proc = GetProp (hWnd, "gl_window_parent_proc");
|
WNDPROC window_parent_proc = GetProp (hWnd, "gl_window_parent_proc");
|
||||||
|
|
||||||
if (uMsg == WM_SIZE)
|
if (uMsg == WM_SIZE) {
|
||||||
{
|
|
||||||
HWND gl_window_id = GetProp (hWnd, "gl_window_id");
|
HWND gl_window_id = GetProp (hWnd, "gl_window_id");
|
||||||
MoveWindow (gl_window_id, 0, 0, LOWORD (lParam), HIWORD (lParam), FALSE);
|
MoveWindow (gl_window_id, 0, 0, LOWORD (lParam), HIWORD (lParam), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallWindowProc (window_parent_proc, hWnd, uMsg, wParam, lParam);
|
return CallWindowProc (window_parent_proc, hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,16 +142,14 @@ gst_gl_window_finalize (GObject * object)
|
||||||
|
|
||||||
g_debug ("display sender closed\n");
|
g_debug ("display sender closed\n");
|
||||||
|
|
||||||
if (priv->cond_send_message)
|
if (priv->cond_send_message) {
|
||||||
{
|
|
||||||
g_cond_free (priv->cond_send_message);
|
g_cond_free (priv->cond_send_message);
|
||||||
priv->cond_send_message = NULL;
|
priv->cond_send_message = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mutex_unlock (priv->x_lock);
|
g_mutex_unlock (priv->x_lock);
|
||||||
|
|
||||||
if (priv->x_lock)
|
if (priv->x_lock) {
|
||||||
{
|
|
||||||
g_mutex_free (priv->x_lock);
|
g_mutex_free (priv->x_lock);
|
||||||
priv->x_lock = NULL;
|
priv->x_lock = NULL;
|
||||||
}
|
}
|
||||||
|
@ -314,8 +312,7 @@ gst_gl_window_new (gint width, gint height)
|
||||||
|
|
||||||
priv->visual_info = glXChooseVisual (priv->device, priv->screen_num, attrib);
|
priv->visual_info = glXChooseVisual (priv->device, priv->screen_num, attrib);
|
||||||
|
|
||||||
if (!priv->visual_info)
|
if (!priv->visual_info) {
|
||||||
{
|
|
||||||
g_warning ("glx visual is null (bad attributes)\n");
|
g_warning ("glx visual is null (bad attributes)\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +323,8 @@ gst_gl_window_new (gint width, gint height)
|
||||||
if (priv->visual_info->class == TrueColor)
|
if (priv->visual_info->class == TrueColor)
|
||||||
g_debug ("visual is using TrueColor\n");
|
g_debug ("visual is using TrueColor\n");
|
||||||
|
|
||||||
g_debug ("visual ID: %d\n", (gint)XVisualIDFromVisual(priv->visual_info->visual));
|
g_debug ("visual ID: %d\n",
|
||||||
|
(gint) XVisualIDFromVisual (priv->visual_info->visual));
|
||||||
g_debug ("visual info screen: %d\n", priv->visual_info->screen);
|
g_debug ("visual info screen: %d\n", priv->visual_info->screen);
|
||||||
g_debug ("visual info visualid: %d\n", (gint) priv->visual_info->visualid);
|
g_debug ("visual info visualid: %d\n", (gint) priv->visual_info->visualid);
|
||||||
g_debug ("visual info depth: %d\n", priv->visual_info->depth);
|
g_debug ("visual info depth: %d\n", priv->visual_info->depth);
|
||||||
|
@ -336,14 +334,17 @@ gst_gl_window_new (gint width, gint height)
|
||||||
g_debug ("visual info blue_mask: %ld\n", priv->visual_info->blue_mask);
|
g_debug ("visual info blue_mask: %ld\n", priv->visual_info->blue_mask);
|
||||||
g_debug ("visual info bits_per_rgb: %d\n", priv->visual_info->bits_per_rgb);
|
g_debug ("visual info bits_per_rgb: %d\n", priv->visual_info->bits_per_rgb);
|
||||||
|
|
||||||
win_attr.event_mask = StructureNotifyMask | ExposureMask | VisibilityChangeMask;
|
win_attr.event_mask =
|
||||||
|
StructureNotifyMask | ExposureMask | VisibilityChangeMask;
|
||||||
win_attr.do_not_propagate_mask = NoEventMask;
|
win_attr.do_not_propagate_mask = NoEventMask;
|
||||||
|
|
||||||
win_attr.background_pixmap = None;
|
win_attr.background_pixmap = None;
|
||||||
win_attr.background_pixel = 0;
|
win_attr.background_pixel = 0;
|
||||||
win_attr.border_pixel = 0;
|
win_attr.border_pixel = 0;
|
||||||
|
|
||||||
win_attr.colormap = XCreateColormap(priv->device, priv->root, priv->visual_info->visual, AllocNone);
|
win_attr.colormap =
|
||||||
|
XCreateColormap (priv->device, priv->root, priv->visual_info->visual,
|
||||||
|
AllocNone);
|
||||||
|
|
||||||
mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
|
mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
|
||||||
|
|
||||||
|
@ -358,7 +359,8 @@ gst_gl_window_new (gint width, gint height)
|
||||||
|
|
||||||
XSetWindowBackgroundPixmap (priv->device, priv->internal_win_id, None);
|
XSetWindowBackgroundPixmap (priv->device, priv->internal_win_id, None);
|
||||||
|
|
||||||
g_debug ("gl window id: %" G_GUINT64_FORMAT "\n", (guint64) priv->internal_win_id);
|
g_debug ("gl window id: %" G_GUINT64_FORMAT "\n",
|
||||||
|
(guint64) priv->internal_win_id);
|
||||||
|
|
||||||
g_debug ("gl window props: x:%d y:%d w:%d h:%d\n", x, y, width, height);
|
g_debug ("gl window props: x:%d y:%d w:%d h:%d\n", x, y, width, height);
|
||||||
|
|
||||||
|
@ -376,7 +378,8 @@ gst_gl_window_new (gint width, gint height)
|
||||||
|
|
||||||
XSetWMProtocols (priv->device, priv->internal_win_id, wm_atoms, 2);
|
XSetWMProtocols (priv->device, priv->internal_win_id, wm_atoms, 2);
|
||||||
|
|
||||||
priv->gl_context = glXCreateContext (priv->device, priv->visual_info, NULL, TRUE);
|
priv->gl_context =
|
||||||
|
glXCreateContext (priv->device, priv->visual_info, NULL, TRUE);
|
||||||
|
|
||||||
g_debug ("gl context id: %ld\n", (gulong) priv->gl_context);
|
g_debug ("gl context id: %ld\n", (gulong) priv->gl_context);
|
||||||
|
|
||||||
|
@ -389,8 +392,8 @@ gst_gl_window_new (gint width, gint height)
|
||||||
|
|
||||||
XStringListToTextProperty ((char **) &title, 1, &text_property);
|
XStringListToTextProperty ((char **) &title, 1, &text_property);
|
||||||
|
|
||||||
XSetWMProperties (priv->device, priv->internal_win_id, &text_property, &text_property, 0, 0,
|
XSetWMProperties (priv->device, priv->internal_win_id, &text_property,
|
||||||
NULL, &wm_hints, NULL);
|
&text_property, 0, 0, NULL, &wm_hints, NULL);
|
||||||
|
|
||||||
XFree (text_property.value);
|
XFree (text_property.value);
|
||||||
|
|
||||||
|
@ -419,8 +422,7 @@ gst_gl_window_error_quark (void)
|
||||||
void
|
void
|
||||||
gst_gl_window_set_external_window_id (GstGLWindow * window, guint64 id)
|
gst_gl_window_set_external_window_id (GstGLWindow * window, guint64 id)
|
||||||
{
|
{
|
||||||
if (window)
|
if (window) {
|
||||||
{
|
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
|
||||||
|
@ -432,9 +434,11 @@ gst_gl_window_set_external_window_id (GstGLWindow *window, guint64 id)
|
||||||
|
|
||||||
XGetWindowAttributes (priv->disp_send, priv->parent, &attr);
|
XGetWindowAttributes (priv->disp_send, priv->parent, &attr);
|
||||||
|
|
||||||
XResizeWindow (priv->disp_send, priv->internal_win_id, attr.width, attr.height);
|
XResizeWindow (priv->disp_send, priv->internal_win_id, attr.width,
|
||||||
|
attr.height);
|
||||||
|
|
||||||
XReparentWindow (priv->disp_send, priv->internal_win_id, priv->parent, attr.x, attr.y);
|
XReparentWindow (priv->disp_send, priv->internal_win_id, priv->parent,
|
||||||
|
attr.x, attr.y);
|
||||||
|
|
||||||
XSync (priv->disp_send, FALSE);
|
XSync (priv->disp_send, FALSE);
|
||||||
|
|
||||||
|
@ -449,7 +453,8 @@ gst_gl_window_set_external_gl_context (GstGLWindow *window, guint64 context)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_set_draw_callback (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
@ -462,7 +467,8 @@ gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gp
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback , gpointer data)
|
gst_gl_window_set_resize_callback (GstGLWindow * window,
|
||||||
|
GstGLWindowCB2 callback, gpointer data)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
@ -475,7 +481,8 @@ gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
@ -493,8 +500,7 @@ gst_gl_window_draw_unlocked (GstGLWindow *window)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
if (priv->running && priv->allow_extra_expose_events)
|
if (priv->running && priv->allow_extra_expose_events) {
|
||||||
{
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
|
||||||
|
@ -510,7 +516,8 @@ gst_gl_window_draw_unlocked (GstGLWindow *window)
|
||||||
event.xexpose.height = attr.height;
|
event.xexpose.height = attr.height;
|
||||||
event.xexpose.count = 0;
|
event.xexpose.count = 0;
|
||||||
|
|
||||||
XSendEvent (priv->device, priv->internal_win_id, FALSE, ExposureMask, &event);
|
XSendEvent (priv->device, priv->internal_win_id, FALSE, ExposureMask,
|
||||||
|
&event);
|
||||||
XSync (priv->disp_send, FALSE);
|
XSync (priv->disp_send, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,35 +526,32 @@ gst_gl_window_draw_unlocked (GstGLWindow *window)
|
||||||
void
|
void
|
||||||
gst_gl_window_draw (GstGLWindow * window)
|
gst_gl_window_draw (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
if (window)
|
if (window) {
|
||||||
{
|
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
g_mutex_lock (priv->x_lock);
|
g_mutex_lock (priv->x_lock);
|
||||||
|
|
||||||
if (priv->running)
|
if (priv->running) {
|
||||||
{
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
|
||||||
if (!priv->visible)
|
if (!priv->visible) {
|
||||||
{
|
|
||||||
XMapWindow (priv->disp_send, priv->internal_win_id);
|
XMapWindow (priv->disp_send, priv->internal_win_id);
|
||||||
priv->visible = TRUE;
|
priv->visible = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
||||||
|
|
||||||
if (priv->parent)
|
if (priv->parent) {
|
||||||
{
|
|
||||||
XWindowAttributes attr_parent;
|
XWindowAttributes attr_parent;
|
||||||
XGetWindowAttributes (priv->disp_send, priv->parent, &attr_parent);
|
XGetWindowAttributes (priv->disp_send, priv->parent, &attr_parent);
|
||||||
|
|
||||||
if (attr.x != attr_parent.x || attr.y != attr_parent.y ||
|
if (attr.x != attr_parent.x || attr.y != attr_parent.y ||
|
||||||
attr.width != attr_parent.width || attr.height != attr_parent.height)
|
attr.width != attr_parent.width
|
||||||
{
|
|| attr.height != attr_parent.height) {
|
||||||
XMoveResizeWindow (priv->disp_send, priv->internal_win_id, attr_parent.x, attr_parent.y,
|
XMoveResizeWindow (priv->disp_send, priv->internal_win_id,
|
||||||
attr_parent.width, attr_parent.height);
|
attr_parent.x, attr_parent.y, attr_parent.width,
|
||||||
|
attr_parent.height);
|
||||||
XSync (priv->disp_send, FALSE);
|
XSync (priv->disp_send, FALSE);
|
||||||
|
|
||||||
attr.x = attr_parent.x;
|
attr.x = attr_parent.x;
|
||||||
|
@ -556,8 +560,8 @@ gst_gl_window_draw (GstGLWindow *window)
|
||||||
attr.width = attr_parent.width;
|
attr.width = attr_parent.width;
|
||||||
attr.height = attr_parent.height;
|
attr.height = attr_parent.height;
|
||||||
|
|
||||||
g_debug ("parent resize: %d, %d, %d, %d\n", attr_parent.x, attr_parent.y,
|
g_debug ("parent resize: %d, %d, %d, %d\n", attr_parent.x,
|
||||||
attr_parent.width, attr_parent.height);
|
attr_parent.y, attr_parent.width, attr_parent.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +575,8 @@ gst_gl_window_draw (GstGLWindow *window)
|
||||||
event.xexpose.height = attr.height;
|
event.xexpose.height = attr.height;
|
||||||
event.xexpose.count = 0;
|
event.xexpose.count = 0;
|
||||||
|
|
||||||
XSendEvent (priv->disp_send, priv->internal_win_id, FALSE, ExposureMask, &event);
|
XSendEvent (priv->disp_send, priv->internal_win_id, FALSE, ExposureMask,
|
||||||
|
&event);
|
||||||
XSync (priv->disp_send, FALSE);
|
XSync (priv->disp_send, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,8 +594,7 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
g_mutex_lock (priv->x_lock);
|
g_mutex_lock (priv->x_lock);
|
||||||
|
|
||||||
while (priv->running)
|
while (priv->running) {
|
||||||
{
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
XEvent pending_event;
|
XEvent pending_event;
|
||||||
|
|
||||||
|
@ -604,8 +608,7 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
// use in generic/cube and other related uses
|
// use in generic/cube and other related uses
|
||||||
priv->allow_extra_expose_events = XPending (priv->device) <= 2;
|
priv->allow_extra_expose_events = XPending (priv->device) <= 2;
|
||||||
|
|
||||||
switch (event.type)
|
switch (event.type) {
|
||||||
{
|
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -647,9 +650,10 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* User clicked on the cross */
|
/* User clicked on the cross */
|
||||||
else if (wm_delete != None && (Atom) event.xclient.data.l[0] == wm_delete)
|
else if (wm_delete != None
|
||||||
{
|
&& (Atom) event.xclient.data.l[0] == wm_delete) {
|
||||||
g_debug ("Close %" G_GUINT64_FORMAT "\n", (guint64) priv->internal_win_id);
|
g_debug ("Close %" G_GUINT64_FORMAT "\n",
|
||||||
|
(guint64) priv->internal_win_id);
|
||||||
|
|
||||||
if (priv->close_cb)
|
if (priv->close_cb)
|
||||||
priv->close_cb (priv->close_data);
|
priv->close_cb (priv->close_data);
|
||||||
|
@ -679,7 +683,8 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
gpointer destroy_data = (gpointer) event.xclient.data.l[1];
|
gpointer destroy_data = (gpointer) event.xclient.data.l[1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_debug ("Quit loop message %" G_GUINT64_FORMAT "\n", (guint64) priv->internal_win_id);
|
g_debug ("Quit loop message %" G_GUINT64_FORMAT "\n",
|
||||||
|
(guint64) priv->internal_win_id);
|
||||||
|
|
||||||
/* exit loop */
|
/* exit loop */
|
||||||
priv->running = FALSE;
|
priv->running = FALSE;
|
||||||
|
@ -716,8 +721,7 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
destroy_cb (destroy_data);
|
destroy_cb (destroy_data);
|
||||||
|
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
g_debug ("client message not reconized \n");
|
g_debug ("client message not reconized \n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +730,8 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
{
|
{
|
||||||
if (priv->resize_cb)
|
if (priv->resize_cb)
|
||||||
priv->resize_cb (priv->resize_data, event.xconfigure.width, event.xconfigure.height);
|
priv->resize_cb (priv->resize_data, event.xconfigure.width,
|
||||||
|
event.xconfigure.height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,8 +740,7 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Expose:
|
case Expose:
|
||||||
if (priv->draw_cb)
|
if (priv->draw_cb) {
|
||||||
{
|
|
||||||
priv->draw_cb (priv->draw_data);
|
priv->draw_cb (priv->draw_data);
|
||||||
glFlush ();
|
glFlush ();
|
||||||
glXSwapBuffers (priv->device, priv->internal_win_id);
|
glXSwapBuffers (priv->device, priv->internal_win_id);
|
||||||
|
@ -745,8 +749,7 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
case VisibilityNotify:
|
case VisibilityNotify:
|
||||||
{
|
{
|
||||||
switch (event.xvisibility.state)
|
switch (event.xvisibility.state) {
|
||||||
{
|
|
||||||
case VisibilityUnobscured:
|
case VisibilityUnobscured:
|
||||||
if (priv->draw_cb)
|
if (priv->draw_cb)
|
||||||
priv->draw_cb (priv->draw_data);
|
priv->draw_cb (priv->draw_data);
|
||||||
|
@ -761,7 +764,8 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_debug("unknown xvisibility event: %d\n", event.xvisibility.state);
|
g_debug ("unknown xvisibility event: %d\n",
|
||||||
|
event.xvisibility.state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -782,23 +786,23 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
/* Not called by the gl thread */
|
/* Not called by the gl thread */
|
||||||
void
|
void
|
||||||
gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_quit_loop (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
{
|
gpointer data)
|
||||||
if (window)
|
|
||||||
{
|
{
|
||||||
|
if (window) {
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
g_mutex_lock (priv->x_lock);
|
g_mutex_lock (priv->x_lock);
|
||||||
|
|
||||||
if (priv->running)
|
if (priv->running) {
|
||||||
{
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
event.xclient.type = ClientMessage;
|
event.xclient.type = ClientMessage;
|
||||||
event.xclient.send_event = TRUE;
|
event.xclient.send_event = TRUE;
|
||||||
event.xclient.display = priv->disp_send;
|
event.xclient.display = priv->disp_send;
|
||||||
event.xclient.window = priv->internal_win_id;
|
event.xclient.window = priv->internal_win_id;
|
||||||
event.xclient.message_type = XInternAtom (priv->disp_send, "WM_QUIT_LOOP", True);;
|
event.xclient.message_type =
|
||||||
|
XInternAtom (priv->disp_send, "WM_QUIT_LOOP", True);;
|
||||||
event.xclient.format = 32;
|
event.xclient.format = 32;
|
||||||
#if SIZEOF_VOID_P == 8
|
#if SIZEOF_VOID_P == 8
|
||||||
event.xclient.data.l[0] = (((long) callback) >> 32) & 0xffffffff;
|
event.xclient.data.l[0] = (((long) callback) >> 32) & 0xffffffff;
|
||||||
|
@ -810,7 +814,8 @@ gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer d
|
||||||
event.xclient.data.l[1] = (long) data;
|
event.xclient.data.l[1] = (long) data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XSendEvent (priv->disp_send, priv->internal_win_id, FALSE, NoEventMask, &event);
|
XSendEvent (priv->disp_send, priv->internal_win_id, FALSE, NoEventMask,
|
||||||
|
&event);
|
||||||
XSync (priv->disp_send, FALSE);
|
XSync (priv->disp_send, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,23 +825,23 @@ gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer d
|
||||||
|
|
||||||
/* Not called by the gl thread */
|
/* Not called by the gl thread */
|
||||||
void
|
void
|
||||||
gst_gl_window_send_message (GstGLWindow *window, GstGLWindowCB callback, gpointer data)
|
gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
{
|
gpointer data)
|
||||||
if (window)
|
|
||||||
{
|
{
|
||||||
|
if (window) {
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
g_mutex_lock (priv->x_lock);
|
g_mutex_lock (priv->x_lock);
|
||||||
|
|
||||||
if (priv->running)
|
if (priv->running) {
|
||||||
{
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
event.xclient.type = ClientMessage;
|
event.xclient.type = ClientMessage;
|
||||||
event.xclient.send_event = TRUE;
|
event.xclient.send_event = TRUE;
|
||||||
event.xclient.display = priv->disp_send;
|
event.xclient.display = priv->disp_send;
|
||||||
event.xclient.window = priv->internal_win_id;
|
event.xclient.window = priv->internal_win_id;
|
||||||
event.xclient.message_type = XInternAtom (priv->disp_send, "WM_GL_WINDOW", True);
|
event.xclient.message_type =
|
||||||
|
XInternAtom (priv->disp_send, "WM_GL_WINDOW", True);
|
||||||
event.xclient.format = 32;
|
event.xclient.format = 32;
|
||||||
#if SIZEOF_VOID_P == 8
|
#if SIZEOF_VOID_P == 8
|
||||||
event.xclient.data.l[0] = (((long) callback) >> 32) & 0xffffffff;
|
event.xclient.data.l[0] = (((long) callback) >> 32) & 0xffffffff;
|
||||||
|
@ -848,7 +853,8 @@ gst_gl_window_send_message (GstGLWindow *window, GstGLWindowCB callback, gpointe
|
||||||
event.xclient.data.l[1] = (long) data;
|
event.xclient.data.l[1] = (long) data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XSendEvent (priv->disp_send, priv->internal_win_id, FALSE, NoEventMask, &event);
|
XSendEvent (priv->disp_send, priv->internal_win_id, FALSE, NoEventMask,
|
||||||
|
&event);
|
||||||
XSync (priv->disp_send, FALSE);
|
XSync (priv->disp_send, FALSE);
|
||||||
|
|
||||||
/* block until opengl calls have been executed in the gl thread */
|
/* block until opengl calls have been executed in the gl thread */
|
||||||
|
|
Loading…
Reference in a new issue