mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:56:14 +00:00
glwindow: Add "window-handle-changed" signal
This allow other objects to clear any wrapper object that depends on the previous handle, and properly re-create the new wrappers without having to resort into doing pointer comparison. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
This commit is contained in:
parent
f72b3cf199
commit
efa6d1c2f8
1 changed files with 23 additions and 0 deletions
|
@ -127,6 +127,7 @@ enum
|
||||||
EVENT_MOUSE_SIGNAL,
|
EVENT_MOUSE_SIGNAL,
|
||||||
EVENT_KEY_SIGNAL,
|
EVENT_KEY_SIGNAL,
|
||||||
EVENT_SCROLL_SIGNAL,
|
EVENT_SCROLL_SIGNAL,
|
||||||
|
WINDOW_HANDLE_CHANGED_SIGNAL,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,6 +254,22 @@ gst_gl_window_class_init (GstGLWindowClass * klass)
|
||||||
G_TYPE_NONE, 4, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE,
|
G_TYPE_NONE, 4, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE,
|
||||||
G_TYPE_DOUBLE);
|
G_TYPE_DOUBLE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstGLWindow::window-handle-changed:
|
||||||
|
* @object: the #GstGLWindow
|
||||||
|
*
|
||||||
|
* Will be emitted when the window handle has been set into the native
|
||||||
|
* implementation, but before the context is re-activated. By using this
|
||||||
|
* signal, elements can refresh associated resource without relying on
|
||||||
|
* direct handle comparision.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
gst_gl_window_signals[WINDOW_HANDLE_CHANGED_SIGNAL] =
|
||||||
|
g_signal_new ("window-handle_changed", G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
_init_debug ();
|
_init_debug ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,6 +398,12 @@ _set_window_handle_cb (GstSetWindowHandleCb * data)
|
||||||
|
|
||||||
window_class->set_window_handle (data->window, data->handle);
|
window_class->set_window_handle (data->window, data->handle);
|
||||||
|
|
||||||
|
/* Let's assume users don't call this without a new handle, this is the
|
||||||
|
* safest since we don't know the nature of the handle and direct
|
||||||
|
* comparision might not be safe */
|
||||||
|
g_signal_emit (data->window,
|
||||||
|
gst_gl_window_signals[WINDOW_HANDLE_CHANGED_SIGNAL], 0, NULL);
|
||||||
|
|
||||||
/* reactivate */
|
/* reactivate */
|
||||||
if (context && thread)
|
if (context && thread)
|
||||||
gst_gl_context_activate (context, TRUE);
|
gst_gl_context_activate (context, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue