gstreamer-rs/docs/gstreamer-gl/docs.md
François Laignel 172a4d47ab regen: use type_ for glib macros
This also includes a new substitution for bool getters:
get_need_... -> needs_...
2021-04-20 18:18:02 +02:00

60 KiB

no API

Desktop OpenGL up to and including 3.1. The compatibility profile when the OpenGL version is >= 3.2

Desktop OpenGL >= 3.2 core profile

OpenGL ES 1.x

OpenGL ES 2.x and 3.x

Any OpenGL API

Returns

a copy of the GLAllocationParams specified by self or None on failure

Copies the dynamically allocated data from self to dest. Direct subclasses should call this function in their own overridden copy function.

dest

the destination GLAllocationParams

Frees the GLAllocationParams and all associated data.

Frees the dynamically allocated data in self. Direct subclasses should call this function in their own overridden free function.

notify will be called once for each allocated memory using these self when freeing the memory.

struct_size

the struct size of the implementation

alloc_flags

some alloc flags

copy

a copy function

free

a free function

context

a GLContext

alloc_size

the number of bytes to allocate.

alloc_params

a gst::AllocationParams to apply

wrapped_data

a sysmem data pointer to initialize the allocation with

gl_handle

a GL handle to initialize the allocation with

user_data

user data to call notify with

notify

a GDestroyNotify

Returns

whether the parameters could be initialized

GLBaseFilter handles the nitty gritty details of retrieving an OpenGL context. It also provided some wrappers around gst_base::BaseTransform's start(), stop() and set_caps() virtual methods that ensure an OpenGL context is available and current in the calling thread.

Implements

