diff --git a/gstreamer-gl/Gir.toml b/gstreamer-gl/Gir.toml index 23341f286..f171caa48 100644 --- a/gstreamer-gl/Gir.toml +++ b/gstreamer-gl/Gir.toml @@ -507,3 +507,29 @@ status = "generate" name = "attach" # attachment_point parameter unchecked unsafe = true + +[[object]] +name = "GstGL.GLFilter" +status = "generate" + + [[object.function]] + name = "add_rgba_pad_templates" + # Automatically called if + # GLFilterImpl::ADD_RGBA_PAD_TEMPLATES is true + ignore = true + + [[object.function]] + pattern = "render_to_target\\w*" + [[object.function.parameter]] + pattern = "input|output" + const = true + + [[object.function]] + name = "render_to_target" + [object.function.return] + bool_return_is_error = "`func` returned `false`" + + [[object.function]] + name = "filter_texture" + [object.function.return] + bool_return_is_error = "Failed to transform texture" diff --git a/gstreamer-gl/src/lib.rs b/gstreamer-gl/src/lib.rs index ee6c6243d..2b271e797 100644 --- a/gstreamer-gl/src/lib.rs +++ b/gstreamer-gl/src/lib.rs @@ -58,3 +58,5 @@ pub mod prelude { pub use crate::gl_context::GLContextExtManual; pub use crate::gl_video_frame::VideoFrameGLExt; } + +pub mod subclass; diff --git a/gstreamer-gl/src/subclass/gl_filter.rs b/gstreamer-gl/src/subclass/gl_filter.rs index 58a6ee98f..20e55c4ac 100644 --- a/gstreamer-gl/src/subclass/gl_filter.rs +++ b/gstreamer-gl/src/subclass/gl_filter.rs @@ -21,6 +21,10 @@ pub enum GLFilterMode { pub trait GLFilterImpl: GLFilterImplExt + GLBaseFilterImpl { const MODE: GLFilterMode; + // rustdoc-stripper-ignore-next + /// Calls [`add_rgba_pad_templates`](ffi::gst_gl_filter_add_rgba_pad_templates) + /// in [`GLFilter::class_init`] if [`true`]. + const ADD_RGBA_PAD_TEMPLATES: bool = true; fn set_caps( &self, @@ -239,6 +243,10 @@ unsafe impl IsSubclassable for GLFilter { klass.filter_texture = Some(filter_texture::); } } + + if ::ADD_RGBA_PAD_TEMPLATES { + unsafe { ffi::gst_gl_filter_add_rgba_pad_templates(klass) } + } } fn instance_init(instance: &mut glib::subclass::InitializingObject) {