Functions

buffer_add_gl_sync_meta (context, buffer)

buffer_add_gl_sync_meta_full (context, buffer, data)

buffer_pool_config_get_gl_allocation_params (config)

buffer_pool_config_set_gl_allocation_params (config, params)

context_get_gl_display (context)

context_set_gl_display (context, display)

gl_api_from_string (api_s)

gl_api_to_string (api)

gl_base_memory_alloc (allocator, params)

gl_base_memory_error_quark ()

gl_base_memory_init_once ()

gl_buffer_init_once ()

gl_check_extension (name, ext)

gl_config_caveat_to_string (caveat)

gl_config_surface_type_to_string (surface_type)

gl_context_error_quark ()

gl_element_propagate_display_context (element, display)

gl_ensure_element_data (element, display_ptr, other_context_ptr)

gl_format_from_video_info (context, vinfo, plane)

gl_format_is_supported (context, format)

gl_format_type_from_sized_gl_format (format)

gl_format_type_n_bytes (format, type)

gl_get_affine_transformation_meta_as_ndc (meta)

gl_get_plane_data_size (info, align, plane)

gl_get_plane_start (info, valign, plane)

gl_handle_context_query (element, query, display, context, other_context)

gl_handle_set_context (element, context)

gl_memory_init_once ()

gl_memory_pbo_init_once ()

gl_multiply_matrix4 (a, b)

gl_platform_from_string (platform_s)

gl_platform_to_string (platform)

gl_query_local_gl_context (element, direction, context_ptr)

gl_renderbuffer_init_once ()

gl_set_affine_transformation_meta_from_ndc (meta, matrix)

gl_sized_gl_format_from_gl_format_type (context, format, type)

gl_stereo_downmix_mode_get_type ()

gl_sync_meta_api_get_type ()

gl_sync_meta_get_info ()

gl_texture_target_from_gl (target)

gl_texture_target_from_string (str)

gl_texture_target_to_buffer_pool_option (target)

gl_texture_target_to_gl (target)

gl_texture_target_to_string (target)

gl_value_get_texture_target_mask (value)

gl_value_set_texture_target (value, target)

gl_value_set_texture_target_from_mask (value, target_mask)

gl_version_to_glsl_version (gl_api, maj, min)

gl_window_error_quark ()

glsl_error_quark ()

glsl_profile_from_string (string)

glsl_profile_to_string (profile)

glsl_string_get_version_profile (s)

glsl_version_from_string (string)

glsl_version_profile_from_string (string)

glsl_version_profile_to_string (version, profile)

glsl_version_to_string (version)

is_gl_base_memory (mem)

is_gl_buffer (mem)

is_gl_memory (mem)

is_gl_memory_pbo (mem)

is_gl_renderbuffer (mem)

Details

GstGL.buffer_add_gl_sync_meta(context, buffer)[source]
Parameters:
Returns:

the GstGL.GLSyncMeta added to Gst.Buffer

Return type:

GstGL.GLSyncMeta

New in version 1.6.

GstGL.buffer_add_gl_sync_meta_full(context, buffer, data)[source]
Parameters:
Returns:

the GstGL.GLSyncMeta added to Gst.Buffer

Return type:

GstGL.GLSyncMeta

New in version 1.8.

GstGL.buffer_pool_config_get_gl_allocation_params(config)[source]
Parameters:

config (Gst.Structure) – a buffer pool config

Returns:

the currently set GstGL.GLAllocationParams or None

Return type:

GstGL.GLAllocationParams or None

GstGL.buffer_pool_config_set_gl_allocation_params(config, params)[source]
Parameters:

Sets params on config

GstGL.context_get_gl_display(context)[source]
Parameters:

context (Gst.Context) – a Gst.Context

Returns:

Whether display was in context

display:

resulting GstGL.GLDisplay

Return type:

(bool, display: GstGL.GLDisplay or None)

New in version 1.4.

GstGL.context_set_gl_display(context, display)[source]
Parameters:

Sets display on context

New in version 1.4.

GstGL.gl_api_from_string(api_s)[source]
Parameters:

api_s (str) – a space separated string of OpenGL apis

Returns:

The GstGL.GLAPI represented by api_s

Return type:

GstGL.GLAPI

GstGL.gl_api_to_string(api)[source]
Parameters:

api (GstGL.GLAPI) – a GstGL.GLAPI to stringify

Returns:

A space separated string of the OpenGL api’s enabled in api

Return type:

str

GstGL.gl_base_memory_alloc(allocator, params)[source]
Parameters:
Returns:

a new GstGL.GLBaseMemory from allocator with the requested params.

Return type:

GstGL.GLBaseMemory or None

