gl/gir: Configure generation for GLFilter with miniobject quirks

GLMemory input/output objects cannot be passed as mutable:
to_glib_none_mut checks if the miniobject is writable, even though the
underlying implementation should really only care about whether the
_data_ owned by this miniobject is.

(This temporary GLMemory object references its parent buffer object
 that is also referenced externally, resulting in two references making
 the object itself immutable)

Furthermore take care of automatically calling `add_rgba_pad_templates`
in `class_init` if `ADD_RGBA_PAD_TEMPLATES` is set to `true` (the
default).
This commit is contained in:
Marijn Suijten 2020-08-28 13:22:10 +02:00 committed by Sebastian Dröge
parent 0d338a003e
commit 01f0988a48
3 changed files with 36 additions and 0 deletions

View file

@ -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"

View file

@ -58,3 +58,5 @@ pub mod prelude {
pub use crate::gl_context::GLContextExtManual;
pub use crate::gl_video_frame::VideoFrameGLExt;
}
pub mod subclass;

View file

@ -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<T: GLFilterImpl> IsSubclassable<T> for GLFilter {
klass.filter_texture = Some(filter_texture::<T>);
}
}
if <T as GLFilterImpl>::ADD_RGBA_PAD_TEMPLATES {
unsafe { ffi::gst_gl_filter_add_rgba_pad_templates(klass) }
}
}
fn instance_init(instance: &mut glib::subclass::InitializingObject<T>) {