Functions¶
Details¶
- GstGL.buffer_add_gl_sync_meta(context, buffer)[source]¶
- Parameters:
context (
GstGL.GLContext
) – aGstGL.GLContext
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstGL.GLSyncMeta
added toGst.Buffer
- Return type:
New in version 1.6.
- GstGL.buffer_add_gl_sync_meta_full(context, buffer, data)[source]¶
- Parameters:
context (
GstGL.GLContext
) – aGstGL.GLContext
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstGL.GLSyncMeta
added toGst.Buffer
- Return type:
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
orNone
- Return type:
- GstGL.buffer_pool_config_set_gl_allocation_params(config, params)[source]¶
- Parameters:
config (
Gst.Structure
) – a buffer pool configparams (
GstGL.GLAllocationParams
orNone
) – aGstGL.GLAllocationParams
Sets params on config
- GstGL.context_get_gl_display(context)[source]¶
- Parameters:
context (
Gst.Context
) – aGst.Context
- Returns:
Whether display was in context
- display:
resulting
GstGL.GLDisplay
- Return type:
(
bool
, display:GstGL.GLDisplay
orNone
)
New in version 1.4.
- GstGL.context_set_gl_display(context, display)[source]¶
- Parameters:
context (
Gst.Context
) – aGst.Context
display (
GstGL.GLDisplay
orNone
) – resultingGstGL.GLDisplay
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.gl_api_to_string(api)[source]¶
- Parameters:
api (
GstGL.GLAPI
) – aGstGL.GLAPI
to stringify- Returns:
A space separated string of the OpenGL api’s enabled in api
- Return type:
- GstGL.gl_base_memory_alloc(allocator, params)[source]¶
- Parameters:
allocator (
GstGL.GLBaseMemoryAllocator
) – aGstGL.GLBaseMemoryAllocator
params (
GstGL.GLAllocationParams
) – theGstGL.GLAllocationParams
to allocate the memory with
- Returns:
a new
GstGL.GLBaseMemory
from allocator with the requested params.- Return type:
New in version 1.8.
- GstGL.gl_base_memory_error_quark()[source]¶
- Returns:
the quark used for
GstGL.GLBaseMemory
inGLib.Error
's- Return type:
- 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_config_caveat_to_string(caveat)[source]¶
- Parameters:
caveat (
GstGL.GLConfigCaveat
) – theGstGL.GLConfigCaveat
- Returns:
a string version of caveat or
None
if caveat does not exist.- Return type:
New in version 1.20.
- GstGL.gl_config_surface_type_to_string(surface_type)[source]¶
- Parameters:
surface_type (
GstGL.GLConfigSurfaceType
) – theGstGL.GLConfigSurfaceType
- Returns:
a string version of caveat or
None
if surface_type does not exist.- Return type:
New in version 1.20.
- GstGL.gl_context_error_quark()[source]¶
- Returns:
the quark used for
GstGL.GLContext
inGLib.Error
's- Return type:
- GstGL.gl_element_propagate_display_context(element, display)[source]¶
- Parameters:
element (
Gst.Element
) –display (
GstGL.GLDisplay
) –
- GstGL.gl_ensure_element_data(element, display_ptr, other_context_ptr)[source]¶
- Parameters:
element (
Gst.Element
) – theGst.Element
running the querydisplay_ptr (
GstGL.GLDisplay
) – the resultingGstGL.GLDisplay
other_context_ptr (
GstGL.GLContext
) – the resultingGstGL.GLContext
- 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 providedGstGL.GLContext
from the surrounding elements or from the application using theGst.Context
mechanism.If the contents of display_ptr or other_context_ptr are not
None
, then noGst.Context
query is necessary forGstGL.GLDisplay
orGstGL.GLContext
retrieval or is performed.This performs
Gst.Context
queries (if necessary) for a winsys display connection withGstGL.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 providedGstGL.GLContext
using the name “gst.gl.app_context”. The returnedGstGL.GLContext
will be shared with a GStreamer created OpenGL context.
- GstGL.gl_format_from_video_info(context, vinfo, plane)[source]¶
- Parameters:
context (
GstGL.GLContext
) – aGstGL.GLContext
vinfo (
GstVideo.VideoInfo
) – aGstVideo.VideoInfo
plane (
int
) – the plane number in vinfo
- Returns:
the
GstGL.GLFormat
necessary for holding the data in plane of vinfo- Return type:
- GstGL.gl_format_is_supported(context, format)[source]¶
- Parameters:
context (
GstGL.GLContext
) – aGstGL.GLContext
format (
GstGL.GLFormat
) – theGstGL.GLFormat
to check is supported by context
- Returns:
Whether format is supported by context based on the OpenGL API, version, or available OpenGL extension/s.
- Return type:
New in version 1.16.
- GstGL.gl_format_type_from_sized_gl_format(format)[source]¶
- Parameters:
format (
GstGL.GLFormat
) – the sized internalGstGL.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_get_affine_transformation_meta_as_ndc(meta)[source]¶
- Parameters:
meta (
GstVideo.VideoAffineTransformationMeta
orNone
) – aGstVideo.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:
info (
GstVideo.VideoInfo
) – aGstVideo.VideoInfo
align (
GstVideo.VideoAlignment
) – aGstVideo.VideoAlignment
orNone
plane (
int
) – plane number in info to retrieve the data size of
- Return type:
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:
info (
GstVideo.VideoInfo
) – aGstVideo.VideoInfo
valign (
GstVideo.VideoAlignment
) – aGstVideo.VideoAlignment
orNone
plane (
int
) – 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.
- Return type:
- GstGL.gl_handle_context_query(element, query, display, context, other_context)[source]¶
- Parameters:
element (
Gst.Element
) – aGst.Element
query (
Gst.Query
) – aGst.Query
of typeGst.QueryType.CONTEXT
display (
GstGL.GLDisplay
orNone
) – aGstGL.GLDisplay
context (
GstGL.GLContext
orNone
) – aGstGL.GLContext
other_context (
GstGL.GLContext
orNone
) – application providedGstGL.GLContext
- Returns:
Whether the query was successfully responded to from the passed display, context, and other_context.
- Return type:
- GstGL.gl_handle_set_context(element, context)[source]¶
- Parameters:
element (
Gst.Element
) – aGst.Element
context (
Gst.Context
) – aGst.Context
- 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
orGstGL.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_multiply_matrix4(a, b)[source]¶
- Parameters:
- 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.gl_platform_to_string(platform)[source]¶
- Parameters:
platform (
GstGL.GLPlatform
) – aGstGL.GLPlatform
to stringify- Returns:
A space separated string of the OpenGL platforms enabled in platform
- Return type:
- GstGL.gl_query_local_gl_context(element, direction, context_ptr)[source]¶
- Parameters:
element (
Gst.Element
) – aGst.Element
to query fromdirection (
Gst.PadDirection
) – theGst.PadDirection
to querycontext_ptr (
GstGL.GLContext
) – location containing the current and/or resultingGstGL.GLContext
- 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 allGst.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:
meta (
GstVideo.VideoAffineTransformationMeta
) – aGstVideo.VideoAffineTransformationMeta
matrix ([
float
]) – a 4x4 matrix
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:
context (
GstGL.GLContext
) – aGstGL.GLContext
format (
int
) – an OpenGL format,GL_RGBA
,GL_LUMINANCE
, etctype (
int
) – an OpenGL type,GL_UNSIGNED_BYTE
,GL_FLOAT
, etc
- Returns:
the sized internal format specified by format and type that can be used in context
- Return type:
- 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 orGstGL.GLTextureTarget.NONE
- Return type:
- 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 orGstGL.GLTextureTarget.NONE
- Return type:
- GstGL.gl_texture_target_to_buffer_pool_option(target)[source]¶
- Parameters:
target (
GstGL.GLTextureTarget
) – aGstGL.GLTextureTarget
- Returns:
a string representing the GstBufferPoolOption specified by target
- Return type:
- GstGL.gl_texture_target_to_gl(target)[source]¶
- Parameters:
target (
GstGL.GLTextureTarget
) – aGstGL.GLTextureTarget
- Returns:
the OpenGL value for binding the target with glBindTexture() and similar functions or 0
- Return type:
- GstGL.gl_texture_target_to_string(target)[source]¶
- Parameters:
target (
GstGL.GLTextureTarget
) – aGstGL.GLTextureTarget
- Returns:
the stringified version of target or
None
- Return type:
- GstGL.gl_value_get_texture_target_mask(value)[source]¶
- Parameters:
value (
GObject.Value
) – an initializedGObject.Value
of typeGObject.TYPE_STRING
- Returns:
the mask of
GstGL.GLTextureTarget
's in value orGstGL.GLTextureTarget.NONE
on failure- Return type:
See
GstGL.gl_value_set_texture_target_from_mask
() for what entails a mask
- GstGL.gl_value_set_texture_target(value, target)[source]¶
- Parameters:
value (
GObject.Value
) – an initializedGObject.Value
of typeGObject.TYPE_STRING
target (
GstGL.GLTextureTarget
) – aGstGL.GLTextureTarget
's
- Returns:
whether the target could be set on value
- Return type:
- GstGL.gl_value_set_texture_target_from_mask(value, target_mask)[source]¶
- Parameters:
value (
GObject.Value
) – an uninitializedGObject.Value
target_mask (
GstGL.GLTextureTarget
) – a bitwise mask ofGstGL.GLTextureTarget
's
- Returns:
whether the target_mask could be set on value
- Return type:
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:
gl_api (
GstGL.GLAPI
) – theGstGL.GLAPI
maj (
int
) – the major GL versionmin (
int
) – the minor GL version
- Returns:
The minimum supported
GstGL.GLSLVersion
available for gl_api, maj and min- Return type:
- GstGL.gl_window_error_quark()[source]¶
- Returns:
the quark used for
GstGL.GLWindow
inGLib.Error
's- Return type:
- GstGL.glsl_error_quark()[source]¶
- Returns:
the quark used for GstGLSL in
GLib.Error
's- Return type:
- GstGL.glsl_profile_from_string(string)[source]¶
- Parameters:
string (
str
) – a GLSL version string- Returns:
the
GstGL.GLSLProfile
of string orGstGL.GLSLProfile.NONE
on error- Return type:
- GstGL.glsl_profile_to_string(profile)[source]¶
- Parameters:
profile (
GstGL.GLSLProfile
) – aGstGL.GLSLProfile
- Returns:
the name for profile or
None
on error- Return type:
- 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 executesGstGL.GLSLVersion.profile_from_string
().
- GstGL.glsl_version_from_string(string)[source]¶
- Parameters:
string (
str
) – a GLSL version string- Returns:
the
GstGL.GLSLVersion
of string orGstGL.GLSLVersion.NONE
on error- Return type:
- 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:
version (
GstGL.GLSLVersion
) – aGstGL.GLSLVersion
profile (
GstGL.GLSLProfile
) – aGstGL.GLSLVersion
- Returns:
the combined GLSL
#version
string for version and profile- Return type:
- GstGL.glsl_version_to_string(version)[source]¶
- Parameters:
version (
GstGL.GLSLVersion
) – aGstGL.GLSLVersion
- Returns:
the name of version or
None
on error- Return type:
- GstGL.is_gl_base_memory(mem)[source]¶
- Parameters:
mem (
Gst.Memory
) – aGst.Memory
- Returns:
whether the memory at mem is a
GstGL.GLBaseMemory
- Return type:
New in version 1.8.
- GstGL.is_gl_buffer(mem)[source]¶
- Parameters:
mem (
Gst.Memory
) – aGst.Memory
- Returns:
whether the memory at mem is a
GstGL.GLBuffer
- Return type:
New in version 1.8.
- GstGL.is_gl_memory(mem)[source]¶
- Parameters:
mem (
Gst.Memory
) – aGst.Memory
- Returns:
whether the memory at mem is a
GstGL.GLMemory
- Return type:
New in version 1.4.
- GstGL.is_gl_memory_pbo(mem)[source]¶
- Parameters:
mem (
Gst.Memory
) – aGst.Memory
- Returns:
whether the memory at mem is a
GstGL.GLMemoryPBO
- Return type:
New in version 1.8.
- GstGL.is_gl_renderbuffer(mem)[source]¶
- Parameters:
mem (
Gst.Memory
) – aGst.Memory
- Returns:
whether the memory at mem is a
GstGL.GLRenderbuffer
- Return type:
New in version 1.10.