New in version 1.8.

GstGL.gl_base_memory_error_quark()[source]
Returns:

the quark used for GstGL.GLBaseMemory in GLib.Error's

Return type:

int

GstGL.gl_base_memory_init_once()[source]

Initializes the GL Base Memory allocator. It is safe to call this function multiple times. This must be called before any other GstGL.GLBaseMemory operation.

New in version 1.8.

GstGL.gl_buffer_init_once()[source]

Initializes the GL Buffer allocator. It is safe to call this function multiple times. This must be called before any other GstGL.GLBuffer operation.

New in version 1.8.

GstGL.gl_check_extension(name, ext)[source]
Parameters:
  • name (str) – the extension to search for

  • ext (str) – the list of possible extensions

Returns:

whether name is in the space separated list of ext

Return type:

bool

GstGL.gl_config_caveat_to_string(caveat)[source]
Parameters:

caveat (GstGL.GLConfigCaveat) – the GstGL.GLConfigCaveat

Returns:

a string version of caveat or None if caveat does not exist.

Return type:

str or None

New in version 1.20.

GstGL.gl_config_surface_type_to_string(surface_type)[source]
Parameters:

surface_type (GstGL.GLConfigSurfaceType) – the GstGL.GLConfigSurfaceType

Returns:

a string version of caveat or None if surface_type does not exist.

Return type:

str or None

New in version 1.20.

GstGL.gl_context_error_quark()[source]
Returns:

the quark used for GstGL.GLContext in GLib.Error's

Return type:

int

GstGL.gl_element_propagate_display_context(element, display)[source]
Parameters:
GstGL.gl_ensure_element_data(element, display_ptr, other_context_ptr)[source]
Parameters:
Returns:

whether a GstGL.GLDisplay exists in display_ptr

display_ptr:

the resulting GstGL.GLDisplay

other_context_ptr:

the resulting GstGL.GLContext

Return type:

(bool, display_ptr: GstGL.GLDisplay, other_context_ptr: GstGL.GLContext)

Perform the steps necessary for retrieving a GstGL.GLDisplay and (optionally) an application provided GstGL.GLContext from the surrounding elements or from the application using the Gst.Context mechanism.

If the contents of display_ptr or other_context_ptr are not None, then no Gst.Context query is necessary for GstGL.GLDisplay or GstGL.GLContext retrieval or is performed.

This performs Gst.Context queries (if necessary) for a winsys display connection with GstGL.GL_DISPLAY_CONTEXT_TYPE, “gst.x11.display.handle”, and “GstWaylandDisplayHandleContextType” stopping after the first successful retrieval.

This also performs a Gst.Context query (if necessary) for an optional application provided GstGL.GLContext using the name “gst.gl.app_context”. The returned GstGL.GLContext will be shared with a GStreamer created OpenGL context.

GstGL.gl_format_from_video_info(context, vinfo, plane)[source]
Parameters:
Returns:

the GstGL.GLFormat necessary for holding the data in plane of vinfo

Return type:

GstGL.GLFormat

GstGL.gl_format_is_supported(context, format)[source]
Parameters:
Returns:

Whether format is supported by context based on the OpenGL API, version, or available OpenGL extension/s.

Return type:

bool

New in version 1.16.

GstGL.gl_format_type_from_sized_gl_format(format)[source]
Parameters:

format (GstGL.GLFormat) – the sized internal GstGL.GLFormat

Returns:

unsized_format:

location for the resulting unsized GstGL.GLFormat

gl_type:

location for the resulting GL type

Return type:

(unsized_format: GstGL.GLFormat, gl_type: int)

Get the unsized format and type from format for usage in glReadPixels, glTex{Sub}Image*, glTexImage* and similar functions.

New in version 1.16.

GstGL.gl_format_type_n_bytes(format, type)[source]
Parameters:
  • format (int) – the OpenGL format, GL_RGBA, GL_LUMINANCE, etc

  • type (int) – the OpenGL type, GL_UNSIGNED_BYTE, GL_FLOAT, etc

Returns:

the number of bytes the specified format, type combination takes per pixel

Return type:

int

GstGL.gl_get_affine_transformation_meta_as_ndc(meta)[source]
Parameters:

meta (GstVideo.VideoAffineTransformationMeta or None) – a GstVideo.VideoAffineTransformationMeta

Returns:

result of the 4x4 matrix

Return type:

matrix: [float]

Retrieves the stored 4x4 affine transformation matrix stored in meta in NDC coordinates. if meta is None, an identity matrix is returned.

NDC is a left-handed coordinate system

  • x - [-1, 1] - +ve X moves right

  • y - [-1, 1] - +ve Y moves up

  • z - [-1, 1] - +ve Z moves into

