## GstGLDisplay GstGLDisplay — window system display connection abstraction |

## Functions

GstGLDisplay * | gst_gl_display_new ()
GstGLDisplayType | gst_gl_display_get_handle_type ()
void | gst_gl_display_filter_gl_api ()
GstGLAPI | gst_gl_display_get_gl_api ()
gboolean | gst_gl_display_add_context ()
GstGLContext * | gst_gl_display_get_gl_context_for_thread ()
guintptr | gst_gl_display_get_handle ()
gboolean | gst_gl_display_create_context ()
GstGLWindow * | gst_gl_display_create_window ()
GstGLWindow * | gst_gl_display_find_window ()
gboolean | gst_gl_display_remove_window ()
gboolean | gst_context_get_gl_display ()
void | gst_context_set_gl_display ()

## Signals

GstGLContext* | create-context | Run Last

## Types and Values

#define | GST_GL_DISPLAY_CONTEXT_TYPE
enum | GstGLDisplayType
| GstGLDisplay

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstGLDisplay

## Includes

    #include <gst/gl/gl.h>

## Description

GstGLDisplay represents a connection to the underlying windowing system. Elements are required to make use of GstContext to share and propogate a GstGLDisplay.

There are a number of environment variables that influence the choice of platform and window system specific functionality.

- GST_GL_WINDOW influences the window system to use. Common values are 'x11', 'wayland', 'win32' or 'cocoa'.

- GST_GL_PLATFORM influences the OpenGL platform to use. Common values are 'egl', 'glx', 'wgl' or 'cgl'.

- GST_GL_API influences the OpenGL API requested by the OpenGL platform. Common values are 'opengl', 'opengl3' and 'gles2'.

> Certain window systems require a special function to be called to initialize threading support. As this GStreamer GL library does not preclude concurrent access to the windowing system, it is strongly advised that applications ensure that threading support has been initialized before any other toolkit/library functionality is accessed. Failure to do so could result in sudden application abortion during execution. The most notably example of such a function is X11's `XInitThreads()`.

## Functions

### gst_gl_display_new ()

    GstGLDisplay *
    gst_gl_display_new (void);

#### Returns

a new GstGLDisplay.

[transfer full]

Since: 1.4

### gst_gl_display_get_handle_type ()

    GstGLDisplayType
    gst_gl_display_get_handle_type (GstGLDisplay *display);

#### Parameters

display | a GstGLDisplay |

#### Returns

the GstGLDisplayType of `display`

Since: 1.4

### gst_gl_display_filter_gl_api ()

    void
    gst_gl_display_filter_gl_api (GstGLDisplay *display,
                                  GstGLAPI gl_api);

limit the use of OpenGL to the requested `gl_api` . This is intended to allow application and elements to request a specific set of OpenGL API's based on what they support. See `gst_gl_context_get_gl_api()` for the retreiving the API supported by a GstGLContext.

#### Parameters

display | a GstGLDisplay |
gl_api | a GstGLAPI to filter with |

### gst_gl_display_get_gl_api ()

    GstGLAPI
    gst_gl_display_get_gl_api (GstGLDisplay *display);

see `gst_gl_display_filter_gl_api()` for what the returned value represents

#### Parameters

display | a GstGLDisplay |

#### Returns

the GstGLAPI configured for `display`

### gst_gl_display_add_context ()

    gboolean
    gst_gl_display_add_context (GstGLDisplay *display,
                                GstGLContext *context);

#### Parameters

display | a GstGLDisplay |
context | a GstGLContext. | [transfer none]

#### Returns

whether `context` was successfully added. `FALSE` may be returned if there already exists another context for `context` 's active thread.

Must be called with the object lock held.

Since: 1.6

### gst_gl_display_get_gl_context_for_thread ()

    GstGLContext *
    gst_gl_display_get_gl_context_for_thread
                                   (GstGLDisplay *display,
                                    GThread *thread);

#### Parameters

display | a GstGLDisplay |
thread | a GThread |

#### Returns

the GstGLContext current on `thread` or `NULL`

Must be called with the object lock held.

[transfer full]

Since: 1.6

### gst_gl_display_get_handle ()

    guintptr
    gst_gl_display_get_handle (GstGLDisplay *display);

