Add GstGL bindings

parent e0953efd
......@@ -13,4 +13,5 @@ ignore = [
"gstreamer-video/src/auto",
"gstreamer-webrtc/src/auto",
"gstreamer-editing-services/src/auto",
"gstreamer-gl/src/auto",
]
......@@ -15,6 +15,7 @@ members = [
"gstreamer-webrtc",
"gstreamer-check",
"gstreamer-editing-services",
"gstreamer-gl",
"examples",
"tutorials",
]
[options]
girs_dir = "gir-files"
library = "GstGL"
version = "1.0"
min_cfg_version = "1.14"
target_path = "gstreamer-gl"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
single_version_file = true
external_libraries = [
"GLib",
"GObject",
"Gst",
"GstBase",
"GstVideo",
]
generate = [
# BitFlags
"GstGL.GLAPI",
"GstGL.GLDisplayType",
"GstGL.GLPlatform",
"GstGL.GLSLProfile",
# Enums
"GstGL.GLFormat",
"GstGL.GLQueryType",
"GstGL.GLSLVersion",
"GstGL.GLTextureTarget",
"GstGL.GLStereoDownmix",
"GstGL.GLUploadReturn",
# Enums Errors
#"GstGL.GLBaseMemoryError",
"GstGL.GLContextError",
"GstGL.GLSLError",
"GstGL.GLWindowError",
# Records
#"GstGL.GLAllocationParams",
#"GstGL.GLRenderbufferAllocationParams",
#"GstGL.GLVideoAllocationParams",
# Objects
"GstGL.GLBaseFilter",
#"GstGL.GLBufferPool",
"GstGL.GLFramebuffer",
#"GstGL.GLBaseMemory",
#"GstGL.GLBaseMemoryAllocator",
#"GstGL.GLMemoryPBOAllocator",
#"GstGL.GLRenderbufferAllocator",
]
manual = [
"GLib.Error",
"GLib.Thread",
"GObject.Object",
"Gst.Object",
"Gst.FlowReturn",
"Gst.PadDirection",
"GstVideo.VideoMultiviewFlags",
"GstVideo.VideoMultiviewMode",
]
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref-mut"
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Query"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstGL.GLBuffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstGL.GLQuery"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstGL.GLContext"
status = "generate"
[[object.function]]
name = "new_wrapped"
# input handle
ignore = true
[[object.function]]
name = "get_gl_context"
# return handle
ignore = true
[[object.function]]
name = "get_current_gl_context"
# return handle
ignore = true
[[object.function]]
name = "get_proc_address"
ignore = true
[[object.function]]
name = "default_get_proc_address"
ignore = true
[[object.function]]
name = "get_proc_address_with_platform"
ignore = true
[[object.function]]
name = "thread_add"
# unimplemented GLContextThreadFunc
ignore = true
[[object.function]]
name = "get_thread"
# glib::Thread not found in `glib`
ignore = true
[[object.function]]
name = "get_gl_context_for_thread"
# glib::Thread not found in `glib`
ignore = true
[[object.function]]
name = "error_quark"
# bad error domian definition in gir
ignore = true
[[object.function]]
name = "activate"
[object.function.return]
bool_return_is_error = "Failed to activate OpenGL context"
[[object.function]]
name = "get_display"
[object.function.return]
nullable = false
[[object]]
name = "GstGL.GLDisplay"
status = "generate"
[[object.function]]
name = "find_window"
# unimplemented pointer
ignore = true
[[object.function]]
name = "get_handle"
# return handle
ignore = true
[[object.function]]
name = "get_gl_context_for_thread"
# glib::Thread not found in `glib`
ignore = true
[[object.function]]
name = "add_context"
[object.function.return]
bool_return_is_error = "Failed to add OpenGL context"
[[object.function]]
name = "remove_window"
[object.function.return]
bool_return_is_error = "Failed to remove window"
[[object]]
name = "GstGL.GLDisplayEGL"
status = "generate"
trait = false
cfg_condition = "feature = \"egl\""
[[object]]
name = "GstGL.GLWindow"
status = "generate"
[[object.function]]
name = "get_window_handle"
# return native handle
ignore = true
[[object.function]]
name = "send_message"
# callback
ignore = true
[[object.function]]
name = "send_message_async"
# callback
ignore = true
[[object.function]]
name = "set_close_callback"
# callback
ignore = true
[[object.function]]
name = "set_draw_callback"
# callback
ignore = true
[[object.function]]
name = "set_resize_callback"
# callback
ignore = true
[[object.function]]
name = "set_window_handle"
# handle
ignore = true
[[object.function]]
name = "get_display"
# handle
ignore = true
[[object.function]]
name = "error_quark"
# bad error domian definition in gir
ignore = true
[[object]]
name = "GstGL.GLColorConvert"
status = "generate"
trait = false
[[object.function]]
name = "decide_allocation"
# correct mutability
ignore = true
[[object.function]]
name = "fixate_caps"
# correct reference ownership
ignore = true
[[object.function]]
name = "perform"
# transfer gst::Buffer not reference
ignore = true
[[object]]
name = "GstGL.GLOverlayCompositor"
status = "generate"
trait = false
[[object.function]]
name = "upload_overlays"
# correct mutability
ignore = true
[[object]]
name = "GstGL.GLSLStage"
status = "generate"
trait = false
[[object]]
name = "GstGL.GLShader"
status = "generate"
trait = false
[[object.function]]
name = "set_uniform_matrix_2fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_2x3fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_2x4fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_3fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_3x2fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_3x4fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_4fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_4x2fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_4x3fv"
# array with size
ignore = true
[[object]]
name = "GstGL.GLUpload"
status = "generate"
trait = false
[[object.function]]
name = "perform_with_buffer"
# Result<Buffer, GLUploadReturn>
ignore = true
[[object.function]]
name = "propose_allocation"
# fix mutability
ignore = true
[[object.function]]
name = "get_input_template_caps"
[object.function.return]
nullable = false
[[object]]
name = "GstGL.GLViewConvert"
status = "generate"
trait = false
[[object.function]]
name = "fixate_caps"
# correct reference ownership
ignore = true
[[object.function]]
name = "get_output"
# Result<Buffer, FlowReturn>
ignore = true
[[object.function]]
name = "tranform_caps"
[object.function.return]
nullable = false
[[object.function]]
name = "submit_input_buffer"
# Buffer ownership transfer
ignore = true
<!-- file * -->
<!-- struct GLBaseFilter -->
`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.GLBaseFilterExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
<!-- trait GLBaseFilterExt -->
Trait containing all `GLBaseFilter` methods.
# Implementors
[`GLBaseFilter`](struct.GLBaseFilter.html)
<!-- struct GLBuffer -->
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.
<!-- impl GLBuffer::fn init_once -->
Initializes the GL Buffer allocator. It is safe to call this function
multiple times. This must be called before any other `GLBuffer` operation.
<!-- struct GLColorConvert -->
`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
[`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
<!-- impl GLColorConvert::fn new -->
## `context`
a `GLContext`
# Returns
a new `GLColorConvert` object
<!-- impl GLColorConvert::fn fixate_caps -->
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`
<!-- impl GLColorConvert::fn transform_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`
<!-- impl GLColorConvert::fn decide_allocation -->
Provides an implementation of `GstBaseTransfromClass::decide_allocation`()
## `query`
a completed ALLOCATION `gst::Query`
# Returns
whether the allocation parameters were successfully chosen
<!-- impl GLColorConvert::fn perform -->
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`
<!-- impl GLColorConvert::fn set_caps -->
Initializes `self` with the information required for conversion.
## `in_caps`
input `gst::Caps`
## `out_caps`
output `gst::Caps`
<!-- struct GLContext -->
`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.
# Implements
[`GLContextExt`](trait.GLContextExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
<!-- trait GLContextExt -->
Trait containing all `GLContext` methods.
# Implementors
[`GLContext`](struct.GLContext.html)
<!-- impl GLContext::fn new -->
Create a new `GLContext` with the specified `display`
## `display`
a `GLDisplay`
# Returns
a new `GLContext`
<!-- impl GLContext::fn new_wrapped -->
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.
## `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`
<!-- impl GLContext::fn default_get_proc_address -->
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`
<!-- impl GLContext::fn get_current -->
See also `GLContextExt::activate`.
# Returns
the `GLContext` active in the current thread or `None`
<!-- impl GLContext::fn get_current_gl_api -->
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`
<!-- impl GLContext::fn get_current_gl_context -->
## `context_type`
a `GLPlatform` specifying the type of context to retrieve
# Returns
The OpenGL context handle current in the calling thread or `None`
<!-- impl GLContext::fn get_proc_address_with_platform -->
Attempts to use the `context_type` specific GetProcAddress implementations
to retreive `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`
<!-- trait GLContextExt::fn activate -->
(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
<!-- trait GLContextExt::fn can_share -->
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.
<!-- trait GLContextExt::fn check_feature -->
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`
<!-- trait GLContextExt::fn check_framebuffer_status -->
## `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
<!-- trait GLContextExt::fn check_gl_version -->
## `api`
api type required
## `maj`
major version required
## `min`
minor version required
# Returns
whether OpenGL context implements the required api and specified
version.
<!-- trait GLContextExt::fn clear_framebuffer -->
Unbind the current framebuffer
<!-- trait GLContextExt::fn clear_shader -->
Clear's the currently set shader from the GL state machine.
Note: must be called in the GL thread.
<!-- trait GLContextExt::fn create -->
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
<!-- trait GLContextExt::fn destroy -->
Destroys an OpenGL context.
Should only be called after `GLContextExt::create` has been successfully
called for this context.
<!-- trait GLContextExt::fn fill_info -->
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.
<!-- trait GLContextExt::fn get_display -->
# Returns
the `GLDisplay` associated with this `self`
<!-- trait GLContextExt::fn get_gl_api -->
Get the currently enabled OpenGL api.
The currently available API may be limited by the `GLDisplay` in use and/or
the `GLWindow` chosen.