Functions¶
Details¶
- GstGL.buffer_add_gl_sync_meta(context, buffer)[source]¶
- Parameters:
context (
GstGL.GLContext) – aGstGL.GLContextbuffer (
Gst.Buffer) – aGst.Buffer
- Returns:
the
GstGL.GLSyncMetaadded 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.GLContextbuffer (
Gst.Buffer) – aGst.Buffer
- Returns:
the
GstGL.GLSyncMetaadded 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.GLAllocationParamsorNone- Return type:
- GstGL.buffer_pool_config_get_gl_min_free_queue_size(config)[source]¶
- Parameters:
config (
Gst.Structure) – a buffer pool config- Returns:
then number of buffers configured the free queue
- Return type:
See
GstGL.buffer_pool_config_set_gl_min_free_queue_size().New in version 1.24.
- GstGL.buffer_pool_config_set_gl_allocation_params(config, params)[source]¶
- Parameters:
config (
Gst.Structure) – a buffer pool configparams (
GstGL.GLAllocationParamsorNone) – aGstGL.GLAllocationParams
Sets params on config
- GstGL.buffer_pool_config_set_gl_min_free_queue_size(config, queue_size)[source]¶
- Parameters:
config (
Gst.Structure) – a buffer pool configqueue_size (
int) – the number of buffers
Instructs the
GstGL.GLBufferPoolto keep queue_size amount of buffers around before allowing them for reuse.This is helpful to allow GPU processing to complete before the CPU operations on the same buffer could start. Particularly useful when uploading or downloading data to/from the GPU.
A value of 0 disabled this functionality.
This value must be less than the configured maximum amount of buffers for this config.
New in version 1.24.
- 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.GLDisplayorNone)
New in version 1.4.
- GstGL.context_set_gl_display(context, display)[source]¶
- Parameters:
context (
Gst.Context) – aGst.Contextdisplay (
GstGL.GLDisplayorNone) – 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.GLAPIrepresented by api_s- Return type:
- GstGL.gl_api_to_string(api)[source]¶
- Parameters:
api (
GstGL.GLAPI) – aGstGL.GLAPIto 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.GLBaseMemoryAllocatorparams (
GstGL.GLAllocationParams) – theGstGL.GLAllocationParamsto allocate the memory with
- Returns:
a new
GstGL.GLBaseMemoryfrom 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.GLBaseMemoryinGLib.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.GLBaseMemoryoperation.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.GLBufferoperation.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
Noneif 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
Noneif surface_type does not exist.- Return type:
New in version 1.20.
- GstGL.gl_context_error_quark()[source]¶
- Returns:
the quark used for
GstGL.GLContextinGLib.Error's- Return type:
- GstGL.gl_dma_buf_transform_drm_formats_to_gst_formats(context, src, flags, dst)[source]¶
- Parameters:
context (
GstGL.GLContext) – aGst.Contextsrc (
GObject.Value) – value of “drm-format” field inGst.CapsasGObject.Valueflags (
GstGL.GLDrmFormatFlags) – transformation flagsdst (
GObject.Value) – empty destinationGObject.Value
- Returns:
whether any valid GST video formats were found and stored in dst
- dst:
empty destination
GObject.Value
- Return type:
(
bool, dst:GObject.Value)
Given the DRM formats in src
GObject.Value, collect corresponding GST formats to dstGObject.Value. This function returnsFalseif the context is not an EGL context.New in version 1.26.
- GstGL.gl_dma_buf_transform_gst_formats_to_drm_formats(context, src, flags, dst)[source]¶
- Parameters:
context (
GstGL.GLContext) – aGst.Contextsrc (
GObject.Value) – value of “format” field inGst.CapsasGObject.Valueflags (
GstGL.GLDrmFormatFlags) – transformation flagsdst (
GObject.Value) – empty destinationGObject.Value
- Returns:
whether any valid drm formats were found and stored in dst
- dst:
empty destination
GObject.Value
- Return type:
(
bool, dst:GObject.Value)
Given the video formats in src
GObject.Value, collect corresponding drm formats supported by context into dstGObject.Value. This function returnsFalseif the context is not an EGL context.New in version 1.26.
- 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.Elementrunning the querydisplay_ptr (
GstGL.GLDisplay) – the resultingGstGL.GLDisplayother_context_ptr (
GstGL.GLContext) – the resultingGstGL.GLContext
- Returns:
whether a
GstGL.GLDisplayexists 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.GLDisplayand (optionally) an application providedGstGL.GLContextfrom the surrounding elements or from the application using theGst.Contextmechanism.If the contents of display_ptr or other_context_ptr are not
None, then noGst.Contextquery is necessary forGstGL.GLDisplayorGstGL.GLContextretrieval or is performed.This performs
Gst.Contextqueries (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.Contextquery (if necessary) for an optional application providedGstGL.GLContextusing the name “gst.gl.app_context”. The returnedGstGL.GLContextwill be shared with a GStreamer created OpenGL context.
- GstGL.gl_format_from_video_info(context, vinfo, plane)[source]¶
- Parameters:
context (
GstGL.GLContext) – aGstGL.GLContextvinfo (
GstVideo.VideoInfo) – aGstVideo.VideoInfoplane (
int) – the plane number in vinfo
- Returns:
the
GstGL.GLFormatnecessary for holding the data in plane of vinfo- Return type:
- GstGL.gl_format_is_supported(context, format)[source]¶
- Parameters:
context (
GstGL.GLContext) – aGstGL.GLContextformat (
GstGL.GLFormat) – theGstGL.GLFormatto 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_n_components(gl_format)[source]¶
- Parameters:
gl_format (
GstGL.GLFormat) – theGstGL.GLFormat- Returns:
the number of components in a
GstGL.GLFormat- Return type:
New in version 1.24.
- 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.VideoAffineTransformationMetaorNone) – 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.VideoInfoalign (
GstVideo.VideoAlignment) – aGstVideo.VideoAlignmentorNoneplane (
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.VideoInfovalign (
GstVideo.VideoAlignment) – aGstVideo.VideoAlignmentorNoneplane (
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.Elementquery (
Gst.Query) – aGst.Queryof typeGst.QueryType.CONTEXTdisplay (
GstGL.GLDisplayorNone) – aGstGL.GLDisplaycontext (
GstGL.GLContextorNone) – aGstGL.GLContextother_context (
GstGL.GLContextorNone) – 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.Elementcontext (
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.GLDisplayorGstGL.GLContextin 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.GLMemoryoperation.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.GLPlatformrepresented by platform_s- Return type:
- GstGL.gl_platform_to_string(platform)[source]¶
- Parameters:
platform (
GstGL.GLPlatform) – aGstGL.GLPlatformto 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.Elementto query fromdirection (
Gst.PadDirection) – theGst.PadDirectionto 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.CONTEXTquery of type “gst.gl.local_context” on allGst.Padsin 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.GLRenderbufferoperation.New in version 1.10.
- GstGL.gl_set_affine_transformation_meta_from_ndc(meta, matrix)[source]¶
- Parameters:
meta (
GstVideo.VideoAffineTransformationMeta) – aGstVideo.VideoAffineTransformationMetamatrix ([
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.GLContextformat (
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_swizzle_invert(swizzle)[source]¶
- Parameters:
swizzle ([
int]) – input swizzle- Returns:
resulting inversion
- Return type:
inversion: [
int]
Given swizzle, produce inversion such that:
swizzle[inversion[i]] == identity[i] where:
identity = {0, 1, 2,…}
unset fields are marked by -1
New in version 1.24.
- GstGL.gl_texture_target_from_gl(target)[source]¶
- Parameters:
target (
int) – an OpenGL texture binding target- Returns:
the
GstGL.GLTextureTargetthat’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.GLTextureTargetrepresented 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.Valueof typeGObject.TYPE_STRING- Returns:
the mask of
GstGL.GLTextureTarget's in value orGstGL.GLTextureTarget.NONEon 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.Valueof typeGObject.TYPE_STRINGtarget (
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.Valuetarget_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.GLAPImaj (
int) – the major GL versionmin (
int) – the minor GL version
- Returns:
The minimum supported
GstGL.GLSLVersionavailable for gl_api, maj and min- Return type:
- GstGL.gl_video_format_swizzle(video_format)[source]¶
- Parameters:
video_format (
GstVideo.VideoFormat) – theGstVideo.VideoFormatin use- Returns:
whether valid swizzle indices could be found
- swizzle:
the returned swizzle indices
- Return type:
Calculates the swizzle indices for video_format and gl_format in order to access a texture such that accessing a texel from a texture through the swizzle index produces values in the order (R, G, B, A) or (Y, U, V, A).
For multi-planer formats, the swizzle index uses the same component order (RGBA/YUVA) and should be applied after combining multiple planes into a single rgba/yuva value. e.g. sampling from a NV12 format would have Y from one texture and UV from another texture into a (Y, U, V) value. Add an Aplha component and then perform swizzling. Sampling from NV21 would produce (Y, V, U) which is then swizzled to (Y, U, V).
New in version 1.24.
- GstGL.gl_window_error_quark()[source]¶
- Returns:
the quark used for
GstGL.GLWindowinGLib.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.GLSLProfileof string orGstGL.GLSLProfile.NONEon error- Return type:
- GstGL.glsl_profile_to_string(profile)[source]¶
- Parameters:
profile (
GstGL.GLSLProfile) – aGstGL.GLSLProfile- Returns:
the name for profile or
Noneon error- Return type:
- GstGL.glsl_string_get_version_profile(s)[source]¶
- Parameters:
s (
str) – string to search for a valid#versionstring- Returns:
Trueif a valid#versionstring was found,Falseotherwise- 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
#versionpreprocessor 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.GLSLVersionof string orGstGL.GLSLVersion.NONEon error- Return type:
- GstGL.glsl_version_profile_from_string(string)[source]¶
- Parameters:
string (
str) – a valid GLSL#versionstring- Returns:
Trueif a valid#versionstring was found,Falseotherwise- 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
#versionGLSL preprocesser directive or a valid GLSL version and/or profile.
- GstGL.glsl_version_profile_to_string(version, profile)[source]¶
- Parameters:
version (
GstGL.GLSLVersion) – aGstGL.GLSLVersionprofile (
GstGL.GLSLProfile) – aGstGL.GLSLVersion
- Returns:
the combined GLSL
#versionstring 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
Noneon 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.