GstGL.GLMemory

Fields

Name

Type

Access

Description

info

GstVideo.VideoInfo

r/w

the texture’s GstVideo.VideoInfo

mem

GstGL.GLBaseMemory

r/w

the parent GstGL.GLBaseMemory object

plane

int

r/w

data plane in info

tex_format

GstGL.GLFormat

r/w

the texture type

tex_id

int

r/w

the GL texture id for this memory

tex_scaling

[float]

r/w

GL shader scaling parameters for valign and/or width/height

tex_target

GstGL.GLTextureTarget

r/w

the GL texture target for this memory

tex_width

int

r/w

texture_wrapped

bool

r/w

unpack_length

int

r/w

valign

GstVideo.VideoAlignment

r/w

data alignment for system memory mapping

Methods

class

init_once ()

copy_into (tex_id, target, tex_format, width, height)

copy_teximage (tex_id, out_target, out_tex_format, out_width, out_height)

get_texture_format ()

get_texture_height ()

get_texture_id ()

get_texture_target ()

get_texture_width ()

init (allocator, parent, context, target, tex_format, params, info, plane, valign, user_data, notify)

read_pixels (write_pointer)

texsubimage (read_pointer)

Details

class GstGL.GLMemory

GstGL.GLMemory is a GstGL.GLBaseMemory subclass providing support for the mapping of OpenGL textures.

GstGL.GLMemory is created or wrapped through GstGL.GLBaseMemory.alloc() with GstGL.GLVideoAllocationParams.

Data is uploaded or downloaded from the GPU as is necessary.

The Gst.Caps that is used for GstGL.GLMemory based buffers should contain the GstGL.CAPS_FEATURE_MEMORY_GL_MEMORY as a Gst.CapsFeatures and should contain a ‘texture-target’ field with one of the GstGL.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:
Returns:

Whether the copy succeeded

Return type:

bool

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:
Returns:

whether the copy succeeded.

Return type:

bool

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:

GstGL.GLFormat

New in version 1.12.

get_texture_height()[source]
Returns:

the texture height of self

Return type:

int

New in version 1.8.

get_texture_id()[source]
Returns:

the OpenGL texture handle of self

Return type:

int

New in version 1.8.

get_texture_target()[source]
Returns:

the GstGL.GLTextureTarget of self

Return type:

GstGL.GLTextureTarget

New in version 1.8.

get_texture_width()[source]
Returns:

the texture width of self

Return type:

int

New in version 1.8.

init(allocator, parent, context, target, tex_format, params, info, plane, valign, user_data, notify)[source]
Parameters:

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 or None) – the data pointer to pass to glReadPixels

Returns:

whether theread operation succeeded

Return type:

bool

Reads the texture in GstGL.GLMemory into write_pointer if no buffer is bound to GL_PIXEL_PACK_BUFFER. Otherwise write_pointer is the byte offset into the currently bound GL_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]
Parameters:

read_pointer (object or None) – the data pointer to pass to glTexSubImage

Reads the texture in read_pointer into self.

See GstGL.GLMemory.read_pixels() for what read_pointer signifies.

New in version 1.8.