[607/906] remove get_platform and get_window_handle vfuncs

- rename choose_visual() to choose_format() for later incorporating
  win32 changes and new GstGLPlatform for WGL, EGL, GLX, etc.
This commit is contained in:
Matthew Waters 2012-11-14 20:36:16 +11:00 committed by Tim-Philipp Müller
parent 538643e3c0
commit af658df918
6 changed files with 20 additions and 53 deletions

View file

@ -90,19 +90,6 @@ gst_gl_window_new (GstGLRendererAPI render_api, guintptr external_gl_context)
return window; return window;
} }
GstGLPlatform
gst_gl_window_get_platform (GstGLWindow * window)
{
GstGLWindowClass *window_class;
window_class = GST_GL_WINDOW_GET_CLASS (window);
g_return_val_if_fail (window_class->get_platform != NULL,
GST_GL_PLATFORM_UNKNOWN);
return window_class->get_platform (window);
}
guintptr guintptr
gst_gl_window_get_gl_context (GstGLWindow * window) gst_gl_window_get_gl_context (GstGLWindow * window)
{ {
@ -152,23 +139,6 @@ gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
GST_GL_WINDOW_UNLOCK (window); GST_GL_WINDOW_UNLOCK (window);
} }
guintptr
gst_gl_window_get_window_handle (GstGLWindow * window)
{
GstGLWindowClass *window_class;
guintptr result;
g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0);
window_class = GST_GL_WINDOW_GET_CLASS (window);
g_return_val_if_fail (window_class->get_window_handle != NULL, FALSE);
GST_GL_WINDOW_LOCK (window);
result = window_class->get_window_handle (window);
GST_GL_WINDOW_UNLOCK (window);
return result;
}
void void
gst_gl_window_draw_unlocked (GstGLWindow * window, guint width, guint height) gst_gl_window_draw_unlocked (GstGLWindow * window, guint width, guint height)
{ {

View file

@ -1,6 +1,7 @@
/* /*
* GStreamer * GStreamer
* Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
* Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -23,6 +24,8 @@
#include <gst/gst.h> #include <gst/gst.h>
#include "gstglrenderer.h"
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_GL_TYPE_WINDOW (gst_gl_window_get_type()) #define GST_GL_TYPE_WINDOW (gst_gl_window_get_type())
@ -61,7 +64,8 @@ typedef enum
GST_GL_PLATFORM_GLX, GST_GL_PLATFORM_GLX,
GST_GL_PLATFORM_WGL, GST_GL_PLATFORM_WGL,
GST_GL_PLATFORM_CGL, GST_GL_PLATFORM_CGL,
GST_GL_PLATFORM_ANY = 254,
GST_GL_PLATFORM_LAST = 255 GST_GL_PLATFORM_LAST = 255
} GstGLPlatform; } GstGLPlatform;
@ -93,17 +97,16 @@ struct _GstGLWindow {
struct _GstGLWindowClass { struct _GstGLWindowClass {
/*< private >*/ /*< private >*/
GObjectClass parent_class; GObjectClass parent_class;
guintptr (*get_gl_context) (GstGLWindow *window); guintptr (*get_gl_context) (GstGLWindow *window);
gboolean (*activate) (GstGLWindow *window, gboolean activate); gboolean (*activate) (GstGLWindow *window, gboolean activate);
void (*set_window_handle) (GstGLWindow *window, guintptr id); void (*set_window_handle) (GstGLWindow *window, guintptr id);
guintptr (*get_window_handle) (GstGLWindow *window); gboolean (*share_context) (GstGLWindow *window, guintptr external_gl_context);
void (*draw_unlocked) (GstGLWindow *window, guint width, guint height); void (*draw_unlocked) (GstGLWindow *window, guint width, guint height);
void (*draw) (GstGLWindow *window, guint width, guint height); void (*draw) (GstGLWindow *window, guint width, guint height);
void (*run) (GstGLWindow *window); void (*run) (GstGLWindow *window);
void (*quit) (GstGLWindow *window, GstGLWindowCB callback, gpointer data); void (*quit) (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
void (*send_message) (GstGLWindow *window, GstGLWindowCB callback, gpointer data); void (*send_message) (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
GstGLPlatform (*get_platform) (GstGLWindow *window);
/*< private >*/ /*< private >*/
gpointer _reserved[GST_PADDING]; gpointer _reserved[GST_PADDING];

View file

@ -1,6 +1,7 @@
/* /*
* GStreamer * GStreamer
* Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
* Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -64,7 +65,6 @@ guintptr gst_gl_window_x11_get_gl_context (GstGLWindow * window);
gboolean gst_gl_window_x11_activate (GstGLWindow * window, gboolean activate); gboolean gst_gl_window_x11_activate (GstGLWindow * window, gboolean activate);
void gst_gl_window_x11_set_window_handle (GstGLWindow * window, void gst_gl_window_x11_set_window_handle (GstGLWindow * window,
guintptr handle); guintptr handle);
guintptr gst_gl_window_x11_get_window_handle (GstGLWindow * window);
void gst_gl_window_x11_draw_unlocked (GstGLWindow * window, guint width, void gst_gl_window_x11_draw_unlocked (GstGLWindow * window, guint width,
guint height); guint height);
void gst_gl_window_x11_draw (GstGLWindow * window, guint width, guint height); void gst_gl_window_x11_draw (GstGLWindow * window, guint width, guint height);
@ -196,8 +196,6 @@ gst_gl_window_x11_class_init (GstGLWindowX11Class * klass)
window_class->activate = GST_DEBUG_FUNCPTR (gst_gl_window_x11_activate); window_class->activate = GST_DEBUG_FUNCPTR (gst_gl_window_x11_activate);
window_class->set_window_handle = window_class->set_window_handle =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_window_handle); GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_window_handle);
window_class->get_window_handle =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_window_handle);
window_class->draw_unlocked = window_class->draw_unlocked =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw_unlocked); GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw_unlocked);
window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw);
@ -323,7 +321,7 @@ gst_gl_window_x11_open_device (GstGLWindowX11 * window_x11,
window_x11->connection = ConnectionNumber (window_x11->device); window_x11->connection = ConnectionNumber (window_x11->device);
if (!window_class->choose_visual (window_x11)) { if (!window_class->choose_format (window_x11)) {
GST_WARNING ("Failed to choose XVisual"); GST_WARNING ("Failed to choose XVisual");
goto failure; goto failure;
} }
@ -452,12 +450,6 @@ gst_gl_window_x11_get_gl_context (GstGLWindow * window)
return window_class->get_gl_context (GST_GL_WINDOW_X11 (window)); return window_class->get_gl_context (GST_GL_WINDOW_X11 (window));
} }
guintptr
gst_gl_window_x11_get_window_handle (GstGLWindow * window)
{
return (guintptr) GST_GL_WINDOW_X11 (window)->internal_win_id;
}
static void static void
callback_activate (GstGLWindow * window) callback_activate (GstGLWindow * window)
{ {

View file

@ -80,7 +80,7 @@ struct _GstGLWindowX11Class {
/*< private >*/ /*< private >*/
GstGLWindowClass parent_class; GstGLWindowClass parent_class;
gboolean (*choose_visual) (GstGLWindowX11 *window); gboolean (*choose_format) (GstGLWindowX11 *window);
gboolean (*create_context) (GstGLWindowX11 *window, GstGLRendererAPI render_api, gboolean (*create_context) (GstGLWindowX11 *window, GstGLRendererAPI render_api,
guintptr external_gl_context); guintptr external_gl_context);
void (*swap_buffers) (GstGLWindowX11 *window); void (*swap_buffers) (GstGLWindowX11 *window);

View file

@ -1,6 +1,7 @@
/* /*
* GStreamer * GStreamer
* Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
* Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -45,7 +46,7 @@ static gboolean gst_gl_window_x11_egl_activate (GstGLWindowX11 * window_x11,
static gboolean gst_gl_window_x11_egl_create_context (GstGLWindowX11 * static gboolean gst_gl_window_x11_egl_create_context (GstGLWindowX11 *
window_x11, GstGLRendererAPI render_api, guintptr external_gl_context); window_x11, GstGLRendererAPI render_api, guintptr external_gl_context);
static void gst_gl_window_x11_egl_destroy_context (GstGLWindowX11 * window_x11); static void gst_gl_window_x11_egl_destroy_context (GstGLWindowX11 * window_x11);
static gboolean gst_gl_window_x11_egl_choose_visual (GstGLWindowX11 * static gboolean gst_gl_window_x11_egl_choose_format (GstGLWindowX11 *
window_x11); window_x11);
static GstGLPlatform gst_gl_window_x11_egl_get_platform (GstGLWindow * window); static GstGLPlatform gst_gl_window_x11_egl_get_platform (GstGLWindow * window);
@ -66,8 +67,8 @@ gst_gl_window_x11_egl_class_init (GstGLWindowX11EGLClass * klass)
GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_create_context); GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_create_context);
window_x11_class->destroy_context = window_x11_class->destroy_context =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_destroy_context); GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_destroy_context);
window_x11_class->choose_visual = window_x11_class->choose_format =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_choose_visual); GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_choose_format);
window_x11_class->swap_buffers = window_x11_class->swap_buffers =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_swap_buffers); GST_DEBUG_FUNCPTR (gst_gl_window_x11_egl_swap_buffers);
} }
@ -97,7 +98,7 @@ gst_gl_window_x11_egl_get_platform (GstGLWindow * window)
} }
static gboolean static gboolean
gst_gl_window_x11_egl_choose_visual (GstGLWindowX11 * window_x11) gst_gl_window_x11_egl_choose_format (GstGLWindowX11 * window_x11)
{ {
gint ret; gint ret;

View file

@ -1,6 +1,7 @@
/* /*
* GStreamer * GStreamer
* Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
* Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -45,7 +46,7 @@ static gboolean gst_gl_window_x11_glx_activate (GstGLWindowX11 * window_x11,
static gboolean gst_gl_window_x11_glx_create_context (GstGLWindowX11 * static gboolean gst_gl_window_x11_glx_create_context (GstGLWindowX11 *
window_x11, GstGLRendererAPI render_api, guintptr external_gl_context); window_x11, GstGLRendererAPI render_api, guintptr external_gl_context);
static void gst_gl_window_x11_glx_destroy_context (GstGLWindowX11 * window_x11); static void gst_gl_window_x11_glx_destroy_context (GstGLWindowX11 * window_x11);
static gboolean gst_gl_window_x11_glx_choose_visual (GstGLWindowX11 * static gboolean gst_gl_window_x11_glx_choose_format (GstGLWindowX11 *
window_x11); window_x11);
static void static void
@ -61,8 +62,8 @@ gst_gl_window_x11_glx_class_init (GstGLWindowX11GLXClass * klass)
GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_create_context); GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_create_context);
window_x11_class->destroy_context = window_x11_class->destroy_context =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_destroy_context); GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_destroy_context);
window_x11_class->choose_visual = window_x11_class->choose_format =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_choose_visual); GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_choose_format);
window_x11_class->swap_buffers = window_x11_class->swap_buffers =
GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_swap_buffers); GST_DEBUG_FUNCPTR (gst_gl_window_x11_glx_swap_buffers);
} }
@ -123,7 +124,7 @@ gst_gl_window_x11_glx_destroy_context (GstGLWindowX11 * window_x11)
} }
static gboolean static gboolean
gst_gl_window_x11_glx_choose_visual (GstGLWindowX11 * window_x11) gst_gl_window_x11_glx_choose_format (GstGLWindowX11 * window_x11)
{ {
gint error_base; gint error_base;
gint event_base; gint event_base;