mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 13:08:49 +00:00
[280/906] Remove set_visible, because it's now automatically done when the first post redisplay comes.
This commit is contained in:
parent
34e4a534e2
commit
c8c7f8733b
6 changed files with 37 additions and 62 deletions
|
@ -1618,20 +1618,6 @@ gst_gl_display_create_context (GstGLDisplay *display,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Called by the glimagesink element */
|
|
||||||
void
|
|
||||||
gst_gl_display_set_visible_context (GstGLDisplay* display, gboolean visible)
|
|
||||||
{
|
|
||||||
gst_gl_display_lock (display);
|
|
||||||
if (display->visible != visible)
|
|
||||||
{
|
|
||||||
display->visible = visible;
|
|
||||||
gst_gl_window_visible (display->gl_window, visible);
|
|
||||||
}
|
|
||||||
gst_gl_display_unlock (display);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Called by the glimagesink element */
|
/* Called by the glimagesink element */
|
||||||
gboolean
|
gboolean
|
||||||
gst_gl_display_redisplay (GstGLDisplay* display, GLuint texture, gint width, gint height)
|
gst_gl_display_redisplay (GstGLDisplay* display, GLuint texture, gint width, gint height)
|
||||||
|
|
|
@ -210,7 +210,6 @@ GstGLDisplay* gst_gl_display_new (void);
|
||||||
|
|
||||||
void gst_gl_display_create_context (GstGLDisplay* display,
|
void gst_gl_display_create_context (GstGLDisplay* display,
|
||||||
GLint width, GLint height);
|
GLint width, GLint height);
|
||||||
void gst_gl_display_set_visible_context (GstGLDisplay* display, gboolean visible);
|
|
||||||
gboolean gst_gl_display_redisplay (GstGLDisplay* display, GLuint texture, gint width, gint height);
|
gboolean gst_gl_display_redisplay (GstGLDisplay* display, GLuint texture, gint width, gint height);
|
||||||
|
|
||||||
void gst_gl_display_thread_add (GstGLDisplay *display,
|
void gst_gl_display_thread_add (GstGLDisplay *display,
|
||||||
|
|
|
@ -71,7 +71,6 @@ void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callbac
|
||||||
void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback, gpointer data);
|
void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback, gpointer data);
|
||||||
void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
|
void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
|
||||||
|
|
||||||
void gst_gl_window_visible (GstGLWindow *window, gboolean visible);
|
|
||||||
void gst_gl_window_draw (GstGLWindow *window);
|
void gst_gl_window_draw (GstGLWindow *window);
|
||||||
void gst_gl_window_run_loop (GstGLWindow *window);
|
void gst_gl_window_run_loop (GstGLWindow *window);
|
||||||
void gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
|
void gst_gl_window_quit_loop (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
#include "gstglwindow.h"
|
#include "gstglwindow.h"
|
||||||
|
|
||||||
|
|
||||||
#define WM_GSTGLWINDOW (WM_APP+1)
|
#define WM_GST_GL_WINDOW_CUSTOM (WM_APP+1)
|
||||||
|
#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, LPARAM lParam);
|
||||||
|
@ -55,6 +56,7 @@ struct _GstGLWindowPrivate
|
||||||
GstGLWindowCB close_cb;
|
GstGLWindowCB close_cb;
|
||||||
gpointer close_data;
|
gpointer close_data;
|
||||||
gboolean is_closed;
|
gboolean is_closed;
|
||||||
|
gboolean visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstGLWindow, gst_gl_window, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (GstGLWindow, gst_gl_window, G_TYPE_OBJECT);
|
||||||
|
@ -163,6 +165,7 @@ gst_gl_window_new (gint width, gint height)
|
||||||
priv->close_cb = NULL;
|
priv->close_cb = NULL;
|
||||||
priv->close_data = NULL;
|
priv->close_data = NULL;
|
||||||
priv->is_closed = FALSE;
|
priv->is_closed = 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);
|
||||||
|
@ -259,26 +262,18 @@ gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, g
|
||||||
priv->close_data = data;
|
priv->close_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Thread safe */
|
|
||||||
void
|
|
||||||
gst_gl_window_visible (GstGLWindow *window, gboolean visible)
|
|
||||||
{
|
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
|
||||||
BOOL ret = FALSE;
|
|
||||||
|
|
||||||
g_debug ("set visible %d\n", priv->internal_win_id);
|
|
||||||
|
|
||||||
if (visible)
|
|
||||||
ret = ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
|
||||||
else
|
|
||||||
ret = ShowWindowAsync (priv->internal_win_id, SW_HIDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Thread safe */
|
/* Thread safe */
|
||||||
void
|
void
|
||||||
gst_gl_window_draw (GstGLWindow *window)
|
gst_gl_window_draw (GstGLWindow *window)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
if (!priv->visible)
|
||||||
|
{
|
||||||
|
ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
||||||
|
priv->visible = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
RedrawWindow (priv->internal_win_id, NULL, NULL,
|
RedrawWindow (priv->internal_win_id, NULL, NULL,
|
||||||
RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE);
|
RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE);
|
||||||
}
|
}
|
||||||
|
@ -312,12 +307,12 @@ gst_gl_window_run_loop (GstGLWindow *window)
|
||||||
|
|
||||||
/* Thread safe */
|
/* Thread safe */
|
||||||
void
|
void
|
||||||
gst_gl_window_quit_loop (GstGLWindow *window)
|
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_CLOSE, 0, 0);
|
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");
|
||||||
}
|
}
|
||||||
|
@ -330,7 +325,7 @@ gst_gl_window_send_message (GstGLWindow *window, GstGLWindowCB callback, gpointe
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = SendMessage (priv->internal_win_id, WM_GSTGLWINDOW, (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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,11 +445,30 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
ShowWindowAsync (priv->internal_win_id, SW_HIDE);
|
||||||
|
|
||||||
|
if (priv->close_cb)
|
||||||
|
priv->close_cb (priv->close_data);
|
||||||
|
|
||||||
|
priv->draw_cb = NULL;
|
||||||
|
priv->draw_data = NULL;
|
||||||
|
priv->resize_cb = NULL;
|
||||||
|
priv->resize_data = NULL;
|
||||||
|
priv->close_cb = NULL;
|
||||||
|
priv->close_data = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_GST_GL_WINDOW_QUIT:
|
||||||
{
|
{
|
||||||
HWND parent_id = 0;
|
HWND parent_id = 0;
|
||||||
|
GstGLWindowCB destroy_cb = (GstGLWindowCB) lParam;
|
||||||
|
|
||||||
g_debug ("WM_CLOSE\n");
|
g_debug ("WM_CLOSE\n");
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
@ -501,11 +515,9 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_GSTGLWINDOW:
|
case WM_GST_GL_WINDOW_CUSTOM:
|
||||||
{
|
{
|
||||||
if (priv->is_closed && priv->close_cb)
|
if (!priv->is_closed)
|
||||||
priv->close_cb (priv->close_data);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
GstGLWindowCB custom_cb = (GstGLWindowCB) lParam;
|
GstGLWindowCB custom_cb = (GstGLWindowCB) lParam;
|
||||||
custom_cb ((gpointer) wParam);
|
custom_cb ((gpointer) wParam);
|
||||||
|
|
|
@ -472,23 +472,6 @@ gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, g
|
||||||
g_mutex_unlock (priv->x_lock);
|
g_mutex_unlock (priv->x_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Thread safe */
|
|
||||||
void
|
|
||||||
gst_gl_window_visible (GstGLWindow *window, gboolean visible)
|
|
||||||
{
|
|
||||||
if (window)
|
|
||||||
{
|
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
|
||||||
|
|
||||||
g_mutex_lock (priv->x_lock);
|
|
||||||
|
|
||||||
if (priv->visible != visible)
|
|
||||||
priv->visible = visible;
|
|
||||||
|
|
||||||
g_mutex_unlock (priv->x_lock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Thread safe */
|
/* Thread safe */
|
||||||
void
|
void
|
||||||
gst_gl_window_draw (GstGLWindow *window)
|
gst_gl_window_draw (GstGLWindow *window)
|
||||||
|
@ -505,10 +488,10 @@ gst_gl_window_draw (GstGLWindow *window)
|
||||||
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 = FALSE;
|
priv->visible = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
||||||
|
|
|
@ -498,8 +498,6 @@ gst_glimage_sink_render (GstBaseSink* bsink, GstBuffer* buf)
|
||||||
|
|
||||||
gst_gl_display_set_client_draw_callback (glimage_sink->display,
|
gst_gl_display_set_client_draw_callback (glimage_sink->display,
|
||||||
glimage_sink->clientDrawCallback);
|
glimage_sink->clientDrawCallback);
|
||||||
|
|
||||||
gst_gl_display_set_visible_context (glimage_sink->display, TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//is not gl
|
//is not gl
|
||||||
|
@ -528,8 +526,6 @@ gst_glimage_sink_render (GstBaseSink* bsink, GstBuffer* buf)
|
||||||
|
|
||||||
gst_gl_display_set_client_draw_callback (glimage_sink->display,
|
gst_gl_display_set_client_draw_callback (glimage_sink->display,
|
||||||
glimage_sink->clientDrawCallback);
|
glimage_sink->clientDrawCallback);
|
||||||
|
|
||||||
gst_gl_display_set_visible_context (glimage_sink->display, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//blocking call
|
//blocking call
|
||||||
|
|
Loading…
Reference in a new issue