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

106 lines
3.3 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)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
2018-11-27 21:52:42 +00:00
// DO NOT EDIT
2020-11-22 10:20:20 +00:00
use crate::GLContext;
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;
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;
2018-11-27 21:52:42 +00:00
2020-12-17 22:34:53 +00:00
glib::wrapper! {
2020-11-22 10:20:20 +00:00
pub struct GLBaseFilter(Object<ffi::GstGLBaseFilter, ffi::GstGLBaseFilterClass>) @extends gst::Object;
2018-11-27 21:52:42 +00:00
match fn {
2020-11-22 10:20:20 +00:00
get_type => || ffi::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 {
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_gl_base_filter_find_gl_context")]
2019-04-23 14:32:09 +00:00
fn find_gl_context(&self) -> bool;
2020-11-27 13:37:24 +00:00
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_gl_base_filter_get_gl_context")]
2020-04-30 16:51:41 +00:00
fn get_gl_context(&self) -> Option<GLContext>;
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
fn find_gl_context(&self) -> bool {
unsafe {
2020-11-22 10:20:20 +00:00
from_glib(ffi::gst_gl_base_filter_find_gl_context(
self.as_ref().to_glib_none().0,
))
2019-04-23 14:32:09 +00:00
}
}
2020-11-27 13:37:24 +00:00
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
2020-04-30 16:51:41 +00:00
fn get_gl_context(&self) -> Option<GLContext> {
unsafe {
2020-11-22 10:20:20 +00:00
from_glib_full(ffi::gst_gl_base_filter_get_gl_context(
2020-04-30 16:51:41 +00:00
self.as_ref().to_glib_none().0,
))
}
}
2018-11-27 21:52:42 +00:00
fn get_property_context(&self) -> Option<GLContext> {
unsafe {
2020-11-27 13:37:24 +00:00
let mut value = glib::Value::from_type(<GLContext as StaticType>::static_type());
2020-11-22 10:20:20 +00:00
glib::gobject_ffi::g_object_get_property(
self.to_glib_none().0 as *mut glib::gobject_ffi::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>(
2020-11-22 10:20:20 +00:00
this: *mut ffi::GstGLBaseFilter,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::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
}
}
}