2012-11-13 11:12:20 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
|
|
|
|
*/
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstglwindow
|
|
|
|
* @short_description: window/surface abstraction
|
|
|
|
* @title: GstGLWindow
|
|
|
|
* @see_also: #GstGLContext, #GstGLDisplay
|
|
|
|
*
|
|
|
|
* GstGLWindow represents a window that elements can render into. A window can
|
|
|
|
* either be a user visible window (onscreen) or hidden (offscreen).
|
|
|
|
*/
|
|
|
|
|
2017-12-19 16:51:24 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-11-13 11:12:20 +00:00
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-01-08 06:40:39 +00:00
|
|
|
#include <gmodule.h>
|
2013-06-12 13:17:30 +00:00
|
|
|
#include <stdio.h>
|
2013-01-08 06:40:39 +00:00
|
|
|
|
2013-07-10 15:03:04 +00:00
|
|
|
#include "gl.h"
|
2012-11-13 11:12:20 +00:00
|
|
|
#include "gstglwindow.h"
|
2017-08-14 08:33:38 +00:00
|
|
|
#include "gstglwindow_private.h"
|
2012-11-13 11:12:20 +00:00
|
|
|
|
2013-08-15 07:09:04 +00:00
|
|
|
/* FIXME make this work with windowless contexts */
|
|
|
|
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_X11
|
2012-11-19 11:54:19 +00:00
|
|
|
#include "x11/gstglwindow_x11.h"
|
2012-11-13 11:12:20 +00:00
|
|
|
#endif
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_WIN32
|
2012-11-19 11:54:19 +00:00
|
|
|
#include "win32/gstglwindow_win32.h"
|
2012-11-13 11:12:20 +00:00
|
|
|
#endif
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_COCOA
|
2012-11-19 11:54:19 +00:00
|
|
|
#include "cocoa/gstglwindow_cocoa.h"
|
2012-11-13 11:12:20 +00:00
|
|
|
#endif
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_WAYLAND
|
2012-11-28 14:01:59 +00:00
|
|
|
#include "wayland/gstglwindow_wayland_egl.h"
|
|
|
|
#endif
|
2013-07-10 09:31:17 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_ANDROID
|
|
|
|
#include "android/gstglwindow_android_egl.h"
|
|
|
|
#endif
|
2014-04-12 19:43:50 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_EAGL
|
|
|
|
#include "eagl/gstglwindow_eagl.h"
|
|
|
|
#endif
|
2017-02-17 10:24:58 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_VIV_FB
|
|
|
|
#include "viv-fb/gstglwindow_viv_fb_egl.h"
|
|
|
|
#endif
|
2018-02-23 18:59:45 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_GBM
|
|
|
|
#include "gbm/gstglwindow_gbm_egl.h"
|
|
|
|
#endif
|
2013-08-30 13:12:37 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_DISPMANX
|
|
|
|
#include "dispmanx/gstglwindow_dispmanx_egl.h"
|
|
|
|
#endif
|
2019-05-21 06:14:39 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_WINRT
|
|
|
|
#include "winrt/gstglwindow_winrt_egl.h"
|
|
|
|
#endif
|
2012-11-13 11:12:20 +00:00
|
|
|
|
2014-05-30 00:27:14 +00:00
|
|
|
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
|
|
|
|
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
|
|
|
|
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
|
|
|
|
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
|
|
|
|
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_gl_window_debug
|
2012-11-28 14:01:59 +00:00
|
|
|
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
|
2012-11-13 11:12:20 +00:00
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
static void gst_gl_window_default_draw (GstGLWindow * window);
|
|
|
|
static void gst_gl_window_default_run (GstGLWindow * window);
|
|
|
|
static void gst_gl_window_default_quit (GstGLWindow * window);
|
2013-09-25 02:26:57 +00:00
|
|
|
static void gst_gl_window_default_send_message (GstGLWindow * window,
|
|
|
|
GstGLWindowCB callback, gpointer data);
|
2015-05-26 17:38:39 +00:00
|
|
|
static void gst_gl_window_default_send_message_async (GstGLWindow * window,
|
|
|
|
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
|
2019-04-04 15:43:02 +00:00
|
|
|
static gboolean gst_gl_window_default_has_output_surface (GstGLWindow * window);
|
2013-09-25 02:26:57 +00:00
|
|
|
|
2013-06-12 13:17:30 +00:00
|
|
|
struct _GstGLWindowPrivate
|
|
|
|
{
|
2015-05-26 17:38:39 +00:00
|
|
|
GMainLoop *loop;
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2015-09-17 07:06:37 +00:00
|
|
|
guint surface_width;
|
|
|
|
guint surface_height;
|
|
|
|
|
2016-04-10 22:02:45 +00:00
|
|
|
GMutex sync_message_lock;
|
|
|
|
GCond sync_message_cond;
|
2013-06-12 13:17:30 +00:00
|
|
|
};
|
|
|
|
|
2018-06-23 19:33:16 +00:00
|
|
|
#define gst_gl_window_parent_class parent_class
|
|
|
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstGLWindow, gst_gl_window,
|
|
|
|
GST_TYPE_OBJECT);
|
|
|
|
|
2013-06-12 13:17:30 +00:00
|
|
|
static void gst_gl_window_finalize (GObject * object);
|
|
|
|
|
2014-03-17 09:44:32 +00:00
|
|
|
typedef struct _GstGLDummyWindow
|
|
|
|
{
|
|
|
|
GstGLWindow parent;
|
|
|
|
|
|
|
|
guintptr handle;
|
|
|
|
} GstGLDummyWindow;
|
|
|
|
|
|
|
|
typedef struct _GstGLDummyWindowCass
|
|
|
|
{
|
|
|
|
GstGLWindowClass parent;
|
|
|
|
} GstGLDummyWindowClass;
|
|
|
|
|
2017-08-11 17:38:41 +00:00
|
|
|
static GstGLDummyWindow *gst_gl_dummy_window_new (void);
|
2014-03-17 09:44:32 +00:00
|
|
|
|
2014-07-06 20:39:47 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SIGNAL_0,
|
|
|
|
EVENT_MOUSE_SIGNAL,
|
|
|
|
EVENT_KEY_SIGNAL,
|
2020-02-10 18:05:01 +00:00
|
|
|
EVENT_SCROLL_SIGNAL,
|
2021-07-22 21:02:51 +00:00
|
|
|
WINDOW_HANDLE_CHANGED_SIGNAL,
|
2014-07-06 20:39:47 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint gst_gl_window_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2019-05-20 01:14:27 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_error_quark:
|
|
|
|
*
|
|
|
|
* Returns: the quark used for #GstGLWindow in #GError's
|
|
|
|
*/
|
2012-12-08 22:30:48 +00:00
|
|
|
GQuark
|
|
|
|
gst_gl_window_error_quark (void)
|
|
|
|
{
|
|
|
|
return g_quark_from_static_string ("gst-gl-window-error-quark");
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
static gboolean
|
|
|
|
gst_gl_window_default_open (GstGLWindow * window, GError ** error)
|
|
|
|
{
|
2019-03-08 06:43:40 +00:00
|
|
|
g_main_context_push_thread_default (window->main_context);
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_window_default_close (GstGLWindow * window)
|
|
|
|
{
|
2019-03-08 06:43:40 +00:00
|
|
|
g_main_context_pop_thread_default (window->main_context);
|
2015-05-26 17:38:39 +00:00
|
|
|
}
|
|
|
|
|
2015-05-27 10:11:55 +00:00
|
|
|
static void
|
|
|
|
_init_debug (void)
|
|
|
|
{
|
2021-03-18 08:18:36 +00:00
|
|
|
static gsize _init = 0;
|
2015-05-27 10:11:55 +00:00
|
|
|
|
|
|
|
if (g_once_init_enter (&_init)) {
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0,
|
|
|
|
"glwindow element");
|
|
|
|
g_once_init_leave (&_init, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
static void
|
|
|
|
gst_gl_window_init (GstGLWindow * window)
|
|
|
|
{
|
2018-06-23 19:33:16 +00:00
|
|
|
GstGLWindowPrivate *priv = gst_gl_window_get_instance_private (window);
|
2015-06-01 11:58:11 +00:00
|
|
|
window->priv = priv;
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
g_mutex_init (&window->lock);
|
2013-11-06 21:55:49 +00:00
|
|
|
window->is_drawing = FALSE;
|
|
|
|
|
2013-08-14 00:44:19 +00:00
|
|
|
g_weak_ref_init (&window->context_ref, NULL);
|
2015-06-01 11:58:11 +00:00
|
|
|
|
2016-04-10 22:02:45 +00:00
|
|
|
g_mutex_init (&window->priv->sync_message_lock);
|
|
|
|
g_cond_init (&window->priv->sync_message_cond);
|
|
|
|
|
2016-12-14 13:59:45 +00:00
|
|
|
window->main_context = g_main_context_new ();
|
|
|
|
priv->loop = g_main_loop_new (window->main_context, FALSE);
|
2012-11-13 11:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_window_class_init (GstGLWindowClass * klass)
|
|
|
|
{
|
2015-05-26 17:38:39 +00:00
|
|
|
klass->open = GST_DEBUG_FUNCPTR (gst_gl_window_default_open);
|
|
|
|
klass->close = GST_DEBUG_FUNCPTR (gst_gl_window_default_close);
|
|
|
|
klass->run = GST_DEBUG_FUNCPTR (gst_gl_window_default_run);
|
|
|
|
klass->quit = GST_DEBUG_FUNCPTR (gst_gl_window_default_quit);
|
|
|
|
klass->draw = GST_DEBUG_FUNCPTR (gst_gl_window_default_draw);
|
2013-09-25 02:26:57 +00:00
|
|
|
klass->send_message = GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message);
|
2015-05-26 17:38:39 +00:00
|
|
|
klass->send_message_async =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message_async);
|
2019-04-04 15:43:02 +00:00
|
|
|
klass->has_output_surface =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gl_window_default_has_output_surface);
|
2013-09-25 02:26:57 +00:00
|
|
|
|
2013-06-12 13:17:30 +00:00
|
|
|
G_OBJECT_CLASS (klass)->finalize = gst_gl_window_finalize;
|
2014-07-06 20:39:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstGLWindow::mouse-event:
|
|
|
|
* @object: the #GstGLWindow
|
|
|
|
* @id: the name of the event
|
|
|
|
* @button: the id of the button
|
|
|
|
* @x: the x coordinate of the mouse event
|
|
|
|
* @y: the y coordinate of the mouse event
|
|
|
|
*
|
|
|
|
* Will be emitted when a mouse event is received by the GstGLwindow.
|
|
|
|
*
|
2014-10-31 01:30:53 +00:00
|
|
|
* Since: 1.6
|
2014-07-06 20:39:47 +00:00
|
|
|
*/
|
|
|
|
gst_gl_window_signals[EVENT_MOUSE_SIGNAL] =
|
|
|
|
g_signal_new ("mouse-event", G_TYPE_FROM_CLASS (klass),
|
2019-08-26 05:54:48 +00:00
|
|
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 4, G_TYPE_STRING,
|
|
|
|
G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
2014-07-06 20:39:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstGLWindow::key-event:
|
|
|
|
* @object: the #GstGLWindow
|
|
|
|
* @id: the name of the event
|
|
|
|
* @key: the id of the key pressed
|
|
|
|
*
|
|
|
|
* Will be emitted when a key event is received by the GstGLwindow.
|
|
|
|
*
|
2014-10-31 01:30:53 +00:00
|
|
|
* Since: 1.6
|
2014-07-06 20:39:47 +00:00
|
|
|
*/
|
|
|
|
gst_gl_window_signals[EVENT_KEY_SIGNAL] =
|
|
|
|
g_signal_new ("key-event", G_TYPE_FROM_CLASS (klass),
|
2019-08-26 05:54:48 +00:00
|
|
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING);
|
2015-05-27 10:11:55 +00:00
|
|
|
|
2020-02-10 18:05:01 +00:00
|
|
|
/**
|
|
|
|
* GstGLWindow::scroll-event:
|
|
|
|
* @object: the #GstGLWindow
|
|
|
|
* @x: the x coordinate of the mouse event
|
|
|
|
* @y: the y coordinate of the mouse event
|
|
|
|
* @delta_x: the x offset of the scroll event
|
|
|
|
* @delta_y: the y offset of the scroll event
|
|
|
|
*
|
|
|
|
* Will be emitted when a mouse scroll event is received by the GstGLwindow.
|
|
|
|
*
|
|
|
|
* Since: 1.18
|
|
|
|
*/
|
|
|
|
gst_gl_window_signals[EVENT_SCROLL_SIGNAL] =
|
|
|
|
g_signal_new ("scroll-event", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
|
|
|
G_TYPE_NONE, 4, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE,
|
|
|
|
G_TYPE_DOUBLE);
|
|
|
|
|
2021-07-22 21:02:51 +00:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2015-05-27 10:11:55 +00:00
|
|
|
_init_debug ();
|
2012-11-13 11:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_new:
|
|
|
|
* @display: a #GstGLDisplay
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstGLWindow using @display's connection
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
GstGLWindow *
|
2013-06-12 13:17:30 +00:00
|
|
|
gst_gl_window_new (GstGLDisplay * display)
|
2012-11-13 11:12:20 +00:00
|
|
|
{
|
|
|
|
GstGLWindow *window = NULL;
|
|
|
|
const gchar *user_choice;
|
2012-11-28 14:01:59 +00:00
|
|
|
|
2013-11-25 22:32:32 +00:00
|
|
|
g_return_val_if_fail (display != NULL, NULL);
|
|
|
|
|
2015-05-27 10:11:55 +00:00
|
|
|
_init_debug ();
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
user_choice = g_getenv ("GST_GL_WINDOW");
|
2012-11-28 14:01:59 +00:00
|
|
|
GST_INFO ("creating a window, user choice:%s", user_choice);
|
|
|
|
|
2013-11-30 09:51:49 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_COCOA
|
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 5, "cocoa")))
|
2015-07-24 07:00:27 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_cocoa_new (display));
|
2013-11-30 09:51:49 +00:00
|
|
|
#endif
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_X11
|
2012-11-13 11:12:20 +00:00
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 3, "x11")))
|
2013-11-27 06:52:46 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_x11_new (display));
|
2012-11-13 11:12:20 +00:00
|
|
|
#endif
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_WIN32
|
2012-11-13 11:12:20 +00:00
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 5, "win32")))
|
2015-07-24 07:00:27 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_win32_new (display));
|
2012-11-13 11:12:20 +00:00
|
|
|
#endif
|
2013-01-09 14:13:23 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_WAYLAND
|
2012-11-28 14:01:59 +00:00
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
|
2015-07-24 07:00:27 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_wayland_egl_new (display));
|
2013-07-10 09:31:17 +00:00
|
|
|
#endif
|
2013-10-01 11:27:07 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_DISPMANX
|
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 8, "dispmanx")))
|
2015-07-24 07:00:27 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_dispmanx_egl_new (display));
|
2013-10-01 11:27:07 +00:00
|
|
|
#endif
|
2013-07-10 09:31:17 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_ANDROID
|
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 7, "android")))
|
2015-07-24 07:00:27 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_android_egl_new (display));
|
2014-04-12 19:43:50 +00:00
|
|
|
#endif
|
|
|
|
#if GST_GL_HAVE_WINDOW_EAGL
|
2014-05-06 06:39:55 +00:00
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
|
2015-07-24 07:00:27 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_eagl_new (display));
|
2012-11-13 11:12:20 +00:00
|
|
|
#endif
|
2017-02-17 10:24:58 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_VIV_FB
|
2017-05-09 21:59:04 +00:00
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 6, "viv-fb")))
|
2017-02-17 10:24:58 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_window_viv_fb_egl_new (display));
|
|
|
|
#endif
|
2018-02-23 18:59:45 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_GBM
|
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 3, "gbm")))
|
|
|
|
window = GST_GL_WINDOW (gst_gl_window_gbm_egl_new (display));
|
|
|
|
#endif
|
2019-05-21 06:14:39 +00:00
|
|
|
#if GST_GL_HAVE_WINDOW_WINRT
|
|
|
|
if (!window && (!user_choice || g_strstr_len (user_choice, 5, "winrt")))
|
|
|
|
window = GST_GL_WINDOW (gst_gl_window_winrt_egl_new (display));
|
|
|
|
#endif
|
2017-02-17 10:24:58 +00:00
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
if (!window) {
|
2013-02-12 12:48:36 +00:00
|
|
|
/* subclass returned a NULL window */
|
2014-03-17 09:44:32 +00:00
|
|
|
GST_WARNING ("Could not create window. user specified %s, creating dummy"
|
|
|
|
" window", user_choice ? user_choice : "(null)");
|
2013-02-12 12:48:36 +00:00
|
|
|
|
2014-03-17 09:44:32 +00:00
|
|
|
window = GST_GL_WINDOW (gst_gl_dummy_window_new ());
|
2012-11-13 11:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-11-25 22:32:32 +00:00
|
|
|
window->display = gst_object_ref (display);
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
2013-06-12 13:17:30 +00:00
|
|
|
static void
|
|
|
|
gst_gl_window_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstGLWindow *window = GST_GL_WINDOW (object);
|
2015-06-01 11:58:11 +00:00
|
|
|
GstGLWindowPrivate *priv = window->priv;
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2019-03-08 06:40:52 +00:00
|
|
|
gst_gl_display_remove_window (window->display, window);
|
|
|
|
|
2015-06-01 11:58:11 +00:00
|
|
|
if (priv->loop)
|
|
|
|
g_main_loop_unref (priv->loop);
|
|
|
|
|
2016-12-14 13:59:45 +00:00
|
|
|
if (window->main_context)
|
|
|
|
g_main_context_unref (window->main_context);
|
|
|
|
window->main_context = NULL;
|
2015-06-01 11:58:11 +00:00
|
|
|
|
2013-08-14 00:44:19 +00:00
|
|
|
g_weak_ref_clear (&window->context_ref);
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2013-11-06 22:13:20 +00:00
|
|
|
g_mutex_clear (&window->lock);
|
2016-04-10 22:02:45 +00:00
|
|
|
g_mutex_clear (&window->priv->sync_message_lock);
|
|
|
|
g_cond_clear (&window->priv->sync_message_cond);
|
2013-11-25 22:32:32 +00:00
|
|
|
gst_object_unref (window->display);
|
2013-11-06 22:13:20 +00:00
|
|
|
|
2013-06-12 13:17:30 +00:00
|
|
|
G_OBJECT_CLASS (gst_gl_window_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2015-02-24 13:01:04 +00:00
|
|
|
typedef struct _GstSetWindowHandleCb
|
|
|
|
{
|
|
|
|
GstGLWindow *window;
|
|
|
|
guintptr handle;
|
|
|
|
} GstSetWindowHandleCb;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_set_window_handle_cb (GstSetWindowHandleCb * data)
|
|
|
|
{
|
|
|
|
GstGLContext *context = gst_gl_window_get_context (data->window);
|
|
|
|
GstGLWindowClass *window_class = GST_GL_WINDOW_GET_CLASS (data->window);
|
2015-04-21 02:25:11 +00:00
|
|
|
GThread *thread = NULL;
|
|
|
|
|
|
|
|
/* deactivate if necessary */
|
|
|
|
if (context) {
|
|
|
|
thread = gst_gl_context_get_thread (context);
|
|
|
|
if (thread) {
|
|
|
|
/* This is only thread safe iff the context thread == g_thread_self() */
|
|
|
|
g_assert (thread == g_thread_self ());
|
|
|
|
gst_gl_context_activate (context, FALSE);
|
|
|
|
}
|
|
|
|
}
|
2015-02-24 13:01:04 +00:00
|
|
|
|
|
|
|
window_class->set_window_handle (data->window, data->handle);
|
2015-03-03 15:55:26 +00:00
|
|
|
|
2021-07-22 21:02:51 +00:00
|
|
|
/* 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);
|
|
|
|
|
2015-04-21 02:25:11 +00:00
|
|
|
/* reactivate */
|
|
|
|
if (context && thread)
|
|
|
|
gst_gl_context_activate (context, TRUE);
|
|
|
|
|
|
|
|
if (context)
|
|
|
|
gst_object_unref (context);
|
|
|
|
if (thread)
|
|
|
|
g_thread_unref (thread);
|
2015-02-24 13:01:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_free_swh_cb (GstSetWindowHandleCb * data)
|
|
|
|
{
|
|
|
|
gst_object_unref (data->window);
|
2023-01-08 17:13:43 +00:00
|
|
|
g_free (data);
|
2015-02-24 13:01:04 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_set_window_handle:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @handle: handle to the window
|
|
|
|
*
|
|
|
|
* Sets the window that this @window should render into. Some implementations
|
|
|
|
* require this to be called with a valid handle before drawing can commence.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
2015-02-24 13:01:04 +00:00
|
|
|
GstSetWindowHandleCb *data;
|
2012-11-13 11:12:20 +00:00
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
g_return_if_fail (handle != 0);
|
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
g_return_if_fail (window_class->set_window_handle != NULL);
|
|
|
|
|
2023-01-08 17:13:43 +00:00
|
|
|
data = g_new (GstSetWindowHandleCb, 1);
|
2015-02-24 13:01:04 +00:00
|
|
|
data->window = gst_object_ref (window);
|
|
|
|
data->handle = handle;
|
|
|
|
|
|
|
|
/* FIXME: Move to a message which deactivates, calls implementation, activates */
|
|
|
|
gst_gl_window_send_message_async (window,
|
|
|
|
(GstGLWindowCB) _set_window_handle_cb, data,
|
|
|
|
(GDestroyNotify) _free_swh_cb);
|
|
|
|
|
|
|
|
/* window_class->set_window_handle (window, handle); */
|
2012-11-13 11:12:20 +00:00
|
|
|
}
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
static void
|
|
|
|
draw_cb (gpointer data)
|
|
|
|
{
|
|
|
|
GstGLWindow *window = GST_GL_WINDOW (data);
|
|
|
|
GstGLContext *context = gst_gl_window_get_context (window);
|
|
|
|
|
2015-09-17 07:06:37 +00:00
|
|
|
if (window->queue_resize) {
|
|
|
|
guint width, height;
|
|
|
|
|
|
|
|
gst_gl_window_get_surface_dimensions (window, &width, &height);
|
|
|
|
gst_gl_window_resize (window, width, height);
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
if (window->draw)
|
|
|
|
window->draw (window->draw_data);
|
|
|
|
|
2017-05-21 10:03:01 +00:00
|
|
|
gst_gl_context_swap_buffers (context);
|
2015-05-26 17:38:39 +00:00
|
|
|
|
|
|
|
gst_object_unref (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_window_default_draw (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
|
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_draw:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Redraw the window contents. Implementations should invoke the draw callback.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
2015-01-23 03:11:48 +00:00
|
|
|
gst_gl_window_draw (GstGLWindow * window)
|
2012-11-13 11:12:20 +00:00
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
g_return_if_fail (window_class->draw != NULL);
|
|
|
|
|
2013-11-06 21:55:49 +00:00
|
|
|
/* avoid to overload the drawer */
|
|
|
|
if (window->is_drawing) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-23 03:11:48 +00:00
|
|
|
window_class->draw (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_gl_window_set_preferred_size:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @width: new preferred width
|
|
|
|
* @height: new preferred height
|
|
|
|
*
|
|
|
|
* Set the preferred width and height of the window. Implementations are free
|
|
|
|
* to ignore this information.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_gl_window_set_preferred_size (GstGLWindow * window, gint width, gint height)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2015-01-23 03:11:48 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
|
|
|
if (window_class->set_preferred_size)
|
|
|
|
window_class->set_preferred_size (window, width, height);
|
2012-11-13 11:12:20 +00:00
|
|
|
}
|
|
|
|
|
2015-01-29 11:25:00 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_show:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Present the window to the screen.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_gl_window_show (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2015-01-29 11:25:00 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
|
|
|
if (window_class->show)
|
|
|
|
window_class->show (window);
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
static void
|
|
|
|
gst_gl_window_default_run (GstGLWindow * window)
|
|
|
|
{
|
2016-11-28 03:22:05 +00:00
|
|
|
GstGLWindowPrivate *priv = window->priv;
|
|
|
|
|
|
|
|
g_main_loop_run (priv->loop);
|
2015-05-26 17:38:39 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_run:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Start the execution of the runloop.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_run (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
g_return_if_fail (window_class->run != NULL);
|
|
|
|
|
|
|
|
window_class->run (window);
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
static void
|
2019-11-12 01:17:44 +00:00
|
|
|
window_default_quit_func (GstGLWindow * window)
|
2015-05-26 17:38:39 +00:00
|
|
|
{
|
2019-03-08 06:40:52 +00:00
|
|
|
gst_gl_display_remove_window (window->display, window);
|
2015-05-26 17:38:39 +00:00
|
|
|
g_main_loop_quit (window->priv->loop);
|
|
|
|
}
|
|
|
|
|
2019-11-12 01:17:44 +00:00
|
|
|
static void
|
|
|
|
gst_gl_window_default_quit (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
gst_gl_window_send_message_async (window,
|
|
|
|
(GstGLWindowCB) window_default_quit_func, gst_object_ref (window),
|
|
|
|
gst_object_unref);
|
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_quit:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Quit the runloop's execution.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
2013-07-15 13:58:04 +00:00
|
|
|
gst_gl_window_quit (GstGLWindow * window)
|
2012-11-13 11:12:20 +00:00
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
g_return_if_fail (window_class->quit != NULL);
|
|
|
|
|
|
|
|
GST_GL_WINDOW_LOCK (window);
|
|
|
|
|
2013-07-15 13:58:04 +00:00
|
|
|
window_class->quit (window);
|
2012-11-13 11:12:20 +00:00
|
|
|
|
2013-06-12 13:17:30 +00:00
|
|
|
GST_INFO ("quit sent to gl window loop");
|
|
|
|
|
2013-06-13 04:36:41 +00:00
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
2012-11-13 11:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-09-25 02:26:57 +00:00
|
|
|
typedef struct _GstGLSyncMessage
|
|
|
|
{
|
2016-04-10 22:02:45 +00:00
|
|
|
GstGLWindow *window;
|
2013-09-25 02:26:57 +00:00
|
|
|
gboolean fired;
|
|
|
|
|
|
|
|
GstGLWindowCB callback;
|
|
|
|
gpointer data;
|
|
|
|
} GstGLSyncMessage;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_run_message_sync (GstGLSyncMessage * message)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (message->callback)
|
|
|
|
message->callback (message->data);
|
|
|
|
|
2016-04-10 22:02:45 +00:00
|
|
|
g_mutex_lock (&message->window->priv->sync_message_lock);
|
2013-09-25 02:26:57 +00:00
|
|
|
message->fired = TRUE;
|
2016-04-10 22:02:45 +00:00
|
|
|
g_cond_broadcast (&message->window->priv->sync_message_cond);
|
|
|
|
g_mutex_unlock (&message->window->priv->sync_message_lock);
|
2013-09-25 02:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_gl_window_default_send_message (GstGLWindow * window,
|
|
|
|
GstGLWindowCB callback, gpointer data)
|
|
|
|
{
|
|
|
|
GstGLSyncMessage message;
|
|
|
|
|
2016-04-10 22:02:45 +00:00
|
|
|
message.window = window;
|
2013-09-25 02:26:57 +00:00
|
|
|
message.callback = callback;
|
|
|
|
message.data = data;
|
|
|
|
message.fired = FALSE;
|
|
|
|
|
|
|
|
gst_gl_window_send_message_async (window, (GstGLWindowCB) _run_message_sync,
|
|
|
|
&message, NULL);
|
|
|
|
|
2016-04-10 22:02:45 +00:00
|
|
|
g_mutex_lock (&window->priv->sync_message_lock);
|
2013-09-25 02:26:57 +00:00
|
|
|
|
|
|
|
/* block until opengl calls have been executed in the gl thread */
|
|
|
|
while (!message.fired)
|
2016-04-10 22:02:45 +00:00
|
|
|
g_cond_wait (&window->priv->sync_message_cond,
|
|
|
|
&window->priv->sync_message_lock);
|
|
|
|
g_mutex_unlock (&window->priv->sync_message_lock);
|
2013-09-25 02:26:57 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_send_message:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @callback: (scope async): function to invoke
|
|
|
|
* @data: (closure): data to invoke @callback with
|
|
|
|
*
|
2019-08-29 17:42:39 +00:00
|
|
|
* Invoke @callback with data on the window thread. @callback is guaranteed to
|
2013-11-23 11:57:49 +00:00
|
|
|
* have executed when this function returns.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
g_return_if_fail (callback != NULL);
|
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
2013-09-25 02:26:57 +00:00
|
|
|
g_return_if_fail (window_class->send_message != NULL);
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
window_class->send_message (window, callback, data);
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:38:39 +00:00
|
|
|
typedef struct _GstGLAsyncMessage
|
|
|
|
{
|
|
|
|
GstGLWindowCB callback;
|
|
|
|
gpointer data;
|
|
|
|
GDestroyNotify destroy;
|
|
|
|
} GstGLAsyncMessage;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_run_message_async (GstGLAsyncMessage * message)
|
|
|
|
{
|
|
|
|
if (message->callback)
|
|
|
|
message->callback (message->data);
|
|
|
|
|
|
|
|
if (message->destroy)
|
|
|
|
message->destroy (message->data);
|
|
|
|
|
2023-01-08 17:13:43 +00:00
|
|
|
g_free (message);
|
2015-05-26 17:38:39 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_window_default_send_message_async (GstGLWindow * window,
|
|
|
|
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
|
|
|
|
{
|
2023-01-08 17:13:43 +00:00
|
|
|
GstGLAsyncMessage *message = g_new (GstGLAsyncMessage, 1);
|
2015-05-26 17:38:39 +00:00
|
|
|
|
|
|
|
message->callback = callback;
|
|
|
|
message->data = data;
|
|
|
|
message->destroy = destroy;
|
|
|
|
|
2016-12-14 13:59:45 +00:00
|
|
|
g_main_context_invoke (window->main_context, (GSourceFunc) _run_message_async,
|
2015-05-26 17:38:39 +00:00
|
|
|
message);
|
|
|
|
}
|
|
|
|
|
2019-04-04 15:43:02 +00:00
|
|
|
static gboolean
|
|
|
|
gst_gl_window_default_has_output_surface (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_gl_window_has_output_surface:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Query whether @window has output surface or not
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @window has useable output surface
|
|
|
|
*
|
|
|
|
* Since: 1.18
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_gl_window_has_output_surface (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
|
|
|
|
|
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
|
|
|
g_assert (window_class->has_output_surface);
|
|
|
|
|
|
|
|
return window_class->has_output_surface (window);
|
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_send_message_async:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @callback: (scope async): function to invoke
|
|
|
|
* @data: (closure): data to invoke @callback with
|
2016-11-03 05:14:37 +00:00
|
|
|
* @destroy: called when @data is not needed anymore
|
2013-11-23 11:57:49 +00:00
|
|
|
*
|
|
|
|
* Invoke @callback with @data on the window thread. The callback may not
|
|
|
|
* have been executed when this function returns.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2013-09-25 02:26:57 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_send_message_async (GstGLWindow * window, GstGLWindowCB callback,
|
|
|
|
gpointer data, GDestroyNotify destroy)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2013-09-25 02:26:57 +00:00
|
|
|
g_return_if_fail (callback != NULL);
|
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
g_return_if_fail (window_class->send_message_async != NULL);
|
|
|
|
|
|
|
|
window_class->send_message_async (window, callback, data, destroy);
|
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_set_draw_callback:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @callback: (scope notified): function to invoke
|
|
|
|
* @data: (closure): data to invoke @callback with
|
2016-11-03 05:14:37 +00:00
|
|
|
* @destroy_notify: called when @data is not needed any more
|
2013-11-23 11:57:49 +00:00
|
|
|
*
|
2019-08-29 17:42:39 +00:00
|
|
|
* Sets the draw callback called every time gst_gl_window_draw() is called
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_set_draw_callback (GstGLWindow * window, GstGLWindowCB callback,
|
2013-07-15 13:58:04 +00:00
|
|
|
gpointer data, GDestroyNotify destroy_notify)
|
2012-11-13 11:12:20 +00:00
|
|
|
{
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
GST_GL_WINDOW_LOCK (window);
|
|
|
|
|
2013-07-15 13:58:04 +00:00
|
|
|
if (window->draw_notify)
|
|
|
|
window->draw_notify (window->draw_data);
|
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
window->draw = callback;
|
|
|
|
window->draw_data = data;
|
2013-07-15 13:58:04 +00:00
|
|
|
window->draw_notify = destroy_notify;
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_set_resize_callback:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @callback: (scope notified): function to invoke
|
|
|
|
* @data: (closure): data to invoke @callback with
|
2016-11-03 05:14:37 +00:00
|
|
|
* @destroy_notify: called when @data is not needed any more
|
2013-11-23 11:57:49 +00:00
|
|
|
*
|
2019-08-29 17:42:39 +00:00
|
|
|
* Sets the resize callback called every time a resize of the window occurs.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_set_resize_callback (GstGLWindow * window,
|
2013-07-15 13:58:04 +00:00
|
|
|
GstGLWindowResizeCB callback, gpointer data, GDestroyNotify destroy_notify)
|
2012-11-13 11:12:20 +00:00
|
|
|
{
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
GST_GL_WINDOW_LOCK (window);
|
|
|
|
|
2013-07-15 13:58:04 +00:00
|
|
|
if (window->resize_notify)
|
|
|
|
window->resize_notify (window->resize_data);
|
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
window->resize = callback;
|
|
|
|
window->resize_data = data;
|
2013-07-15 13:58:04 +00:00
|
|
|
window->resize_notify = destroy_notify;
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_set_close_callback:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @callback: (scope notified): function to invoke
|
|
|
|
* @data: (closure): data to invoke @callback with
|
2016-11-03 05:14:37 +00:00
|
|
|
* @destroy_notify: called when @data is not needed any more
|
2013-11-23 11:57:49 +00:00
|
|
|
*
|
|
|
|
* Sets the callback called when the window is about to close.
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2012-11-13 11:12:20 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
|
2013-07-15 13:58:04 +00:00
|
|
|
gpointer data, GDestroyNotify destroy_notify)
|
2012-11-13 11:12:20 +00:00
|
|
|
{
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
GST_GL_WINDOW_LOCK (window);
|
|
|
|
|
2013-07-15 13:58:04 +00:00
|
|
|
if (window->close_notify)
|
|
|
|
window->close_notify (window->close_data);
|
|
|
|
|
2012-11-13 11:12:20 +00:00
|
|
|
window->close = callback;
|
|
|
|
window->close_data = data;
|
2013-07-15 13:58:04 +00:00
|
|
|
window->close_notify = destroy_notify;
|
2012-11-13 11:12:20 +00:00
|
|
|
|
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
|
|
|
}
|
2012-12-03 04:04:49 +00:00
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_get_display:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Returns: the windowing system display handle for this @window
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2013-08-15 07:09:04 +00:00
|
|
|
guintptr
|
|
|
|
gst_gl_window_get_display (GstGLWindow * window)
|
2012-12-03 04:04:49 +00:00
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), 0);
|
2012-12-03 04:04:49 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
2013-08-15 07:09:04 +00:00
|
|
|
g_return_val_if_fail (window_class->get_display != NULL, 0);
|
|
|
|
|
2013-11-25 09:34:06 +00:00
|
|
|
return window_class->get_display (window);
|
2012-12-03 04:04:49 +00:00
|
|
|
}
|
2013-01-08 06:40:39 +00:00
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_get_window_handle:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Returns: the window handle we are currently rendering into
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2013-08-15 07:09:04 +00:00
|
|
|
guintptr
|
|
|
|
gst_gl_window_get_window_handle (GstGLWindow * window)
|
2013-01-08 06:40:39 +00:00
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), 0);
|
2013-01-08 06:40:39 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
2013-08-15 07:09:04 +00:00
|
|
|
g_return_val_if_fail (window_class->get_window_handle != NULL, 0);
|
2013-01-08 06:40:39 +00:00
|
|
|
|
2013-11-25 09:34:06 +00:00
|
|
|
return window_class->get_window_handle (window);
|
2013-01-08 06:40:39 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 11:57:49 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_get_context:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): the #GstGLContext associated with this @window
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2013-11-23 11:57:49 +00:00
|
|
|
*/
|
2013-08-14 00:44:19 +00:00
|
|
|
GstGLContext *
|
|
|
|
gst_gl_window_get_context (GstGLWindow * window)
|
2013-06-12 13:17:30 +00:00
|
|
|
{
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), NULL);
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2013-08-14 00:44:19 +00:00
|
|
|
return (GstGLContext *) g_weak_ref_get (&window->context_ref);
|
2013-06-12 13:17:30 +00:00
|
|
|
}
|
2014-03-17 09:44:32 +00:00
|
|
|
|
2014-08-06 13:48:03 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_get_surface_dimensions:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @width: (out): resulting surface width
|
|
|
|
* @height: (out): resulting surface height
|
2014-10-31 01:30:53 +00:00
|
|
|
*
|
|
|
|
* Since: 1.6
|
2014-08-06 13:48:03 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_gl_window_get_surface_dimensions (GstGLWindow * window, guint * width,
|
|
|
|
guint * height)
|
|
|
|
{
|
2019-03-08 06:43:40 +00:00
|
|
|
GST_GL_WINDOW_LOCK (window);
|
2015-09-17 07:06:37 +00:00
|
|
|
if (width)
|
|
|
|
*width = window->priv->surface_width;
|
|
|
|
if (height)
|
|
|
|
*height = window->priv->surface_height;
|
2019-03-08 06:43:40 +00:00
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
2014-08-06 13:48:03 +00:00
|
|
|
}
|
|
|
|
|
2015-12-21 10:27:09 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_send_key_event (GstGLWindow * window, const char *event_type,
|
|
|
|
const char *key_str)
|
|
|
|
{
|
|
|
|
g_signal_emit (window, gst_gl_window_signals[EVENT_KEY_SIGNAL], 0,
|
|
|
|
event_type, key_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_gl_window_send_mouse_event (GstGLWindow * window, const char *event_type,
|
|
|
|
int button, double posx, double posy)
|
|
|
|
{
|
|
|
|
g_signal_emit (window, gst_gl_window_signals[EVENT_MOUSE_SIGNAL], 0,
|
|
|
|
event_type, button, posx, posy);
|
|
|
|
}
|
|
|
|
|
2020-04-30 16:59:24 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_send_scroll_event:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @posx: x position of the mouse cursor
|
|
|
|
* @posy: y position of the mouse cursor
|
|
|
|
* @delta_x: the x offset of the scroll event
|
|
|
|
* @delta_y: the y offset of the scroll event
|
|
|
|
*
|
|
|
|
* Notify a @window about a scroll event. A scroll signal holding the event
|
|
|
|
* coordinates will be emitted.
|
|
|
|
*
|
|
|
|
* Since: 1.18
|
|
|
|
*/
|
2020-02-10 18:05:01 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_send_scroll_event (GstGLWindow * window,
|
|
|
|
double posx, double posy, double delta_x, double delta_y)
|
|
|
|
{
|
|
|
|
g_signal_emit (window, gst_gl_window_signals[EVENT_SCROLL_SIGNAL], 0,
|
|
|
|
posx, posy, delta_x, delta_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-29 11:24:16 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_handle_events:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @handle_events: a #gboolean indicating if events should be handled or not.
|
|
|
|
*
|
2014-11-11 08:04:48 +00:00
|
|
|
* Tell a @window that it should handle events from the window system. These
|
|
|
|
* events are forwarded upstream as navigation events. In some window systems
|
|
|
|
* events are not propagated in the window hierarchy if a client is listening
|
|
|
|
* for them. This method allows you to disable events handling completely
|
|
|
|
* from the @window.
|
2014-10-29 11:24:16 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_gl_window_handle_events (GstGLWindow * window, gboolean handle_events)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2014-10-29 11:24:16 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
2014-11-11 23:43:42 +00:00
|
|
|
if (window_class->handle_events)
|
|
|
|
window_class->handle_events (window, handle_events);
|
2014-10-29 11:24:16 +00:00
|
|
|
}
|
2015-05-29 08:03:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_gl_window_set_render_rectangle:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @x: x position
|
|
|
|
* @y: y position
|
|
|
|
* @width: width
|
|
|
|
* @height: height
|
|
|
|
*
|
|
|
|
* Tell a @window that it should render into a specific region of the window
|
|
|
|
* according to the #GstVideoOverlay interface.
|
|
|
|
*
|
|
|
|
* Returns: whether the specified region could be set
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_gl_window_set_render_rectangle (GstGLWindow * window, gint x, gint y,
|
|
|
|
gint width, gint height)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
|
2015-05-29 08:03:52 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
GST_GL_WINDOW_LOCK (window);
|
2018-01-29 12:57:56 +00:00
|
|
|
/* When x/y is smaller then reset the render rectangle */
|
|
|
|
if (x < 0 || y < 0) {
|
|
|
|
x = y = 0;
|
|
|
|
width = window->priv->surface_width;
|
|
|
|
height = window->priv->surface_height;
|
|
|
|
}
|
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
if (x < 0 || y < 0 || width <= 0 || height <= 0) {
|
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
2015-05-29 08:03:52 +00:00
|
|
|
return FALSE;
|
2019-03-08 06:43:40 +00:00
|
|
|
}
|
2015-05-29 08:03:52 +00:00
|
|
|
|
|
|
|
if (window_class->set_render_rectangle)
|
|
|
|
ret = window_class->set_render_rectangle (window, x, y, width, height);
|
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
GST_GL_WINDOW_UNLOCK (window);
|
|
|
|
|
2015-05-29 08:03:52 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2015-09-17 07:06:37 +00:00
|
|
|
|
2019-04-23 11:31:45 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_queue_resize:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Queue resizing of @window.
|
|
|
|
*/
|
2015-09-17 07:06:37 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_queue_resize (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
2015-10-19 04:15:30 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2015-09-17 07:06:37 +00:00
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
|
|
|
window->queue_resize = TRUE;
|
|
|
|
if (window_class->queue_resize)
|
|
|
|
window_class->queue_resize (window);
|
|
|
|
}
|
|
|
|
|
2016-07-01 06:18:55 +00:00
|
|
|
struct resize_data
|
|
|
|
{
|
|
|
|
GstGLWindow *window;
|
|
|
|
guint width, height;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
_on_resize (gpointer data)
|
|
|
|
{
|
|
|
|
struct resize_data *resize = data;
|
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
GST_GL_WINDOW_LOCK (resize->window);
|
|
|
|
|
|
|
|
if (resize->window->resize)
|
|
|
|
resize->window->resize (resize->window->resize_data, resize->width,
|
|
|
|
resize->height);
|
|
|
|
|
|
|
|
resize->window->priv->surface_width = resize->width;
|
|
|
|
resize->window->priv->surface_height = resize->height;
|
|
|
|
|
|
|
|
GST_GL_WINDOW_UNLOCK (resize->window);
|
|
|
|
|
|
|
|
resize->window->queue_resize = FALSE;
|
2016-07-01 06:18:55 +00:00
|
|
|
}
|
|
|
|
|
2019-04-23 11:31:45 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_resize:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
* @width: new width
|
|
|
|
* @height: new height
|
|
|
|
*
|
|
|
|
* Resize @window to the given @width and @height.
|
|
|
|
*/
|
2015-09-17 07:06:37 +00:00
|
|
|
void
|
|
|
|
gst_gl_window_resize (GstGLWindow * window, guint width, guint height)
|
|
|
|
{
|
2019-03-08 06:43:40 +00:00
|
|
|
struct resize_data resize = { 0, };
|
2016-07-01 06:18:55 +00:00
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
g_return_if_fail (GST_IS_GL_WINDOW (window));
|
2015-09-17 07:06:37 +00:00
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
resize.window = window;
|
|
|
|
resize.width = width;
|
|
|
|
resize.height = height;
|
2016-07-27 04:48:50 +00:00
|
|
|
|
2019-03-08 06:43:40 +00:00
|
|
|
gst_gl_window_send_message (window, (GstGLWindowCB) _on_resize, &resize);
|
2015-09-17 07:06:37 +00:00
|
|
|
}
|
2016-06-30 14:31:07 +00:00
|
|
|
|
2019-04-23 11:31:45 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_window_controls_viewport:
|
|
|
|
* @window: a #GstGLWindow
|
|
|
|
*
|
|
|
|
* Checks if @window controls the GL viewport.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @window controls the GL viewport, otherwise %FALSE
|
|
|
|
*
|
|
|
|
* Since: 1.16
|
|
|
|
*/
|
2019-03-05 05:13:15 +00:00
|
|
|
gboolean
|
|
|
|
gst_gl_window_controls_viewport (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
|
|
|
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
|
|
|
|
|
|
|
if (!window_class->controls_viewport)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return window_class->controls_viewport (window);
|
|
|
|
}
|
|
|
|
|
2017-08-11 17:38:41 +00:00
|
|
|
static GType gst_gl_dummy_window_get_type (void);
|
2016-06-30 14:31:07 +00:00
|
|
|
|
2019-04-04 15:43:02 +00:00
|
|
|
static gboolean
|
|
|
|
gst_gl_dummy_window_has_output_surface (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-06-30 14:31:07 +00:00
|
|
|
G_DEFINE_TYPE (GstGLDummyWindow, gst_gl_dummy_window, GST_TYPE_GL_WINDOW);
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_dummy_window_set_window_handle (GstGLWindow * window, guintptr handle)
|
|
|
|
{
|
|
|
|
GstGLDummyWindow *dummy = (GstGLDummyWindow *) window;
|
|
|
|
|
|
|
|
dummy->handle = handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guintptr
|
|
|
|
gst_gl_dummy_window_get_window_handle (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
GstGLDummyWindow *dummy = (GstGLDummyWindow *) window;
|
|
|
|
|
|
|
|
return (guintptr) dummy->handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guintptr
|
|
|
|
gst_gl_dummy_window_get_display (GstGLWindow * window)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
|
|
|
|
{
|
|
|
|
GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
|
|
|
|
|
|
|
|
window_class->get_display =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_display);
|
|
|
|
window_class->get_window_handle =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_window_handle);
|
|
|
|
window_class->set_window_handle =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_set_window_handle);
|
2019-04-04 15:43:02 +00:00
|
|
|
window_class->has_output_surface =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_has_output_surface);
|
2016-06-30 14:31:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_dummy_window_init (GstGLDummyWindow * dummy)
|
|
|
|
{
|
|
|
|
dummy->handle = 0;
|
|
|
|
}
|
|
|
|
|
2017-08-11 17:38:41 +00:00
|
|
|
static GstGLDummyWindow *
|
2016-06-30 14:31:07 +00:00
|
|
|
gst_gl_dummy_window_new (void)
|
|
|
|
{
|
2017-05-15 17:31:31 +00:00
|
|
|
GstGLDummyWindow *window;
|
|
|
|
|
|
|
|
window = g_object_new (gst_gl_dummy_window_get_type (), NULL);
|
|
|
|
gst_object_ref_sink (window);
|
|
|
|
|
|
|
|
return window;
|
2016-06-30 14:31:07 +00:00
|
|
|
}
|