gstreamer-rs/gstreamer-gl/src/auto/gl_base_filter.rs

96 lines
2.9 KiB
Rust
Raw Normal View History

2018-11-27 21:52:42 +00:00
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
2019-01-16 11:32:39 +00:00
use glib::object::Cast;
2018-11-27 21:52:42 +00:00
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
2018-11-27 21:52:42 +00:00
use glib::translate::*;
use glib::StaticType;
use glib::Value;
2019-03-19 07:40:05 +00:00
use glib_sys;
use gobject_sys;
2018-11-27 21:52:42 +00:00
use gst;
2019-03-19 07:40:05 +00:00
use gst_gl_sys;
2018-11-27 21:52:42 +00:00
use std::boxed::Box as Box_;
2020-04-13 16:11:33 +00:00
use std::mem::transmute;
use GLContext;
2018-11-27 21:52:42 +00:00
glib_wrapper! {
2019-03-19 07:40:05 +00:00
pub struct GLBaseFilter(Object<gst_gl_sys::GstGLBaseFilter, gst_gl_sys::GstGLBaseFilterClass, GLBaseFilterClass>) @extends gst::Object;
2018-11-27 21:52:42 +00:00
match fn {
2019-03-19 07:40:05 +00:00
get_type => || gst_gl_sys::gst_gl_base_filter_get_type(),
2018-11-27 21:52:42 +00:00
}
}
unsafe impl Send for GLBaseFilter {}
unsafe impl Sync for GLBaseFilter {}
2019-01-16 11:32:39 +00:00
pub const NONE_GL_BASE_FILTER: Option<&GLBaseFilter> = None;
pub trait GLBaseFilterExt: 'static {
2019-04-23 14:32:09 +00:00
#[cfg(any(feature = "v1_16", feature = "dox"))]
fn find_gl_context(&self) -> bool;
2018-11-27 21:52:42 +00:00
fn get_property_context(&self) -> Option<GLContext>;
fn connect_property_context_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
2018-11-27 21:52:42 +00:00
}
impl<O: IsA<GLBaseFilter>> GLBaseFilterExt for O {
2019-04-23 14:32:09 +00:00
#[cfg(any(feature = "v1_16", feature = "dox"))]
fn find_gl_context(&self) -> bool {
unsafe {
from_glib(gst_gl_sys::gst_gl_base_filter_find_gl_context(
self.as_ref().to_glib_none().0,
))
2019-04-23 14:32:09 +00:00
}
}
2018-11-27 21:52:42 +00:00
fn get_property_context(&self) -> Option<GLContext> {
unsafe {
let mut value = Value::from_type(<GLContext as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"context\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
2019-08-10 17:32:57 +00:00
value
.get()
.expect("Return Value for property `context` getter")
2018-11-27 21:52:42 +00:00
}
}
fn connect_property_context_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_context_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_gl_sys::GstGLBaseFilter,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<GLBaseFilter>,
2019-06-18 10:10:46 +00:00
{
let f: &F = &*(f as *const F);
f(&GLBaseFilter::from_glib_borrow(this).unsafe_cast_ref())
2019-06-18 10:10:46 +00:00
}
2018-11-27 21:52:42 +00:00
unsafe {
2019-01-29 13:53:44 +00:00
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::context\0".as_ptr() as *const _,
2020-04-13 16:11:33 +00:00
Some(transmute::<_, unsafe extern "C" fn()>(
notify_context_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
2018-11-27 21:52:42 +00:00
}
}
}