GstGLContext

GstGLContext — OpenGL context abstraction

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GstGLContext

Description

GstGLContext wraps an OpenGL context object in a uniform API. As a result of the limitation on OpenGL context, this object is not thread safe unless specified and must only be activated in a single thread.

Functions

GST_GL_CONTEXT_ERROR

#define GST_GL_CONTEXT_ERROR (gst_gl_context_error_quark ())

gst_gl_context_error_quark ()

GQuark
gst_gl_context_error_quark (void);

GstGLContextThreadFunc ()

void
(*GstGLContextThreadFunc) (GstGLContext *context,
                           gpointer data);

Represents a function to run in the GL thread with context and data

Parameters

context

a GstGLContext

 

data

user data

 

gst_gl_context_new ()

GstGLContext *
gst_gl_context_new (GstGLDisplay *display);

Create a new GstGLContext with the specified display

Parameters

display

a GstGLDisplay

 

Returns

a new GstGLContext


gst_gl_context_create ()

gboolean
gst_gl_context_create (GstGLContext *context,
                       GstGLContext *other_context,
                       GError **error);

Creates an OpenGL context in the current thread with the specified other_context as a context to share shareable OpenGL objects with. See the OpenGL specification for what is shared between contexts.

If an error occurs, and error is not NULL, then error will contain details of the error and FALSE will be returned.

Should only be called once.

Parameters

context

a GstGLContext:

 

other_context

a GstGLContext to share OpenGL objects with.

[allow-none]

error

a GError.

[allow-none]

Returns

whether the context could successfully be created


gst_gl_context_activate ()

gboolean
gst_gl_context_activate (GstGLContext *context,
                         gboolean activate);

(De)activate the OpenGL context represented by this context .

In OpenGL terms, calls eglMakeCurrent or similar with this context and the currently set window. See gst_gl_context_set_window() for details.

Parameters

context

a GstGLContext

 

activate

TRUE to activate, FALSE to deactivate

 

Returns

Whether the activation succeeded


gst_gl_context_default_get_proc_address ()

gpointer
gst_gl_context_default_get_proc_address
                               (GstGLContext *context,
                                const gchar *name);

gst_gl_context_get_proc_address ()

gpointer
gst_gl_context_get_proc_address (GstGLContext *context,
                                 const gchar *name);

Get a function pointer to a specified opengl function, name . If the the specific function does not exist, NULL is returned instead.

Platform specfic functions (names starting 'egl', 'glX', 'wgl', etc) can also be retreived using this method.

Parameters

context

a GstGLContext

 

name

an opengl function name

 

Returns

a function pointer or NULL


gst_gl_context_get_window ()

GstGLWindow *
gst_gl_context_get_window (GstGLContext *context);

Parameters

context

a GstGLContext

 

Returns

the currently set window


gst_gl_context_set_window ()

gboolean
gst_gl_context_set_window (GstGLContext *context,
                           GstGLWindow *window);

Set's the current window on context to window . The window can only be changed before gst_gl_context_create() has been called and the window is not already running.

Parameters

context

a GstGLContext

 

window

a GstGLWindow.

[transfer full]

Returns

Whether the window was successfully updated


gst_gl_context_thread_add ()

void
gst_gl_context_thread_add (GstGLContext *context,
                           GstGLContextThreadFunc func,
                           gpointer data);

Execute func in the OpenGL thread of context with data

MT-safe

Parameters

context

a GstGLContext

 

func

a GstGLContextThreadFunc

 

data

user data to call func with.

[closure]

gst_gl_context_get_display ()

GstGLDisplay *
gst_gl_context_get_display (GstGLContext *context);

Parameters

context

a GstGLContext:

 

Returns

the GstGLDisplay associated with this context


gst_gl_context_get_gl_api ()

GstGLAPI
gst_gl_context_get_gl_api (GstGLContext *context);

Get the currently enabled OpenGL api.

The currently available API may be limited by the GstGLDisplay in use and/or the GstGLWindow chosen.

Parameters

context

a GstGLContext

 

Returns

the currently available OpenGL api


gst_gl_context_get_gl_context ()

guintptr
gst_gl_context_get_gl_context (GstGLContext *context);

Gets the backing OpenGL context used by context .

Parameters

context

a GstGLContext:

 

Returns

The platform specific backing OpenGL context

Types and Values

enum GstGLContextError

Members

GST_GL_CONTEXT_ERROR_FAILED

   

GST_GL_CONTEXT_ERROR_WRONG_CONFIG

   

GST_GL_CONTEXT_ERROR_WRONG_API

   

GST_GL_CONTEXT_ERROR_OLD_LIBS

   

GST_GL_CONTEXT_ERROR_CREATE_CONTEXT

   

GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE

   

GstGLContext

typedef struct _GstGLContext GstGLContext;

Opaque GstGLContext object

See Also

GstGLDisplay, GstGLWindow