gl: Enable autogeneration of GstGLBaseSrc

This commit is contained in:
Marijn Suijten 2021-04-29 18:00:56 +02:00
parent f89e840d27
commit bdb60b57ad
3 changed files with 108 additions and 0 deletions

View file

@ -34,6 +34,7 @@ generate = [
# Objects
#"GstGL.GLBufferPool",
"GstGL.GLBaseMemoryAllocator",
"GstGL.GLBaseSrc",
"GstGL.GLMemoryAllocator",
#"GstGL.GLMemoryPBOAllocator",
#"GstGL.GLRenderbufferAllocator",
@ -51,6 +52,7 @@ manual = [
"Gst.Memory",
"Gst.Object",
"Gst.PadDirection",
"GstBase.BaseSrc",
"GstBase.BaseTransform",
"GstBase.PushSrc",
"GstGL.GLBaseMemory",

View file

@ -0,0 +1,96 @@
// 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::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
use glib::ToValue;
use std::boxed::Box as Box_;
use std::mem::transmute;
glib::wrapper! {
pub struct GLBaseSrc(Object<ffi::GstGLBaseSrc, ffi::GstGLBaseSrcClass>) @extends gst_base::PushSrc, gst_base::BaseSrc, gst::Element, gst::Object;
match fn {
type_ => || ffi::gst_gl_base_src_get_type(),
}
}
unsafe impl Send for GLBaseSrc {}
unsafe impl Sync for GLBaseSrc {}
pub const NONE_GL_BASE_SRC: Option<&GLBaseSrc> = None;
pub trait GLBaseSrcExt: 'static {
#[doc(alias = "get_property_timestamp_offset")]
fn timestamp_offset(&self) -> i64;
#[doc(alias = "set_property_timestamp_offset")]
fn set_timestamp_offset(&self, timestamp_offset: i64);
fn connect_property_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<GLBaseSrc>> GLBaseSrcExt for O {
fn timestamp_offset(&self) -> i64 {
unsafe {
let mut value = glib::Value::from_type(<i64 as StaticType>::static_type());
glib::gobject_ffi::g_object_get_property(
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"timestamp-offset\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `timestamp-offset` getter")
}
}
fn set_timestamp_offset(&self, timestamp_offset: i64) {
unsafe {
glib::gobject_ffi::g_object_set_property(
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"timestamp-offset\0".as_ptr() as *const _,
timestamp_offset.to_value().to_glib_none().0,
);
}
}
fn connect_property_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_timestamp_offset_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstGLBaseSrc,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) where
P: IsA<GLBaseSrc>,
{
let f: &F = &*(f as *const F);
f(&GLBaseSrc::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::timestamp-offset\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_timestamp_offset_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -9,6 +9,13 @@ 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};
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
mod gl_base_src;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
pub use self::gl_base_src::{GLBaseSrc, NONE_GL_BASE_SRC};
mod gl_color_convert;
pub use self::gl_color_convert::GLColorConvert;
@ -71,6 +78,9 @@ pub use self::flags::GLAPI;
#[doc(hidden)]
pub mod traits {
pub use super::gl_base_filter::GLBaseFilterExt;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
pub use super::gl_base_src::GLBaseSrcExt;
pub use super::gl_context::GLContextExt;
pub use super::gl_display::GLDisplayExt;
pub use super::gl_filter::GLFilterExt;