GstGL.GLMemory¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
info |
r/w |
the texture’s |
|
mem |
r/w |
the parent |
|
plane |
r/w |
data plane in info |
|
tex_format |
r/w |
the texture type |
|
tex_id |
r/w |
the GL texture id for this memory |
|
tex_scaling |
[ |
r/w |
GL shader scaling parameters for valign and/or width/height |
tex_target |
r/w |
the GL texture target for this memory |
|
tex_width |
r/w |
||
texture_wrapped |
r/w |
||
unpack_length |
r/w |
||
valign |
r/w |
data alignment for system memory mapping |
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstGL.GLMemory¶
GstGL.GLMemory
is aGstGL.GLBaseMemory
subclass providing support for the mapping of OpenGL textures.GstGL.GLMemory
is created or wrapped throughGstGL.GLBaseMemory.alloc
() withGstGL.GLVideoAllocationParams
.Data is uploaded or downloaded from the GPU as is necessary.
The
Gst.Caps
that is used forGstGL.GLMemory
based buffers should contain theGstGL.CAPS_FEATURE_MEMORY_GL_MEMORY
as aGst.CapsFeatures
and should contain a ‘texture-target’ field with one of theGstGL.GLTextureTarget
values as a string, i.e. some combination of ‘texture-target=(string){2D, rectangle, external-oes}’.- classmethod 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.
- copy_into(tex_id, target, tex_format, width, height)[source]¶
- Parameters:
tex_id (
int
) – OpenGL texture idtarget (
GstGL.GLTextureTarget
) – theGstGL.GLTextureTarget
tex_format (
GstGL.GLFormat
) – theGstGL.GLFormat
width (
int
) – width of tex_idheight (
int
) – height of tex_id
- Returns:
Whether the copy succeeded
- Return type:
Copies self into the texture specified by tex_id. The format of tex_id is specified by tex_format, width and height.
New in version 1.8.
- copy_teximage(tex_id, out_target, out_tex_format, out_width, out_height)[source]¶
- Parameters:
tex_id (
int
) – the destination texture idout_target (
GstGL.GLTextureTarget
) – the destinationGstGL.GLTextureTarget
out_tex_format (
GstGL.GLFormat
) – the destinationGstGL.GLFormat
out_width (
int
) – the destination widthout_height (
int
) – the destination height
- Returns:
whether the copy succeeded.
- Return type:
Copies the texture in
GstGL.GLMemory
into the texture specified by tex_id, out_target, out_tex_format, out_width and out_height.New in version 1.8.
- get_texture_format()[source]¶
- Returns:
the
GstGL.GLFormat
of self- Return type:
New in version 1.12.
- get_texture_id()[source]¶
- Returns:
the OpenGL texture handle of self
- Return type:
New in version 1.8.
- get_texture_target()[source]¶
- Returns:
the
GstGL.GLTextureTarget
of self- Return type:
New in version 1.8.
- init(allocator, parent, context, target, tex_format, params, info, plane, valign, user_data, notify)[source]¶
- Parameters:
allocator (
Gst.Allocator
) – theGst.Allocator
to initialize withparent (
Gst.Memory
orNone
) – the parentGst.Memory
to initialize withcontext (
GstGL.GLContext
) – theGstGL.GLContext
to initialize withtarget (
GstGL.GLTextureTarget
) – theGstGL.GLTextureTarget
for thisGstGL.GLMemory
tex_format (
GstGL.GLFormat
) – theGstGL.GLFormat
for thisGstGL.GLMemory
params (
Gst.AllocationParams
orNone
) – the GstAllocationParams to initialize withinfo (
GstVideo.VideoInfo
) – theGstVideo.VideoInfo
for thisGstGL.GLMemory
plane (
int
) – the plane number (starting from 0) for thisGstGL.GLMemory
valign (
GstVideo.VideoAlignment
orNone
) – optionalGstVideo.VideoAlignment
parametersnotify (
GLib.DestroyNotify
orNone
) – aGLib.DestroyNotify
Initializes self with the required parameters. info is assumed to have already have been modified with
GstVideo.VideoInfo.align
().New in version 1.8.
- read_pixels(write_pointer)[source]¶
- Parameters:
write_pointer (
object
orNone
) – the data pointer to pass to glReadPixels- Returns:
whether theread operation succeeded
- Return type:
Reads the texture in
GstGL.GLMemory
into write_pointer if no buffer is bound toGL_PIXEL_PACK_BUFFER
. Otherwise write_pointer is the byte offset into the currently boundGL_PIXEL_PACK_BUFFER
buffer to store the result of glReadPixels. See the OpenGL specification for glReadPixels for more details.New in version 1.8.
- texsubimage(read_pointer)[source]¶
-
Reads the texture in read_pointer into self.
See
GstGL.GLMemory.read_pixels
() for what read_pointer signifies.New in version 1.8.