diff --git a/docs/gstreamer-gl/docs.md b/docs/gstreamer-gl/docs.md index afb7061fb..742f2f016 100644 --- a/docs/gstreamer-gl/docs.md +++ b/docs/gstreamer-gl/docs.md @@ -13,25 +13,67 @@ 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. -Feature: `v1_16` - # Implements -[`GLBaseFilterExt`](trait.GLBaseFilterExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html) +[`GLBaseFilterExt`](trait.GLBaseFilterExt.html), [`gst_base::BaseTransformExt`](../gst_base/trait.BaseTransformExt.html), [`gst::ElementExt`](../gst/trait.ElementExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html) Trait containing all `GLBaseFilter` methods. -Feature: `v1_16` - # Implementors -[`GLBaseFilter`](struct.GLBaseFilter.html) +[`GLBaseFilter`](struct.GLBaseFilter.html), [`GLFilter`](struct.GLFilter.html) Feature: `v1_16` @@ -48,6 +90,66 @@ 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 + +[`gst::AllocatorExt`](../gst/trait.AllocatorExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html) `GLColorConvert` is an object that converts between color spaces and/or formats using OpenGL Shaders. @@ -629,6 +731,58 @@ 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`](trait.GLFilterExt.html), [`GLBaseFilterExt`](trait.GLBaseFilterExt.html), [`gst_base::BaseTransformExt`](../gst_base/trait.BaseTransformExt.html), [`gst::ElementExt`](../gst/trait.ElementExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html) + +Trait containing all `GLFilter` methods. + +# Implementors + +[`GLFilter`](struct.GLFilter.html) + +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 @@ -746,6 +900,20 @@ output height # Returns the OpenGL id for `self` + +Opaque `GLMemoryAllocator` struct + +# Implements + +[`GLBaseMemoryAllocatorExt`](trait.GLBaseMemoryAllocatorExt.html), [`gst::AllocatorExt`](../gst/trait.AllocatorExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html) + +## `context` +a `GLContext` + +# Returns + +the default `GLMemoryAllocator` supported by + `context` Opaque `GLOverlayCompositor` object @@ -1421,6 +1589,148 @@ 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. diff --git a/gstreamer-gl/src/auto/enums.rs b/gstreamer-gl/src/auto/enums.rs index 0fb78502e..0758f54f1 100644 --- a/gstreamer-gl/src/auto/enums.rs +++ b/gstreamer-gl/src/auto/enums.rs @@ -3,13 +3,9 @@ // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT -#[cfg(any(feature = "v1_16", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use crate::GLContext; use crate::GLSLProfile; use glib::error::ErrorDomain; -#[cfg(any(feature = "v1_16", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use glib::object::IsA; use glib::translate::*; use glib::value::FromValue; @@ -169,10 +165,21 @@ pub enum GLFormat { } impl GLFormat { - //#[doc(alias = "gst_gl_format_from_video_info")] - //pub fn from_video_info>(context: &P, vinfo: /*Ignored*/&mut gst_video::VideoInfo, plane: u32) -> GLFormat { - // unsafe { TODO: call ffi:gst_gl_format_from_video_info() } - //} + #[doc(alias = "gst_gl_format_from_video_info")] + pub fn from_video_info>( + context: &P, + vinfo: &gst_video::VideoInfo, + plane: u32, + ) -> GLFormat { + skip_assert_initialized!(); + unsafe { + from_glib(ffi::gst_gl_format_from_video_info( + context.as_ref().to_glib_none().0, + mut_override(vinfo.to_glib_none().0), + plane, + )) + } + } #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] diff --git a/gstreamer-gl/src/auto/gl_allocation_params.rs b/gstreamer-gl/src/auto/gl_allocation_params.rs new file mode 100644 index 000000000..29abe4700 --- /dev/null +++ b/gstreamer-gl/src/auto/gl_allocation_params.rs @@ -0,0 +1,37 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct GLAllocationParams(Boxed); + + match fn { + copy => |ptr| ffi::gst_gl_allocation_params_copy(mut_override(ptr)), + free => |ptr| ffi::gst_gl_allocation_params_free(ptr), + get_type => || ffi::gst_gl_allocation_params_get_type(), + } +} + +impl GLAllocationParams { + #[doc(alias = "gst_gl_allocation_params_copy_data")] + pub fn copy_data(&self, dest: &mut GLAllocationParams) { + unsafe { + ffi::gst_gl_allocation_params_copy_data( + mut_override(self.to_glib_none().0), + dest.to_glib_none_mut().0, + ); + } + } + + //#[doc(alias = "gst_gl_allocation_params_init")] + //pub fn init>(&mut self, struct_size: usize, alloc_flags: u32, copy: P, free: /*Unimplemented*/Fn(/*Unimplemented*/Option), context: &Q, alloc_size: usize, alloc_params: Option<&mut gst::AllocationParams>, wrapped_data: /*Unimplemented*/Option, gl_handle: /*Unimplemented*/Option, user_data: /*Unimplemented*/Option) -> bool { + // unsafe { TODO: call ffi:gst_gl_allocation_params_init() } + //} +} + +unsafe impl Send for GLAllocationParams {} +unsafe impl Sync for GLAllocationParams {} diff --git a/gstreamer-gl/src/auto/gl_base_filter.rs b/gstreamer-gl/src/auto/gl_base_filter.rs index 0fddb8ee0..e46b2640b 100644 --- a/gstreamer-gl/src/auto/gl_base_filter.rs +++ b/gstreamer-gl/src/auto/gl_base_filter.rs @@ -14,7 +14,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib::wrapper! { - pub struct GLBaseFilter(Object) @extends gst::Object; + pub struct GLBaseFilter(Object) @extends gst_base::BaseTransform, gst::Element, gst::Object; match fn { get_type => || ffi::gst_gl_base_filter_get_type(), @@ -27,6 +27,8 @@ unsafe impl Sync for GLBaseFilter {} pub const NONE_GL_BASE_FILTER: Option<&GLBaseFilter> = None; pub trait GLBaseFilterExt: 'static { + #[cfg(any(feature = "v1_16", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[doc(alias = "gst_gl_base_filter_find_gl_context")] fn find_gl_context(&self) -> bool; @@ -45,6 +47,8 @@ pub trait GLBaseFilterExt: 'static { } impl> GLBaseFilterExt for O { + #[cfg(any(feature = "v1_16", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] fn find_gl_context(&self) -> bool { unsafe { from_glib(ffi::gst_gl_base_filter_find_gl_context( diff --git a/gstreamer-gl/src/auto/gl_base_memory_allocator.rs b/gstreamer-gl/src/auto/gl_base_memory_allocator.rs new file mode 100644 index 000000000..6b463e83d --- /dev/null +++ b/gstreamer-gl/src/auto/gl_base_memory_allocator.rs @@ -0,0 +1,19 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +glib::wrapper! { + pub struct GLBaseMemoryAllocator(Object) @extends gst::Allocator, gst::Object; + + match fn { + get_type => || ffi::gst_gl_base_memory_allocator_get_type(), + } +} + +impl GLBaseMemoryAllocator {} + +unsafe impl Send for GLBaseMemoryAllocator {} +unsafe impl Sync for GLBaseMemoryAllocator {} + +pub const NONE_GL_BASE_MEMORY_ALLOCATOR: Option<&GLBaseMemoryAllocator> = None; diff --git a/gstreamer-gl/src/auto/gl_filter.rs b/gstreamer-gl/src/auto/gl_filter.rs new file mode 100644 index 000000000..c32ff9ec3 --- /dev/null +++ b/gstreamer-gl/src/auto/gl_filter.rs @@ -0,0 +1,116 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::GLBaseFilter; +use crate::GLMemory; +use crate::GLShader; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + pub struct GLFilter(Object) @extends GLBaseFilter, gst_base::BaseTransform, gst::Element, gst::Object; + + match fn { + get_type => || ffi::gst_gl_filter_get_type(), + } +} + +unsafe impl Send for GLFilter {} +unsafe impl Sync for GLFilter {} + +pub const NONE_GL_FILTER: Option<&GLFilter> = None; + +pub trait GLFilterExt: 'static { + #[doc(alias = "gst_gl_filter_draw_fullscreen_quad")] + fn draw_fullscreen_quad(&self); + + #[doc(alias = "gst_gl_filter_filter_texture")] + fn filter_texture( + &self, + input: &gst::Buffer, + output: &gst::Buffer, + ) -> Result<(), glib::error::BoolError>; + + #[doc(alias = "gst_gl_filter_render_to_target")] + fn render_to_target bool>( + &self, + input: &GLMemory, + output: &GLMemory, + func: P, + ) -> Result<(), glib::error::BoolError>; + + #[doc(alias = "gst_gl_filter_render_to_target_with_shader")] + fn render_to_target_with_shader(&self, input: &GLMemory, output: &GLMemory, shader: &GLShader); +} + +impl> GLFilterExt for O { + fn draw_fullscreen_quad(&self) { + unsafe { + ffi::gst_gl_filter_draw_fullscreen_quad(self.as_ref().to_glib_none().0); + } + } + + fn filter_texture( + &self, + input: &gst::Buffer, + output: &gst::Buffer, + ) -> Result<(), glib::error::BoolError> { + unsafe { + glib::result_from_gboolean!( + ffi::gst_gl_filter_filter_texture( + self.as_ref().to_glib_none().0, + input.to_glib_none().0, + output.to_glib_none().0 + ), + "Failed to transform texture" + ) + } + } + + fn render_to_target bool>( + &self, + input: &GLMemory, + output: &GLMemory, + func: P, + ) -> Result<(), glib::error::BoolError> { + let func_data: P = func; + unsafe extern "C" fn func_func bool>( + filter: *mut ffi::GstGLFilter, + in_tex: *mut ffi::GstGLMemory, + user_data: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let filter = from_glib_borrow(filter); + let in_tex = from_glib_borrow(in_tex); + let callback: *mut P = user_data as *const _ as usize as *mut P; + let res = (*callback)(&filter, &in_tex); + res.to_glib() + } + let func = Some(func_func::