#### Parameters

display | a GstGLDisplay |

#### Returns

the native handle for the display

Since: 1.4

### gst_gl_display_create_context ()

    gboolean
    gst_gl_display_create_context (GstGLDisplay *display,
                                   GstGLContext *other_context,
                                   GstGLContext **p_context,
                                   GError **error);

It requires the display's object lock to be held.

#### Parameters

display | a GstGLDisplay |
other_context | other GstGLContext to share resources with. | [transfer none]
p_context | resulting GstGLContext. | [transfer full][out]
error | resulting GError. | [allow-none]

#### Returns

whether a new context could be created.

Since: 1.6

### gst_gl_display_create_window ()

    GstGLWindow *
    gst_gl_display_create_window (GstGLDisplay *display);

It requires the display's object lock to be held.

#### Parameters

display | a GstGLDisplay |

#### Returns

a new GstGLWindow for `display` or `NULL`.

[transfer full]

### gst_gl_display_find_window ()

    GstGLWindow *
    gst_gl_display_find_window (GstGLDisplay *display,
                                gpointer data,
                                GCompareFunc compare_func);

Execute `compare_func` over the list of windows stored by `display` . The first argment to `compare_func` is the GstGLWindow being checked and the second argument is `data` .

#### Parameters

display | a GstGLDisplay |
data | some data to pass to `compare_func` . | [closure]
compare_func | a comparison function to run. | [scope call]

#### Returns

The first GstGLWindow that causes a match from `compare_func` .

[transfer none]

Since: 1.12

### gst_gl_display_remove_window ()

    gboolean
    gst_gl_display_remove_window (GstGLDisplay *display,
                                  GstGLWindow *window);

#### Parameters

display | a GstGLDisplay |
window | a GstGLWindow to remove |

#### Returns

if `window` could be removed from `display`

Since: 1.12

### gst_context_get_gl_display ()

    gboolean
    gst_context_get_gl_display (GstContext *context,
                                GstGLDisplay **display);

#### Parameters

context | a GstContext |
display | resulting GstGLDisplay. | [out][transfer full]

#### Returns

Whether `display` was in `context`

Since: 1.4

### gst_context_set_gl_display ()

    void
    gst_context_set_gl_display (GstContext *context,
                                GstGLDisplay *display);

Sets `display` on `context`

#### Parameters

context | a GstContext |
display | resulting GstGLDisplay. | [transfer none]

Since: 1.4

## Types and Values

### GST_GL_DISPLAY_CONTEXT_TYPE

    #define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay"

The name used in GstContext queries for requesting a GstGLDisplay

### enum GstGLDisplayType

#### Members

GST_GL_DISPLAY_TYPE_NONE | no display type |
GST_GL_DISPLAY_TYPE_X11 | X11 display |
GST_GL_DISPLAY_TYPE_WAYLAND | Wayland display |
GST_GL_DISPLAY_TYPE_COCOA | Cocoa display |
GST_GL_DISPLAY_TYPE_WIN32 | Win32 display |
GST_GL_DISPLAY_TYPE_DISPMANX | Dispmanx display |
GST_GL_DISPLAY_TYPE_EGL | EGL display |
GST_GL_DISPLAY_TYPE_VIV_FB | Vivante Framebuffer display |
GST_GL_DISPLAY_TYPE_GBM | Mesa3D GBM display |
GST_GL_DISPLAY_TYPE_ANY | any display type |

### GstGLDisplay

    typedef struct _GstGLDisplay GstGLDisplay;

The contents of a GstGLDisplay are private and should only be accessed through the provided API

## Signal Details

### The `“create-context”` signal

    GstGLContext*
    user_function (GstGLDisplay *object,
                   GstGLContext *context,
                   gpointer      user_data)

Overrides the `GstGLContext` creation mechanism. It can be called in any thread and it is emitted with display's object lock held.

#### Parameters

object | the GstGLDisplay |
context | other context to share resources with. | [transfer none]
user_data | user data set when the signal handler was connected. |

#### Returns

the new context.

[transfer full]

Flags: Run Last

## See Also

GstContext, GstGLContext, GstGLWindow