## GstGLUtils

GstGLUtils — some miscellaneous utilities for OpenGL

## Functions

gboolean | gst_gl_handle_set_context ()
gboolean | gst_gl_handle_context_query ()
gboolean | gst_gl_ensure_element_data ()
gboolean | gst_gl_query_local_gl_context ()
gsize | gst_gl_get_plane_data_size ()
gsize | gst_gl_get_plane_start ()
GstGLTextureTarget | gst_gl_value_get_texture_target_mask ()
gboolean | gst_gl_value_set_texture_target ()
gboolean | gst_gl_value_set_texture_target_from_mask ()
gboolean | gst_gl_check_extension ()
void | gst_gl_element_propagate_display_context ()

## Includes

    #include <gst/gl/gl.h>

## Description

## Functions

### gst_gl_handle_set_context ()

    gboolean
    gst_gl_handle_set_context (GstElement *element,
                               GstContext *context,
                               GstGLDisplay **display,
                               GstGLContext **other_context);

Helper function for implementing `GstElementClass.set_context()` in OpenGL capable elements.

Retrieve's the GstGLDisplay or GstGLContext in `context` and places the result in `display` or `other_context` respectively.

#### Parameters

element | a GstElement |
context | a GstContext |
display | location of a GstGLDisplay. | [inout][transfer full]
other_context | location of a GstGLContext. | [inout][transfer full]

#### Returns

whether the `display` or `other_context` could be set successfully

### gst_gl_handle_context_query ()

    gboolean
    gst_gl_handle_context_query (GstElement *element,
                                 GstQuery *query,
                                 GstGLDisplay *display,
                                 GstGLContext *context,
                                 GstGLContext *other_context);

#### Parameters

element | a GstElement |
query | a GstQuery of type `GST_QUERY_CONTEXT` |
display | a GstGLDisplay. | [transfer none][nullable]
context | a GstGLContext. | [transfer none][nullable]
other_context | application provided GstGLContext. | [transfer none][nullable]

#### Returns

Whether the `query` was successfully responded to from the passed `display` , `context` , and `other_context` .

### gst_gl_ensure_element_data ()

    gboolean
    gst_gl_ensure_element_data (gpointer element,
                                GstGLDisplay **display_ptr,
                                GstGLContext **other_context_ptr);

Perform the steps necessary for retrieving a GstGLDisplay and (optionally) an application provided GstGLContext from the surrounding elements or from the application using the GstContext mechanism.

If the contents of `display_ptr` or `other_context_ptr` are not `NULL`, then no GstContext query is necessary for GstGLDisplay or GstGLContext retrieval or is performed.

This performs GstContext queries (if necessary) for a winsys display connection with `GST_GL_DISPLAY_CONTEXT_TYPE`, "gst.x11.display.handle", and "GstWaylandDisplayHandleContextType" stopping after the first successful retrieval.

This also performs a GstContext query (if necessary) for an optional application provided GstGLContext using the name "gst.gl.app_context". The returned GstGLContext will be shared with a GStreamer created OpenGL context.

#### Parameters

element | the GstElement running the query |
display_ptr | the resulting GstGLDisplay. | [inout]
other_context_ptr | the resulting GstGLContext. | [inout]

#### Returns

whether a GstGLDisplay exists in `display_ptr`

### gst_gl_query_local_gl_context ()

    gboolean
    gst_gl_query_local_gl_context (GstElement *element,
                                   GstPadDirection direction,
                                   GstGLContext **context_ptr);

Performs a GST_QUERY_CONTEXT query of type "gst.gl.local_context" on all GstPads in `element` of `direction` for the local OpenGL context used by GStreamer elements.

#### Parameters

element | a GstElement to query from |
direction | the GstPadDirection to query |
context_ptr | location containing the current and/or resulting GstGLContext. | [inout]

#### Returns

whether `context_ptr` contains a GstGLContext

### gst_gl_get_plane_data_size ()

    gsize
    gst_gl_get_plane_data_size (GstVideoInfo *info,
                                GstVideoAlignment *align,
                                guint plane);

Retrieve the size in bytes of a video plane of data with a certain alignment

#### Parameters

info | a GstVideoInfo |
align | a GstVideoAlignment or `NULL` |
plane | plane number in `info` to retrieve the data size of |

### gst_gl_get_plane_start ()

    gsize
    gst_gl_get_plane_start (GstVideoInfo *info,
                            GstVideoAlignment *valign,
                            guint plane);

#### Parameters

info | a GstVideoInfo |
valign | a GstVideoAlignment or `NULL` |
plane | plane number in `info` to retrieve the data size of |

#### Returns

difference between the supposed start of the plane from the `info` and where the data from the previous plane ends.

### gst_gl_value_get_texture_target_mask ()

    GstGLTextureTarget
    gst_gl_value_get_texture_target_mask (const GValue *value);

See `gst_gl_value_set_texture_target_from_mask()` for what entails a mask

#### Parameters

value | an initialized GValue of type G_TYPE_STRING |

#### Returns

the mask of GstGLTextureTarget's in `value`

### gst_gl_value_set_texture_target ()

    gboolean
    gst_gl_value_set_texture_target (GValue *value,
                                     GstGLTextureTarget target);

#### Parameters

value | an initialized GValue of type G_TYPE_STRING |
target | a GstGLTextureTarget's |

#### Returns

whether the `target` could be set on `value`

### gst_gl_value_set_texture_target_from_mask ()

    gboolean
    gst_gl_value_set_texture_target_from_mask
                                   (GValue *value,
                                    GstGLTextureTarget target_mask);

A mask is a bitwise OR of (1 << target) where target is a valid GstGLTextureTarget

#### Parameters

value | an uninitialized GValue |
target_mask | a bitwise mask of GstGLTextureTarget's |

#### Returns

whether the `target_mask` could be set on `value`

### gst_gl_check_extension ()

    gboolean
    gst_gl_check_extension (const char *name,
                            const gchar *ext);

#### Parameters

name | the extension to search for |
ext | the list of possible extensions |

#### Returns

whether `name` is in the space seperated list of `ext`

### gst_gl_element_propagate_display_context ()

    void
    gst_gl_element_propagate_display_context
                                   (GstElement *element,
                                    GstGLDisplay *display);

## Types and Values

## See Also

GstGLContext