as _); + let super_callback0: &P = &func_data; + unsafe { + glib::result_from_gboolean!( + ffi::gst_gl_filter_render_to_target( + self.as_ref().to_glib_none().0, + mut_override(input.to_glib_none().0), + mut_override(output.to_glib_none().0), + func, + super_callback0 as *const _ as usize as *mut _ + ), + "`func` returned `false`" + ) + } + } + + fn render_to_target_with_shader(&self, input: &GLMemory, output: &GLMemory, shader: &GLShader) { + unsafe { + ffi::gst_gl_filter_render_to_target_with_shader( + self.as_ref().to_glib_none().0, + mut_override(input.to_glib_none().0), + mut_override(output.to_glib_none().0), + shader.to_glib_none().0, + ); + } + } +} diff --git a/gstreamer-gl/src/auto/gl_framebuffer.rs b/gstreamer-gl/src/auto/gl_framebuffer.rs index 928de900e..bf109c660 100644 --- a/gstreamer-gl/src/auto/gl_framebuffer.rs +++ b/gstreamer-gl/src/auto/gl_framebuffer.rs @@ -3,6 +3,7 @@ // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT +use crate::GLBaseMemory; use crate::GLContext; use glib::object::IsA; use glib::translate::*; @@ -50,14 +51,14 @@ unsafe impl Sync for GLFramebuffer {} pub const NONE_GL_FRAMEBUFFER: Option<&GLFramebuffer> = None; pub trait GLFramebufferExt: 'static { - //#[doc(alias = "gst_gl_framebuffer_attach")] - //fn attach(&self, attachment_point: u32, mem: /*Ignored*/&mut GLBaseMemory); + #[doc(alias = "gst_gl_framebuffer_attach")] + unsafe fn attach(&self, attachment_point: u32, mem: &mut GLBaseMemory); #[doc(alias = "gst_gl_framebuffer_bind")] fn bind(&self); //#[doc(alias = "gst_gl_framebuffer_draw_to_texture")] - //fn draw_to_texture(&self, mem: /*Ignored*/&mut GLMemory, func: /*Unimplemented*/FnMut(/*Unimplemented*/Option) -> bool, user_data: /*Unimplemented*/Option) -> bool; + //fn draw_to_texture(&self, mem: &mut GLMemory, func: /*Unimplemented*/FnMut(/*Unimplemented*/Option) -> bool, user_data: /*Unimplemented*/Option) -> bool; #[doc(alias = "gst_gl_framebuffer_get_effective_dimensions")] fn effective_dimensions(&self) -> (u32, u32); @@ -67,9 +68,13 @@ pub trait GLFramebufferExt: 'static { } impl> GLFramebufferExt for O { - //fn attach(&self, attachment_point: u32, mem: /*Ignored*/&mut GLBaseMemory) { - // unsafe { TODO: call ffi:gst_gl_framebuffer_attach() } - //} + unsafe fn attach(&self, attachment_point: u32, mem: &mut GLBaseMemory) { + ffi::gst_gl_framebuffer_attach( + self.as_ref().to_glib_none().0, + attachment_point, + mem.to_glib_none_mut().0, + ); + } fn bind(&self) { unsafe { @@ -77,7 +82,7 @@ impl> GLFramebufferExt for O { } } - //fn draw_to_texture(&self, mem: /*Ignored*/&mut GLMemory, func: /*Unimplemented*/FnMut(/*Unimplemented*/Option) -> bool, user_data: /*Unimplemented*/Option) -> bool { + //fn draw_to_texture(&self, mem: &mut GLMemory, func: /*Unimplemented*/FnMut(/*Unimplemented*/Option) -> bool, user_data: /*Unimplemented*/Option) -> bool { // unsafe { TODO: call ffi:gst_gl_framebuffer_draw_to_texture() } //} diff --git a/gstreamer-gl/src/auto/gl_memory_allocator.rs b/gstreamer-gl/src/auto/gl_memory_allocator.rs new file mode 100644 index 000000000..960b22dd0 --- /dev/null +++ b/gstreamer-gl/src/auto/gl_memory_allocator.rs @@ -0,0 +1,34 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::GLBaseMemoryAllocator; +use crate::GLContext; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + pub struct GLMemoryAllocator(Object) @extends GLBaseMemoryAllocator, gst::Allocator, gst::Object; + + match fn { + get_type => || ffi::gst_gl_memory_allocator_get_type(), + } +} + +impl GLMemoryAllocator { + #[doc(alias = "gst_gl_memory_allocator_get_default")] + pub fn get_default>(context: &P) -> Option { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_gl_memory_allocator_get_default( + context.as_ref().to_glib_none().0, + )) + } + } +} + +unsafe impl Send for GLMemoryAllocator {} +unsafe impl Sync for GLMemoryAllocator {} + +pub const NONE_GL_MEMORY_ALLOCATOR: Option<&GLMemoryAllocator> = None; diff --git a/gstreamer-gl/src/auto/gl_video_allocation_params.rs b/gstreamer-gl/src/auto/gl_video_allocation_params.rs new file mode 100644 index 000000000..ac9c7ac0e --- /dev/null +++ b/gstreamer-gl/src/auto/gl_video_allocation_params.rs @@ -0,0 +1,80 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::GLContext; +use crate::GLFormat; +use crate::GLTextureTarget; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct GLVideoAllocationParams(Boxed); + + match fn { + copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_gl_video_allocation_params_get_type(), ptr as *mut _) as *mut ffi::GstGLVideoAllocationParams, + free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_gl_video_allocation_params_get_type(), ptr as *mut _), + get_type => || ffi::gst_gl_video_allocation_params_get_type(), + } +} + +impl GLVideoAllocationParams { + #[doc(alias = "gst_gl_video_allocation_params_new")] + pub fn new>( + context: &P, + alloc_params: Option<&gst::AllocationParams>, + v_info: &gst_video::VideoInfo, + plane: u32, + valign: Option<&gst_video::VideoAlignment>, + target: GLTextureTarget, + tex_format: GLFormat, + ) -> GLVideoAllocationParams { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_gl_video_allocation_params_new( + context.as_ref().to_glib_none().0, + mut_override(alloc_params.to_glib_none().0), + mut_override(v_info.to_glib_none().0), + plane, + mut_override(valign.to_glib_none().0), + target.to_glib(), + tex_format.to_glib(), + )) + } + } + + //#[doc(alias = "gst_gl_video_allocation_params_new_wrapped_data")] + //pub fn new_wrapped_data>(context: &P, alloc_params: Option<&mut gst::AllocationParams>, v_info: &mut gst_video::VideoInfo, plane: u32, valign: Option<&mut gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, wrapped_data: /*Unimplemented*/Option, user_data: /*Unimplemented*/Option) -> GLVideoAllocationParams { + // unsafe { TODO: call ffi:gst_gl_video_allocation_params_new_wrapped_data() } + //} + + //#[doc(alias = "gst_gl_video_allocation_params_new_wrapped_gl_handle")] + //pub fn new_wrapped_gl_handle>(context: &P, alloc_params: Option<&mut gst::AllocationParams>, v_info: &mut gst_video::VideoInfo, plane: u32, valign: Option<&mut gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, gl_handle: /*Unimplemented*/Option, user_data: /*Unimplemented*/Option) -> GLVideoAllocationParams { + // unsafe { TODO: call ffi:gst_gl_video_allocation_params_new_wrapped_gl_handle() } + //} + + //#[doc(alias = "gst_gl_video_allocation_params_new_wrapped_texture")] + //pub fn new_wrapped_texture>(context: &P, alloc_params: Option<&mut gst::AllocationParams>, v_info: &mut gst_video::VideoInfo, plane: u32, valign: Option<&mut gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, tex_id: u32, user_data: /*Unimplemented*/Option) -> GLVideoAllocationParams { + // unsafe { TODO: call ffi:gst_gl_video_allocation_params_new_wrapped_texture() } + //} + + #[doc(alias = "gst_gl_video_allocation_params_copy_data")] + pub fn copy_data(&self, dest_vid: &mut GLVideoAllocationParams) { + unsafe { + ffi::gst_gl_video_allocation_params_copy_data( + mut_override(self.to_glib_none().0), + dest_vid.to_glib_none_mut().0, + ); + } + } + + //#[doc(alias = "gst_gl_video_allocation_params_init_full")] + //pub fn init_full>(&mut self, struct_size: usize, alloc_flags: u32, copy: P, free: /*Unimplemented*/Fn(/*Unimplemented*/Option), context: &Q, alloc_params: Option<&mut gst::AllocationParams>, v_info: &mut gst_video::VideoInfo, plane: u32, valign: Option<&mut gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, wrapped_data: /*Unimplemented*/Option, gl_handle: /*Unimplemented*/Option, user_data: /*Unimplemented*/Option) -> bool { + // unsafe { TODO: call ffi:gst_gl_video_allocation_params_init_full() } + //} +} + +unsafe impl Send for GLVideoAllocationParams {} +unsafe impl Sync for GLVideoAllocationParams {} diff --git a/gstreamer-gl/src/auto/mod.rs b/gstreamer-gl/src/auto/mod.rs index df4dd060d..4ce7b400c 100644 --- a/gstreamer-gl/src/auto/mod.rs +++ b/gstreamer-gl/src/auto/mod.rs @@ -3,16 +3,13 @@ // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT -#[cfg(any(feature = "v1_16", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] mod gl_base_filter; -#[cfg(any(feature = "v1_16", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use self::gl_base_filter::GLBaseFilterExt; -#[cfg(any(feature = "v1_16", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use self::gl_base_filter::{GLBaseFilter, NONE_GL_BASE_FILTER}; +mod gl_base_memory_allocator; +pub use self::gl_base_memory_allocator::{GLBaseMemoryAllocator, NONE_GL_BASE_MEMORY_ALLOCATOR}; + mod gl_color_convert; pub use self::gl_color_convert::GLColorConvert; @@ -24,10 +21,17 @@ mod gl_display; pub use self::gl_display::GLDisplayExt; pub use self::gl_display::{GLDisplay, NONE_GL_DISPLAY}; +mod gl_filter; +pub use self::gl_filter::GLFilterExt; +pub use self::gl_filter::{GLFilter, NONE_GL_FILTER}; + mod gl_framebuffer; pub use self::gl_framebuffer::GLFramebufferExt; pub use self::gl_framebuffer::{GLFramebuffer, NONE_GL_FRAMEBUFFER}; +mod gl_memory_allocator; +pub use self::gl_memory_allocator::{GLMemoryAllocator, NONE_GL_MEMORY_ALLOCATOR}; + mod gl_overlay_compositor; pub use self::gl_overlay_compositor::GLOverlayCompositor; @@ -47,6 +51,12 @@ mod gl_window; pub use self::gl_window::GLWindowExt; pub use self::gl_window::{GLWindow, NONE_GL_WINDOW}; +mod gl_allocation_params; +pub use self::gl_allocation_params::GLAllocationParams; + +mod gl_video_allocation_params; +pub use self::gl_video_allocation_params::GLVideoAllocationParams; + mod enums; pub use self::enums::GLContextError; pub use self::enums::GLFormat; @@ -66,11 +76,10 @@ pub use self::flags::GLAPI; #[doc(hidden)] pub mod traits { - #[cfg(any(feature = "v1_16", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use super::GLBaseFilterExt; pub use super::GLContextExt; pub use super::GLDisplayExt; + pub use super::GLFilterExt; pub use super::GLFramebufferExt; pub use super::GLWindowExt; }