GLBaseFilterExt, [trait@gst_base::BaseTransformExt], [trait@gst::ElementExt], [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Trait containing all GLBaseFilter methods.

Implementors

GLBaseFilter, GLFilter

Feature: v1_16

Returns

Whether an OpenGL context could be retrieved or created successfully

Feature: v1_18

Returns

the GLContext found by self

GstGLBaseMemory is a gst::Memory subclass providing the basis of support for the mapping of GL buffers.

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

Note: only intended for subclass usage to allocate the system memory buffer on demand. If there is already a non-NULL data pointer in self->data, then this function imply returns TRUE.

Returns

whether the system memory could be allocated

Initializes self with the required parameters

allocator

the gst::Allocator to initialize with

parent

the parent gst::Memory to initialize with

context

the GLContext to initialize with

params

the [crate::gst::AllocationParams] (XXX: @-reference does not belong to GLBaseMemory!) to initialize with

size

the number of bytes to be allocated

user_data

user data to call notify with

notify

a GDestroyNotify

dest

the destination GLBaseMemory

offset

the offset to start at

size

the number of bytes to copy

Returns

whether the copy succeeded.

allocator

a GLBaseMemoryAllocator

params

the GLAllocationParams to allocate the memory with

Returns

a new GLBaseMemory from allocator with the requested params.

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

Opaque GLBaseMemoryAllocator struct

This is an Abstract Base Class, you cannot instantiate it.

Implements

[trait@gst::AllocatorExt], [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

GstGLBuffer is a gst::Memory subclass providing support for the mapping of GL buffers.

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

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

GLColorConvert is an object that converts between color spaces and/or formats using OpenGL Shaders.

A GLColorConvert can be created with GLColorConvert::new, the configuration negotiated with GLColorConvert::transform_caps and the conversion performed with GLColorConvert::perform.

The glcolorconvertelement provides a GStreamer element that uses GLColorConvert to convert between video formats and color spaces.

Implements

[trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

context

a GLContext

Returns

a new GLColorConvert object

Provides an implementation of gst_base::BaseTransformClass.fixate_caps()

context

a GLContext to use for transforming caps

direction

a gst::PadDirection

caps

the gst::Caps of direction

other

the gst::Caps to fixate

Returns

the fixated gst::Caps

Provides an implementation of gst_base::BaseTransformClass.transform_caps()

context

a GLContext to use for transforming caps

direction

a gst::PadDirection

caps

the gst::Caps to transform

filter

a set of filter gst::Caps

Returns

the converted gst::Caps

Provides an implementation of gst_base::BaseTransformClass.decide_allocation()

query

a completed ALLOCATION gst::Query

Returns

whether the allocation parameters were successfully chosen

Converts the data contained by inbuf using the formats specified by the gst::Caps passed to GLColorConvert::set_caps

inbuf

the GLMemory filled gst::Buffer to convert

Returns

a converted gst::Buffer or None

Initializes self with the information required for conversion.

in_caps

input gst::Caps

out_caps

output gst::Caps

GLContext wraps an OpenGL context object in a uniform API. As a result of the limitation on OpenGL context, this object is not thread safe unless specified and must only be activated in a single thread.

This is an Abstract Base Class, you cannot instantiate it.

Implements

GLContextExt, [trait@gst::ObjectExt], [trait@glib::object::ObjectExt], GLContextExtManual

Trait containing all GLContext methods.

Implementors

GLContext

Create a new GLContext with the specified display

display

a GLDisplay

Returns

a new GLContext

Wraps an existing OpenGL context into a GLContext.

Note: The caller is responsible for ensuring that the OpenGL context represented by handle stays alive while the returned GLContext is active.

context_type must not be GLPlatform::None or GLPlatform::Any

available_apis must not be GLAPI::None or GLAPI::Any

display

a GLDisplay

handle

the OpenGL context to wrap

context_type

a GLPlatform specifying the type of context in handle

available_apis

a GLAPI containing the available OpenGL apis in handle

Returns

a GLContext wrapping handle

A default implementation of the various GetProcAddress functions that looks for name in the OpenGL shared libraries or in the current process.

See also: GLContext::get_proc_address

gl_api

a GLAPI

name

then function to get the address of

Returns

an address pointing to name or None

See also GLContextExt::activate.

Returns

the GLContext active in the current thread or None

If an error occurs, major and minor are not modified and GLAPI::None is returned.

platform

the GLPlatform to retrieve the API for

major

the major version

minor

the minor version

Returns

The version supported by the OpenGL context current in the calling thread or GLAPI::None

context_type

a GLPlatform specifying the type of context to retrieve

Returns

The OpenGL context handle current in the calling thread or None

Attempts to use the context_type specific GetProcAddress implementations to retrieve name.

See also GLContext::get_proc_address.

context_type

a GLPlatform

gl_api

a GLAPI

name

the name of the function to retrieve

Returns

a function pointer for name, or None

(De)activate the OpenGL context represented by this self.

In OpenGL terms, calls eglMakeCurrent or similar with this context and the currently set window. See GLContextExt::set_window for details.

activate

true to activate, false to deactivate

Returns

Whether the activation succeeded

Note: This will always fail for two wrapped GLContext's

other_context

another GLContext

Returns

whether self and other_context are able to share OpenGL resources.

Check for an OpenGL feature being supported.

Note: Most features require that the context be created before it is possible to determine their existence and so will fail if that is not the case.

feature

a platform specific feature

Returns

Whether feature is supported by self

fbo_target

the GL value of the framebuffer target, GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER

Returns

whether whether the current framebuffer is complete

api

api type required

maj

major version required

min

minor version required

Returns

whether OpenGL context implements the required api and specified version.

Unbind the current framebuffer

Clear's the currently set shader from the GL state machine.

Note: must be called in the GL thread.

Creates an OpenGL context with the specified other_context as a context to share shareable OpenGL objects with. See the OpenGL specification for what is shared between OpenGL contexts.

If an error occurs, and error is not None, then error will contain details of the error and false will be returned.

Should only be called once.

other_context

a GLContext to share OpenGL objects with

Returns

whether the context could successfully be created

Destroys an OpenGL context.

Should only be called after GLContextExt::create has been successfully called for this context.

Fills self's info (version, extensions, vtable, etc) from the GL context in the current thread. Typically used with wrapped contexts to allow wrapped contexts to be used as regular GLContext's.

Returns

the GLDisplay associated with this self

Get the currently enabled OpenGL api.

The currently available API may be limited by the GLDisplay in use and/or the GLWindow chosen.

Returns

the available OpenGL api

Gets the backing OpenGL context used by self.

Returns

The platform specific backing OpenGL context

Gets the OpenGL platform that used by self.

Returns

The platform specific backing OpenGL context

Get the version of the OpenGL platform (GLX, EGL, etc) used. Only valid after a call to GLContextExt::create.

major

return for the major version

minor

return for the minor version

Returns the OpenGL version implemented by self. See GLContextExt::get_gl_api for retrieving the OpenGL api implemented by self.

maj

resulting major version

min

resulting minor version

Get a function pointer to a specified opengl function, name. If the the specific function does not exist, NULL is returned instead.

Platform specific functions (names starting 'egl', 'glX', 'wgl', etc) can also be retrieved using this method.

Note: This function may return valid function pointers that may not be valid to call in self. The caller is responsible for ensuring that the returned function is a valid function to call in self by either checking the OpenGL API and version or for an appropriate OpenGL extension.

Note: On success, you need to cast the returned function pointer to the correct type to be able to call it correctly. On 32-bit Windows, this will include the GSTGLAPI identifier to use the correct calling convention. e.g.

void (GSTGLAPI *PFN_glGetIntegerv) (GLenum name, GLint * ret)

name

an opengl function name

Returns

a function pointer or None

Returns

The glib::Thread, self is current in or NULL

Returns

the currently set window

Returns

Whether the GLContext has been shared with another GLContext

Will internally set self as shared with share

share

another GLContext

Set's the current window on self to window. The window can only be changed before GLContextExt::create has been called and the window is not already running.

window

a GLWindow

Returns

Whether the window was successfully updated

version

a GLSLVersion

profile

a GLSLProfile

Returns

Whether self supports the combination of version with profile

Feature: v1_16

version

a GLSLVersion

profile

a GLSLProfile

Returns

whether self supports the 'precision' specifier in GLSL shaders

Feature: v1_16

version

a GLSLVersion

profile

a GLSLProfile

Returns

whether self supports the 'precision highp' specifier in GLSL shaders

Swap the front and back buffers on the window attached to self. This will display the frame on the next refresh cycle.

Execute func in the OpenGL thread of self with data

MT-safe

func

a GstGLContextThreadFunc

data

user data to call func with

OpenGL context errors.

Failed for an unspecified reason

The configuration requested is not correct

The OpenGL API requested is not correct

The OpenGL libraries are too old

glXCreateContext (or similar) failed

A resource is not available

GLDisplay represents a connection to the underlying windowing system. Elements are required to make use of gst::Context to share and propagate a GLDisplay.

There are a number of environment variables that influence the choice of platform and window system specific functionality.

  • GST_GL_WINDOW influences the window system to use. Common values are 'x11', 'wayland', 'win32' or 'cocoa'.
  • GST_GL_PLATFORM influences the OpenGL platform to use. Common values are 'egl', 'glx', 'wgl' or 'cgl'.
  • GST_GL_API influences the OpenGL API requested by the OpenGL platform. Common values are 'opengl', 'opengl3' and 'gles2'.

Certain window systems require a special function to be called to initialize threading support. As this GStreamer GL library does not preclude concurrent access to the windowing system, it is strongly advised that applications ensure that threading support has been initialized before any other toolkit/library functionality is accessed. Failure to do so could result in sudden application abortion during execution. The most notably example of such a function is X11's XInitThreads().

Implements

GLDisplayExt, [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Trait containing all GLDisplay methods.

Implementors

GLDisplay

Returns

a new GLDisplay

context

a GLContext

Returns

whether context was successfully added. false may be returned if there already exists another context for context's active thread.

Must be called with the object lock held.

It requires the display's object lock to be held.

other_context

other GLContext to share resources with.

p_context

resulting GLContext

Returns

whether a new context could be created.

Returns

a new GLWindow for self or None.

limit the use of OpenGL to the requested gl_api. This is intended to allow application and elements to request a specific set of OpenGL API's based on what they support. See GLContextExt::get_gl_api for the retrieving the API supported by a GLContext.

gl_api

a GLAPI to filter with

Deprecated for GLDisplayExt::retrieve_window.

Execute compare_func over the list of windows stored by self. The first argument to compare_func is the GLWindow being checked and the second argument is data.

data

some data to pass to compare_func

compare_func

a comparison function to run

Returns

The first GLWindow that causes a match from compare_func

see GLDisplayExt::filter_gl_api for what the returned value represents

Returns

the GLAPI configured for self

thread

a glib::Thread

Returns

the GLContext current on thread or None

Must be called with the object lock held.

Returns

the native handle for the display

Returns

the GLDisplayType of self

Must be called with the object lock held.

Feature: v1_18

context

the GLContext to remove

window

a GLWindow to remove

Returns

if window could be removed from self

Execute compare_func over the list of windows stored by self. The first argument to compare_func is the GLWindow being checked and the second argument is data.

Feature: v1_18

data

some data to pass to compare_func

compare_func

a comparison function to run

Returns

The first GLWindow that causes a match from compare_func

Overrides the [crate::GLContext] (XXX: @-reference does not belong to GLDisplayExt!) creation mechanism. It can be called in any thread and it is emitted with display's object lock held.

context

other context to share resources with.

Returns

the new context.

no display type

X11 display

Wayland display

Cocoa display

Win32 display

Dispmanx display

EGL display

Vivante Framebuffer display

Mesa3D GBM display

EGLDevice display (Since: 1.18)

any display type

GLFilter helps to implement simple OpenGL filter elements taking a single input and producing a single output with a GLFramebuffer

Implements

GLFilterExt, GLBaseFilterExt, [trait@gst_base::BaseTransformExt], [trait@gst::ElementExt], [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Trait containing all GLFilter methods.

Implementors

GLFilter

Render a fullscreen quad using the current GL state. The only GL state this modifies is the necessary vertex/index buffers and, if necessary, a Vertex Array Object for drawing a fullscreen quad. Framebuffer state, any shaders, viewport state, etc must be setup by the caller.

Calls filter_texture vfunc with correctly mapped GstGLMemorys

input

an input buffer

output

an output buffer

Returns

whether the transformation succeeded

Transforms input into output using func on through FBO.

input

the input texture

output

the output texture

func

the function to transform input into output. called with data

data

the data associated with func

Returns

the return value of func

Transforms input into output using shader with a FBO.

See also: GLFilterExt::render_to_target

input

the input texture

output

the output texture

shader

the shader to use.

Single component replicated across R, G, and B textures components

Single component stored in the A texture component

Combination of GLFormat::Luminance and GLFormat::Alpha

Single component stored in the R texture component

Single 8-bit component stored in the R texture component

Two components stored in the R and G texture components

Two 8-bit components stored in the R and G texture components

Three components stored in the R, G, and B texture components

Three 8-bit components stored in the R, G, and B texture components

Three components of bit depth 5, 6 and 5 stored in the R, G, and B texture components respectively.

Three 16-bit components stored in the R, G, and B texture components

Four components stored in the R, G, B, and A texture components respectively.

Four 8-bit components stored in the R, G, B, and A texture components respectively.

Four 16-bit components stored in the R, G, B, and A texture components respectively.

A single 16-bit component for depth information.

A 24-bit component for depth information and a 8-bit component for stencil informat.

Single 16-bit component stored in the R texture component

Two 16-bit components stored in the R and G texture components

A GLFramebuffer represents and holds an OpenGL framebuffer object with it's associated attachments.

A GLFramebuffer can be created with GLFramebuffer::new or GLFramebuffer::new_with_default_depth and bound with GLFramebufferExt::bind. Other resources can be bound with GLFramebufferExt::attach

Note: OpenGL framebuffers are not shareable resources so cannot be used between multiple OpenGL contexts.

Implements

GLFramebufferExt, [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Trait containing all GLFramebuffer methods.

Implementors

GLFramebuffer

context

a GLContext

Returns

a new GLFramebuffer

context

a GLContext

width

width for the depth buffer

height

for the depth buffer

Returns

a new GLFramebuffer with a depth buffer of width and height

attach mem to attachment_point

attachment_point

the OpenGL attachment point to bind mem to

mem

the memory object to bind to attachment_point

Bind self into the current thread

Perform the steps necessary to have the output of a glDraw* command in func update the contents of mem.

mem

the GLMemory to draw to

func

the function to run

user_data

data to pass to func

Returns

the result of executing func

Retrieve the effective dimensions from the current attachments attached to self.

width

output width

height

output height

Returns

the OpenGL id for self

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

GLMemory is created or wrapped through GLBaseMemory::alloc with GLVideoAllocationParams.

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

The gst::Caps that is used for GLMemory based buffers should contain the GST_CAPS_FEATURE_MEMORY_GL_MEMORY as a gst::CapsFeatures and should contain a 'texture-target' field with one of the GLTextureTarget values as a string, i.e. some combination of 'texture-target=(string){2D, rectangle, external-oes}'.

Copies self into the texture specified by tex_id. The format of tex_id is specified by tex_format, width and height.

tex_id

OpenGL texture id

target

the GLTextureTarget

tex_format

the GLFormat

width

width of tex_id

height

height of tex_id

Returns

Whether the copy succeeded

Copies the texture in GLMemory into the texture specified by tex_id, out_target, out_tex_format, out_width and out_height.

tex_id

the destination texture id

out_target

the destination GLTextureTarget

out_tex_format

the destination GLFormat

out_width

the destination width

out_height

the destination height

Returns

whether the copy succeeded.

Returns

the GLFormat of self

Returns

the texture height of self

Returns

the OpenGL texture handle of self

Returns

the GLTextureTarget of self

Returns

the texture width of self

Initializes self with the required parameters. info is assumed to have already have been modified with gst_video::VideoInfo::align.

allocator

the gst::Allocator to initialize with

parent

the parent gst::Memory to initialize with

context

the GLContext to initialize with

target

the GLTextureTarget for this GLMemory

tex_format

the GLFormat for this GLMemory

params

the [crate::gst::AllocationParams] (XXX: @-reference does not belong to GLMemory!) to initialize with

info

the gst_video::VideoInfo for this GLMemory

plane

the plane number (starting from 0) for this GLMemory

valign

optional gst_video::VideoAlignment parameters

user_data

user data to call notify with

notify

a GDestroyNotify

Reads the texture in 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.

write_pointer

the data pointer to pass to glReadPixels

Returns

whether theread operation succeeded

Reads the texture in read_pointer into self.

See GLMemory::read_pixels for what read_pointer signifies.

read_pointer

the data pointer to pass to glTexSubImage

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

allocator

the [crate::GLMemoryAllocator] (XXX: @-reference does not belong to GLMemory!) to allocate from

buffer

a gst::Buffer to setup

params

the GLVideoAllocationParams to allocate with

tex_formats

a list of GLFormat's to allocate with.

wrapped_data

a list of wrapped data pointers

n_wrapped_pointers

the number of elements in tex_formats and wrapped_data

Returns

whether the buffer was correctly setup

Opaque GLMemoryAllocator struct

Implements

GLBaseMemoryAllocatorExt, [trait@gst::AllocatorExt], [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

context

a GLContext

Returns

the default GLMemoryAllocator supported by context

Opaque GLOverlayCompositor object

Implements

[trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

no platform

the EGL platform used primarily with the X11, wayland and android window systems as well as on embedded Linux

the GLX platform used primarily with the X11 window system

the WGL platform used primarily on Windows

the CGL platform used primarily on OS X

the EAGL platform used primarily on iOS

any OpenGL platform

A GLQuery represents and holds an OpenGL query object. Various types of queries can be run or counters retrieved.

Record the result of a counter

End counting the query

Frees a GLQuery

context

a GLContext

query_type

the GLQueryType

Returns

the result of the query

Start counting the query

Free any dynamically allocated resources

Performs a GST_QUERY_CONTEXT query of type "gst.gl.local_context" on all GstPads in element of direction for the local OpenGL context used by GStreamer elements.

element

a gst::Element to query from

direction

the gst::PadDirection to query

context_ptr

location containing the current and/or resulting GLContext

Returns

whether context_ptr contains a GLContext

Free with GLQuery::free

context

a GLContext

query_type

the GLQueryType to create

Returns

a new GLQuery

no query

query the time elapsed

query the current time

Compilation stage that caused an error

Compilation error occurred

Link error occurred

General program error occurred

GLSL profiles

no profile supported/available

OpenGL|ES profile

OpenGL core profile

OpenGL compatibility profile

any OpenGL/OpenGL|ES profile

GLSLStage holds and represents a single OpenGL shader stage.

Implements

[trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

context

a GLContext

type_

the GL enum shader stage type

Returns

a new GLSLStage of the specified type_

context

a GLContext

type_

the GL enum shader stage type

version

the GLSLVersion

profile

the GLSLProfile

str

a shader string

Returns

a new GLSLStage of the specified type_

context

a GLContext

type_

the GL enum shader stage type

version

the GLSLVersion

profile

the GLSLProfile

n_strings

the number of strings in str

str

an array of strings concatted together to produce a shader

Returns

a new GLSLStage of the specified type_

Returns

whether the compilation succeeded

Returns

The GL handle for this shader stage

Returns

The GLSL profile for the current shader stage

Returns

The GL shader type for this shader stage

Returns

The GLSL version for the current shader stage

Replaces the current shader string with str.

version

a GLSLVersion

profile

a GLSLProfile

n_strings

number of strings in str

str

a GLSL shader string

GLSL version list

no version

version 100 (only valid for ES)

version 110 (only valid for compatibility desktop GL)

version 120 (only valid for compatibility desktop GL)

version 130 (only valid for compatibility desktop GL)

version 140 (only valid for compatibility desktop GL)

version 150 (valid for compatibility/core desktop GL)

version 300 (only valid for ES)

version 310 (only valid for ES)

version 320 (only valid for ES)

version 330 (valid for compatibility/core desktop GL)

version 400 (valid for compatibility/core desktop GL)

version 410 (valid for compatibility/core desktop GL)

version 420 (valid for compatibility/core desktop GL)

version 430 (valid for compatibility/core desktop GL)

version 440 (valid for compatibility/core desktop GL)

version 450 (valid for compatibility/core desktop GL)

Implements

[trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Note: must be called in the GL thread

context

a GLContext

Returns

a new empty shader

Note: must be called in the GL thread

context

a GLContext

Returns

a default shader or None on failure

Each stage will attempt to be compiled and attached to shader. Then the shader will be linked. On error, None will be returned and error will contain the details of the error.

Note: must be called in the GL thread

context

a GLContext

error

a glib::Error

Returns

a new shader with the specified stages.

Each stage will attempt to be compiled and attached to shader. On error, None will be returned and error will contain the details of the error.

Note: must be called in the GL thread

context

a GLContext

error

a glib::Error

Returns

a new shader with the specified stages.

Feature: v1_16

context

a GLContext

version

a GLSLVersion

profile

a GLSLProfile

Returns

a passthrough shader string for copying an input external-oes texture to the output

Feature: v1_16

context

a GLContext

version

a GLSLVersion

profile

a GLSLProfile

Returns

a passthrough shader string for copying an input texture to the output

Generates a shader string that defines the precision of float types in GLSL shaders. This is particularly needed for fragment shaders in a GLSL ES context where there is no default precision specified.

Practically, this will return the string 'precision mediump float' or 'precision highp float' depending on if high precision floats are determined to be supported.

Feature: v1_16

context

a GLContext

version

a GLSLVersion

profile

a GLSLProfile

Returns

a shader string defining the precision of float types based on context, version and profile

Attaches stage to self. stage must have been successfully compiled with GLSLStage::compile.

Note: must be called in the GL thread

stage

a GLSLStage to attach

Returns

whether stage could be attached to self

Attaches stage to self. stage must have been successfully compiled with GLSLStage::compile.

Note: must be called in the GL thread

stage

a GLSLStage to attach

Returns

whether stage could be attached to self

Bind attribute name to the specified location index using glBindAttributeLocation().

index

attribute index to set

name

name of the attribute

Bind attribute name to the specified location index using glBindFragDataLocation().

index

attribute index to set

name

name of the attribute

Compiles stage and attaches it to self.

Note: must be called in the GL thread

stage

a GLSLStage to attach

Returns

whether stage could be compiled and attached to self

Detaches stage from self. stage must have been successfully attached to self with GLShader::attach or GLShader::attach_unlocked.

Note: must be called in the GL thread

stage

a GLSLStage to attach

Detaches stage from self. stage must have been successfully attached to self with GLShader::attach or GLShader::attach_unlocked.

Note: must be called in the GL thread

stage

a GLSLStage to attach

name

name of the attribute

Returns

the attribute index for name in self or -1 on failure

Returns

the GL program handle for this shader

Note: must be called in the GL thread

Returns

whether self has been successfully linked

Links the current list of GLSLStage's in self.

Note: must be called in the GL thread

Returns

whether self could be linked together.

Releases the shader and stages.

Note: must be called in the GL thread

Releases the shader and stages.

Note: must be called in the GL thread

Perform glUniform1f() for name on self

name

name of the uniform

value

value to set

Perform glUniform1fv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform1i() for name on self

name

name of the uniform

value

value to set

Perform glUniform1iv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform2f() for name on self

name

name of the uniform

v0

first value to set

v1

second value to set

Perform glUniform2fv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform2i() for name on self

name

name of the uniform

v0

first value to set

v1

second value to set

Perform glUniform2iv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform3f() for name on self

name

name of the uniform

v0

first value to set

v1

second value to set

v2

third value to set

Perform glUniform3fv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform3i() for name on self

name

name of the uniform

v0

first value to set

v1

second value to set

v2

third value to set

Perform glUniform3iv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform4f() for name on self

name

name of the uniform

v0

first value to set

v1

second value to set

v2

third value to set

v3

fourth value to set

Perform glUniform4fv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniform4i() for name on self

name

name of the uniform

v0

first value to set

v1

second value to set

v2

third value to set

v3

fourth value to set

Perform glUniform4iv() for name on self

name

name of the uniform

count

number of values to set

value

values to set

Perform glUniformMatrix2fv() for name on self

name

name of the uniform

count

number of 2x2 matrices to set

transpose

transpose the matrix

value

matrix to set

Perform glUniformMatrix2x3fv() for name on self

name

name of the uniform

count

number of 2x3 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix2x4fv() for name on self

name

name of the uniform

count

number of 2x4 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix3fv() for name on self

name

name of the uniform

count

number of 3x3 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix3x2fv() for name on self

name

name of the uniform

count

number of 3x2 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix3x4fv() for name on self

name

name of the uniform

count

number of 3x4 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix4fv() for name on self

name

name of the uniform

count

number of 4x4 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix4x2fv() for name on self

name

name of the uniform

count

number of 4x2 matrices to set

transpose

transpose the matrix

value

values to set

Perform glUniformMatrix4x3fv() for name on self

name

name of the uniform

count

number of 4x3 matrices to set

transpose

transpose the matrix

value

values to set

Mark's self as being used for the next GL draw command.

Note: must be called in the GL thread and self must have been linked.

Output anaglyph type to generate when downmixing to mono

Dubois optimised Green-Magenta anaglyph

Dubois optimised Red-Cyan anaglyph

Dubois optimised Amber-Blue anaglyph

The OpenGL texture target that an OpenGL texture can be bound to. The gst_gl_value_set_texture_target_from_mask, gst_gl_value_get_texture_target_mask, and gst_gl_value_set_texture_target functions can be used for handling texture targets with glib::object::Value's when e.g. dealing with gst::Caps.

no texture target

2D texture target (GL_TEXTURE_2D)

rectangle texture target (GL_TEXTURE_RECTANGLE)

external oes texture target (GL_TEXTURE_EXTERNAL_OES)

GLUpload is an object that uploads data from system memory into GL textures.

A GLUpload can be created with GLUpload::new

Implements

[trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

context

a GLContext

Returns

a new GLUpload object

in_caps

the input gst::Caps

out_caps

the output gst::Caps

Uploads buffer using the transformation specified by GLUpload::set_caps creating a new gst::Buffer in outbuf_ptr.

buffer

input gst::Buffer

outbuf_ptr

resulting gst::Buffer

Returns

whether the upload was successful

Adds the required allocation parameters to support uploading.

decide_query

a gst::Query from a decide allocation

query

the proposed allocation query

Initializes self with the information required for upload.

in_caps

input gst::Caps

out_caps

output gst::Caps

Returns

whether in_caps and out_caps could be set on self

No further processing required

An unspecified error occurred

The configuration is unsupported.

This element requires a reconfiguration.

private return value.

context

a GLContext

alloc_params

the gst::AllocationParams for sysmem mappings of the texture

v_info

the gst_video::VideoInfo for the texture

plane

the video plane of v_info to allocate

valign

any gst_video::VideoAlignment applied to symem mappings of the texture

target

the GLTextureTarget for the created textures

tex_format

the GLFormat for the created textures

Returns

a new GLVideoAllocationParams for allocating GLMemory's

context

a GLContext

alloc_params

the gst::AllocationParams for wrapped_data

v_info

the gst_video::VideoInfo for wrapped_data

plane

the video plane wrapped_data represents

valign

any gst_video::VideoAlignment applied to symem mappings of wrapped_data

target

the GLTextureTarget for wrapped_data

tex_format

the GLFormat for wrapped_data

wrapped_data

the data pointer to wrap

user_data

user data to call notify with

notify

a GDestroyNotify

Returns

a new GLVideoAllocationParams for wrapping wrapped_data

gl_handle is defined by the specific OpenGL handle being wrapped For GLMemory and GLMemoryPBO it is an OpenGL texture id. Other memory types may define it to require a different type of parameter.

context

a GLContext

alloc_params

the gst::AllocationParams for tex_id

v_info

the gst_video::VideoInfo for tex_id

plane

the video plane tex_id represents

valign

any gst_video::VideoAlignment applied to symem mappings of tex_id

target

the GLTextureTarget for tex_id

tex_format

the GLFormat for tex_id

gl_handle

the GL handle to wrap

user_data

user data to call notify with

notify

a GDestroyNotify

Returns

a new GLVideoAllocationParams for wrapping gl_handle

context

a GLContext

alloc_params

the gst::AllocationParams for tex_id

v_info

the gst_video::VideoInfo for tex_id

plane

the video plane tex_id represents

valign

any gst_video::VideoAlignment applied to symem mappings of tex_id

target

the GLTextureTarget for tex_id

tex_format

the GLFormat for tex_id

tex_id

the GL texture to wrap

user_data

user data to call notify with

notify

a GDestroyNotify

Returns

a new GLVideoAllocationParams for wrapping tex_id

Copy and set any dynamically allocated resources in dest_vid. Intended for subclass usage only to chain up at the end of a subclass copy function.

dest_vid

destination GLVideoAllocationParams to copy into

Unset and free any dynamically allocated resources. Intended for subclass usage only to chain up at the end of a subclass free function.

Intended for subclass usage

struct_size

the size of the struct in self

alloc_flags

some allocation flags

copy

a copy function

free

a free function

context

a GLContext

alloc_params

the gst::AllocationParams for wrapped_data

v_info

the gst_video::VideoInfo for wrapped_data

plane

the video plane wrapped_data represents

valign

any gst_video::VideoAlignment applied to symem mappings of wrapped_data

target

the GLTextureTarget

tex_format

the GLFormat

wrapped_data

the optional data pointer to wrap

gl_handle

the optional OpenGL handle to wrap or 0

user_data

user data to call notify with

notify

a GDestroyNotify

Returns

initializes self with the parameters specified

Convert stereoscopic/multiview video using fragment shaders.

Implements

[trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Returns

a new GLViewConvert

Provides an implementation of gst_base::BaseTransformClass.fixate_caps()

direction

a gst::PadDirection

caps

the gst::Caps of direction

othercaps

the gst::Caps to fixate

Returns

the fixated gst::Caps

Retrieve the processed output buffer placing the output in outbuf_ptr.

outbuf_ptr

a gst::Buffer

Returns

a gst::FlowReturn

Converts the data contained by inbuf using the formats specified by the gst::Caps passed to GLViewConvert::set_caps

inbuf

the GLMemory filled gst::Buffer to convert

Returns

a converted gst::Buffer or None

Reset self to the default state. Further operation will require setting the caps with GLViewConvert::set_caps.

Initializes self with the information required for conversion.

in_caps

input gst::Caps

out_caps

output gst::Caps

Set context on self

context

the GLContext to set

Submit input to be processed by self

is_discont

true if we have a discontinuity

input

a gst::Buffer

Returns

a gst::FlowReturn

Provides an implementation of gst_base::BaseTransformClass.transform_caps()

direction

a gst::PadDirection

caps

the gst::Caps to transform

filter

a set of filter gst::Caps

Returns

the converted gst::Caps

GstGLWindow represents a window that elements can render into. A window can either be a user visible window (onscreen) or hidden (offscreen).

This is an Abstract Base Class, you cannot instantiate it.

Implements

GLWindowExt, [trait@gst::ObjectExt], [trait@glib::object::ObjectExt]

Trait containing all GLWindow methods.

Implementors

GLWindow

display

a GLDisplay

Returns

a new GLWindow using display's connection

Checks if self controls the GL viewport.

Feature: v1_16

Returns

true if self controls the GL viewport, otherwise false

Redraw the window contents. Implementations should invoke the draw callback.

Returns

the GLContext associated with this self

Returns

the windowing system display handle for this self

width

resulting surface width

height

resulting surface height

Returns

the window handle we are currently rendering into

Tell a self that it should handle events from the window system. These events are forwarded upstream as navigation events. In some window systems events are not propagated in the window hierarchy if a client is listening for them. This method allows you to disable events handling completely from the self.

handle_events

a gboolean indicating if events should be handled or not.

Query whether self has output surface or not

Feature: v1_18

Returns

true if self has useable output surface

Queue resizing of self.

Quit the runloop's execution.

Resize self to the given width and height.

width

new width

height

new height

Start the execution of the runloop.

Invoke callback with data on the window thread. callback is guaranteed to have executed when this function returns.

callback

function to invoke

data

data to invoke callback with

Invoke callback with data on the window thread. The callback may not have been executed when this function returns.

callback

function to invoke

data

data to invoke callback with

destroy

called when data is not needed anymore

Notify a self about a scroll event. A scroll signal holding the event coordinates will be emitted.

Feature: v1_18

posx

x position of the mouse cursor

posy

y position of the mouse cursor

delta_x

the x offset of the scroll event

delta_y

the y offset of the scroll event

Sets the callback called when the window is about to close.

callback

function to invoke

data

data to invoke callback with

destroy_notify

called when data is not needed any more

Sets the draw callback called every time GLWindowExt::draw is called

callback

function to invoke

data

data to invoke callback with

destroy_notify

called when data is not needed any more

Set the preferred width and height of the window. Implementations are free to ignore this information.

width

new preferred width

height

new preferred height

Tell a self that it should render into a specific region of the window according to the gst_video::VideoOverlay interface.

x

x position

y

y position

width

width

height

height

Returns

whether the specified region could be set

Sets the resize callback called every time a resize of the window occurs.

callback

function to invoke

data

data to invoke callback with

destroy_notify

called when data is not needed any more

Sets the window that this self should render into. Some implementations require this to be called with a valid handle before drawing can commence.

handle

handle to the window

Present the window to the screen.

Will be emitted when a key event is received by the GstGLwindow.

id

the name of the event

key

the id of the key pressed

Will be emitted when a mouse event is received by the GstGLwindow.

id

the name of the event

button

the id of the button

x

the x coordinate of the mouse event

y

the y coordinate of the mouse event

Will be emitted when a mouse scroll event is received by the GstGLwindow.

Feature: v1_18

x

the x coordinate of the mouse event

y

the y coordinate of the mouse event

delta_x

the x offset of the scroll event

delta_y

the y offset of the scroll event

failed for a unspecified reason

the implementation is too old

no such resource was found