New in version 1.20.

GstGL.gl_get_plane_data_size(info, align, plane)[source]
Parameters:
Return type:

int

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

GstGL.gl_get_plane_start(info, valign, plane)[source]
Parameters:
Returns:

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

Return type:

int

GstGL.gl_handle_context_query(element, query, display, context, other_context)[source]
Parameters:
Returns:

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

Return type:

bool

GstGL.gl_handle_set_context(element, context)[source]
Parameters:
Returns:

whether the display or other_context could be set successfully

display:

location of a GstGL.GLDisplay

other_context:

location of a GstGL.GLContext

Return type:

(bool, display: GstGL.GLDisplay, other_context: GstGL.GLContext)

Helper function for implementing Gst.Element.do_set_context() in OpenGL capable elements.

Retrieve’s the GstGL.GLDisplay or GstGL.GLContext in context and places the result in display or other_context respectively.

GstGL.gl_memory_init_once()[source]

Initializes the GL Base Texture allocator. It is safe to call this function multiple times. This must be called before any other GstGL.GLMemory operation.

New in version 1.4.

GstGL.gl_memory_pbo_init_once()[source]
GstGL.gl_multiply_matrix4(a, b)[source]
Parameters:
  • a ([float]) – a 2-dimensional 4x4 array of float

  • b ([float]) – another 2-dimensional 4x4 array of float

Returns:

the result of the multiplication

Return type:

result: [float]

Multiplies two 4x4 matrices, a and b, and stores the result, a 2-dimensional array of float, in result.

New in version 1.20.

GstGL.gl_platform_from_string(platform_s)[source]
Parameters:

platform_s (str) – a space separated string of OpenGL platformss

Returns:

The GstGL.GLPlatform represented by platform_s

Return type:

GstGL.GLPlatform

GstGL.gl_platform_to_string(platform)[source]
Parameters:

platform (GstGL.GLPlatform) – a GstGL.GLPlatform to stringify

Returns:

A space separated string of the OpenGL platforms enabled in platform

Return type:

str

GstGL.gl_query_local_gl_context(element, direction, context_ptr)[source]
Parameters:
Returns:

whether context_ptr contains a GstGL.GLContext

context_ptr:

location containing the current and/or resulting GstGL.GLContext

Return type:

(bool, context_ptr: GstGL.GLContext)

Performs a Gst.QueryType.CONTEXT query of type “gst.gl.local_context” on all Gst.Pads in element of direction for the local OpenGL context used by GStreamer elements.

GstGL.gl_renderbuffer_init_once()[source]

Initializes the GL Base Texture allocator. It is safe to call this function multiple times. This must be called before any other GstGL.GLRenderbuffer operation.

New in version 1.10.

GstGL.gl_set_affine_transformation_meta_from_ndc(meta, matrix)[source]
Parameters:

Set the 4x4 affine transformation matrix stored in meta from the NDC coordinates in matrix.

New in version 1.20.

GstGL.gl_sized_gl_format_from_gl_format_type(context, format, type)[source]
Parameters:
Returns:

the sized internal format specified by format and type that can be used in context

Return type:

int

GstGL.gl_stereo_downmix_mode_get_type()[source]
Return type:

GObject.GType

GstGL.gl_sync_meta_api_get_type()[source]
Return type:

GObject.GType

GstGL.gl_sync_meta_get_info()[source]
Return type:

Gst.MetaInfo

GstGL.gl_texture_target_from_gl(target)[source]
Parameters:

target (int) – an OpenGL texture binding target

Returns:

the GstGL.GLTextureTarget that’s equiavalant to target or GstGL.GLTextureTarget.NONE

Return type:

GstGL.GLTextureTarget

GstGL.gl_texture_target_from_string(str)[source]
Parameters:

str (str) – a string equivalent to one of the GST_GL_TEXTURE_TARGET_*_STR values

Returns:

the GstGL.GLTextureTarget represented by str or GstGL.GLTextureTarget.NONE

Return type:

GstGL.GLTextureTarget

GstGL.gl_texture_target_to_buffer_pool_option(target)[source]
Parameters:

target (GstGL.GLTextureTarget) – a GstGL.GLTextureTarget

Returns:

a string representing the GstBufferPoolOption specified by target

Return type:

str or None

GstGL.gl_texture_target_to_gl(target)[source]
Parameters:

target (GstGL.GLTextureTarget) – a GstGL.GLTextureTarget

Returns:

the OpenGL value for binding the target with glBindTexture() and similar functions or 0

Return type:

int

GstGL.gl_texture_target_to_string(target)[source]
Parameters:

