glcontext: add public swap_buffers function

That simply calls the implementation
This commit is contained in:
Matthew Waters 2017-05-21 12:03:01 +02:00
parent 624fe65f54
commit 15e13bd44e
11 changed files with 32 additions and 18 deletions

View file

@ -864,6 +864,7 @@ gst_gl_context_new_wrapped
gst_gl_context_create
gst_gl_context_destroy
gst_gl_context_activate
gst_gl_context_swap_buffers
gst_gl_context_default_get_proc_address
gst_gl_context_get_proc_address
gst_gl_context_get_proc_address_with_platform

View file

@ -107,7 +107,6 @@ draw_cb (gpointer data)
GstGLWindow *window = GST_GL_WINDOW (window_egl);
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
if (context_egl->egl_surface) {
gint width, height;
@ -128,7 +127,7 @@ draw_cb (gpointer data)
if (window->draw)
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
gst_object_unref (context);
}

View file

@ -34,7 +34,7 @@ static guintptr gst_gl_context_cocoa_get_gl_context (GstGLContext * window);
static gboolean gst_gl_context_cocoa_activate (GstGLContext * context, gboolean activate);
static GstGLAPI gst_gl_context_cocoa_get_gl_api (GstGLContext * context);
static GstGLPlatform gst_gl_context_cocoa_get_gl_platform (GstGLContext * context);
static void gst_gl_context_cocoa_swap_buffer (GstGLContext * context);
static void gst_gl_context_cocoa_swap_buffers (GstGLContext * context);
#define GST_GL_CONTEXT_COCOA_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_COCOA, GstGLContextCocoaPrivate))
@ -53,7 +53,7 @@ gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate));
context_class->swap_buffers =
GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_swap_buffer);
GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_swap_buffers);
context_class->destroy_context =
GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_destroy_context);
context_class->create_context =
@ -290,7 +290,7 @@ error:
}
static void
gst_gl_context_cocoa_swap_buffer (GstGLContext * context)
gst_gl_context_cocoa_swap_buffers (GstGLContext * context)
{
}

View file

@ -183,7 +183,6 @@ draw_cb (gpointer data)
GstGLWindow *window = GST_GL_WINDOW (window_eagl);
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextEagl *eagl_context = GST_GL_CONTEXT_EAGL (context);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
if (window_eagl->priv->view) {
CGSize size;
@ -210,7 +209,7 @@ draw_cb (gpointer data)
if (window->draw)
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
gst_gl_context_eagl_finish_draw (eagl_context);

View file

@ -1767,6 +1767,25 @@ gst_gl_context_get_gl_platform_version (GstGLContext * context, gint * major,
context_class->get_gl_platform_version (context, major, minor);
}
/**
* gst_gl_context_swap_buffers:
* @context: a #GstGLContext
*
* Swap the front and back buffers on the window attached to @context.
* This will display the frame on the next refresh cycle.
*/
void
gst_gl_context_swap_buffers (GstGLContext * context)
{
GstGLContextClass *context_class;
g_return_if_fail (GST_IS_GL_CONTEXT (context));
context_class = GST_GL_CONTEXT_GET_CLASS (context);
g_return_if_fail (context_class->swap_buffers != NULL);
context_class->swap_buffers (context);
}
static GstGLAPI
gst_gl_wrapped_context_get_gl_api (GstGLContext * context)
{

View file

@ -164,6 +164,8 @@ GST_EXPORT
guintptr gst_gl_context_get_gl_context (GstGLContext *context);
GST_EXPORT
gboolean gst_gl_context_can_share (GstGLContext * context, GstGLContext *other_context);
GST_EXPORT
void gst_gl_context_swap_buffers (GstGLContext * context);
GST_EXPORT
gboolean gst_gl_context_create (GstGLContext *context, GstGLContext *other_context, GError ** error);

View file

@ -395,7 +395,6 @@ draw_cb (gpointer data)
{
GstGLWindow *window = GST_GL_WINDOW (data);
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
if (window->queue_resize) {
guint width, height;
@ -407,8 +406,7 @@ draw_cb (gpointer data)
if (window->draw)
window->draw (window->draw_data);
if (context_class->swap_buffers)
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
gst_object_unref (context);
}

View file

@ -165,7 +165,6 @@ draw_cb (gpointer data)
GstGLWindowVivFBEGL *window_egl = data;
GstGLWindow *window = GST_GL_WINDOW (window_egl);
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
const GstGLFuncs *gl;
gint viewport_dim[4];
@ -189,7 +188,7 @@ draw_cb (gpointer data)
if (window->draw)
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
gst_object_unref (context);
}

View file

@ -486,7 +486,6 @@ draw_cb (gpointer data)
GstGLWindowWaylandEGL *window_egl = data;
GstGLWindow *window = GST_GL_WINDOW (window_egl);
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
create_surfaces (window_egl);
@ -503,7 +502,7 @@ draw_cb (gpointer data)
if (window->draw)
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
if (window_egl->window.subsurface)
wl_subsurface_set_desync (window_egl->window.subsurface);

View file

@ -408,12 +408,10 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} else if (GetProp (hWnd, "gl_window")) {
GstGLWindow *window;
GstGLContext *context;
GstGLContextClass *context_class;
window_win32 = GST_GL_WINDOW_WIN32 (GetProp (hWnd, "gl_window"));
window = GST_GL_WINDOW (window_win32);
context = gst_gl_window_get_context (window);
context_class = GST_GL_CONTEXT_GET_CLASS (context);
g_assert (window_win32->internal_win_id == hWnd);
@ -433,7 +431,7 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PAINTSTRUCT ps;
BeginPaint (hWnd, &ps);
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
EndPaint (hWnd, &ps);
}
break;

View file

@ -358,7 +358,7 @@ _context_draw (GstGLContext * context, GstGLWindow * window)
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_swap_buffers (context);
gst_object_unref (context);
}