target (GstGL.GLTextureTarget) – a GstGL.GLTextureTarget

Returns:

the stringified version of target or None

Return type:

str or None

GstGL.gl_value_get_texture_target_mask(value)[source]
Parameters:

value (GObject.Value) – an initialized GObject.Value of type GObject.TYPE_STRING

Returns:

the mask of GstGL.GLTextureTarget's in value or GstGL.GLTextureTarget.NONE on failure

Return type:

GstGL.GLTextureTarget

See GstGL.gl_value_set_texture_target_from_mask() for what entails a mask

GstGL.gl_value_set_texture_target(value, target)[source]
Parameters:
Returns:

whether the target could be set on value

Return type:

bool

GstGL.gl_value_set_texture_target_from_mask(value, target_mask)[source]
Parameters:
Returns:

whether the target_mask could be set on value

Return type:

bool

A mask is a bitwise OR of (1 << target) where target is a valid GstGL.GLTextureTarget

GstGL.gl_version_to_glsl_version(gl_api, maj, min)[source]
Parameters:
Returns:

The minimum supported GstGL.GLSLVersion available for gl_api, maj and min

Return type:

GstGL.GLSLVersion

GstGL.gl_window_error_quark()[source]
Returns:

the quark used for GstGL.GLWindow in GLib.Error's

Return type:

int

GstGL.glsl_error_quark()[source]
Returns:

the quark used for GstGLSL in GLib.Error's

Return type:

int

GstGL.glsl_profile_from_string(string)[source]
Parameters:

string (str) – a GLSL version string

Returns:

the GstGL.GLSLProfile of string or GstGL.GLSLProfile.NONE on error

Return type:

GstGL.GLSLProfile

GstGL.glsl_profile_to_string(profile)[source]
Parameters:

profile (GstGL.GLSLProfile) – a GstGL.GLSLProfile

Returns:

the name for profile or None on error

Return type:

str or None

GstGL.glsl_string_get_version_profile(s)[source]
Parameters:

s (str) – string to search for a valid #version string

Returns:

True if a valid #version string was found, False otherwise

version:

resulting GstGL.GLSLVersion

profile:

resulting GstGL.GLSLProfile

Return type:

(bool, version: GstGL.GLSLVersion, profile: GstGL.GLSLProfile)

Note: this function first searches the first 1 kilobytes for a #version preprocessor directive and then executes GstGL.GLSLVersion.profile_from_string().

GstGL.glsl_version_from_string(string)[source]
Parameters:

string (str) – a GLSL version string

Returns:

the GstGL.GLSLVersion of string or GstGL.GLSLVersion.NONE on error

Return type:

GstGL.GLSLVersion

GstGL.glsl_version_profile_from_string(string)[source]
Parameters:

string (str) – a valid GLSL #version string

Returns:

True if a valid #version string was found, False otherwise

version_ret:

resulting GstGL.GLSLVersion

profile_ret:

resulting GstGL.GLSLVersion

Return type:

(bool, version_ret: GstGL.GLSLVersion, profile_ret: GstGL.GLSLProfile)

Note: this function expects either a #version GLSL preprocesser directive or a valid GLSL version and/or profile.

GstGL.glsl_version_profile_to_string(version, profile)[source]
Parameters:
Returns:

the combined GLSL #version string for version and profile

Return type:

str or None

GstGL.glsl_version_to_string(version)[source]
Parameters:

version (GstGL.GLSLVersion) – a GstGL.GLSLVersion

Returns:

the name of version or None on error

Return type:

str or None

GstGL.is_gl_base_memory(mem)[source]
Parameters:

mem (Gst.Memory) – a Gst.Memory

Returns:

whether the memory at mem is a GstGL.GLBaseMemory

Return type:

bool

New in version 1.8.

GstGL.is_gl_buffer(mem)[source]
Parameters:

mem (Gst.Memory) – a Gst.Memory

Returns:

whether the memory at mem is a GstGL.GLBuffer

Return type:

bool

New in version 1.8.

GstGL.is_gl_memory(mem)[source]
Parameters:

mem (Gst.Memory) – a Gst.Memory

Returns:

whether the memory at mem is a GstGL.GLMemory

Return type:

bool

New in version 1.4.

GstGL.is_gl_memory_pbo(mem)[source]
Parameters:

mem (Gst.Memory) – a Gst.Memory

Returns:

whether the memory at mem is a GstGL.GLMemoryPBO

Return type:

bool

New in version 1.8.

GstGL.is_gl_renderbuffer(mem)[source]
Parameters:

mem (Gst.Memory) – a Gst.Memory

Returns:

whether the memory at mem is a GstGL.GLRenderbuffer

Return type:

bool

New in version 1.10.