gstreamer-rs/gstreamer/src/auto/child_proxy.rs

202 lines
6.9 KiB
Rust
Raw Normal View History

2018-04-23 17:34:22 +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)
2017-07-29 14:10:10 +00:00
// DO NOT EDIT
2019-01-16 11:32:39 +00:00
use glib::object::Cast;
2017-07-29 14:10:10 +00:00
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
2017-07-29 14:10:10 +00:00
use glib::translate::*;
use std::boxed::Box as Box_;
2020-04-13 16:11:33 +00:00
use std::mem::transmute;
2017-07-29 14:10:10 +00:00
2020-12-17 22:34:53 +00:00
glib::wrapper! {
2021-03-08 10:25:37 +00:00
pub struct ChildProxy(Interface<ffi::GstChildProxy, ffi::GstChildProxyInterface>);
2017-07-29 14:10:10 +00:00
match fn {
2020-11-21 13:46:33 +00:00
get_type => || ffi::gst_child_proxy_get_type(),
2017-07-29 14:10:10 +00:00
}
}
unsafe impl Send for ChildProxy {}
unsafe impl Sync for ChildProxy {}
2019-01-16 11:32:39 +00:00
pub const NONE_CHILD_PROXY: Option<&ChildProxy> = None;
pub trait ChildProxyExt: 'static {
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_child_added")]
2017-07-29 14:10:10 +00:00
fn child_added<P: IsA<glib::Object>>(&self, child: &P, name: &str);
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_child_removed")]
2017-07-29 14:10:10 +00:00
fn child_removed<P: IsA<glib::Object>>(&self, child: &P, name: &str);
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_get")]
2017-07-29 14:10:10 +00:00
//fn get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_get_child_by_index")]
2017-07-29 14:10:10 +00:00
fn get_child_by_index(&self, index: u32) -> Option<glib::Object>;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_get_child_by_name")]
2017-07-29 14:10:10 +00:00
fn get_child_by_name(&self, name: &str) -> Option<glib::Object>;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_get_children_count")]
2021-04-11 19:38:18 +00:00
fn children_count(&self) -> u32;
2017-07-29 14:10:10 +00:00
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_get_valist")]
2017-07-29 14:10:10 +00:00
//fn get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_lookup")]
2017-07-29 14:10:10 +00:00
//fn lookup(&self, name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option<glib::Object>;
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_set")]
2017-07-29 14:10:10 +00:00
//fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_set_valist")]
2017-07-29 14:10:10 +00:00
//fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
fn connect_child_added<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
2017-07-29 14:10:10 +00:00
fn connect_child_removed<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
2017-07-29 14:10:10 +00:00
}
impl<O: IsA<ChildProxy>> ChildProxyExt for O {
2017-07-29 14:10:10 +00:00
fn child_added<P: IsA<glib::Object>>(&self, child: &P, name: &str) {
unsafe {
2020-11-21 13:46:33 +00:00
ffi::gst_child_proxy_child_added(
self.as_ref().to_glib_none().0,
child.as_ref().to_glib_none().0,
name.to_glib_none().0,
);
2017-07-29 14:10:10 +00:00
}
}
fn child_removed<P: IsA<glib::Object>>(&self, child: &P, name: &str) {
unsafe {
2020-11-21 13:46:33 +00:00
ffi::gst_child_proxy_child_removed(
self.as_ref().to_glib_none().0,
child.as_ref().to_glib_none().0,
name.to_glib_none().0,
);
2017-07-29 14:10:10 +00:00
}
}
//fn get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
2020-11-21 13:46:33 +00:00
// unsafe { TODO: call ffi:gst_child_proxy_get() }
2017-07-29 14:10:10 +00:00
//}
fn get_child_by_index(&self, index: u32) -> Option<glib::Object> {
unsafe {
2020-11-21 13:46:33 +00:00
from_glib_full(ffi::gst_child_proxy_get_child_by_index(
self.as_ref().to_glib_none().0,
index,
))
2017-07-29 14:10:10 +00:00
}
}
fn get_child_by_name(&self, name: &str) -> Option<glib::Object> {
unsafe {
2020-11-21 13:46:33 +00:00
from_glib_full(ffi::gst_child_proxy_get_child_by_name(
self.as_ref().to_glib_none().0,
name.to_glib_none().0,
))
2017-07-29 14:10:10 +00:00
}
}
2021-04-11 19:38:18 +00:00
fn children_count(&self) -> u32 {
2020-11-21 13:46:33 +00:00
unsafe { ffi::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) }
2017-07-29 14:10:10 +00:00
}
//fn get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
2020-11-21 13:46:33 +00:00
// unsafe { TODO: call ffi:gst_child_proxy_get_valist() }
2017-07-29 14:10:10 +00:00
//}
//fn lookup(&self, name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option<glib::Object> {
2020-11-21 13:46:33 +00:00
// unsafe { TODO: call ffi:gst_child_proxy_lookup() }
2017-07-29 14:10:10 +00:00
//}
//fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
2020-11-21 13:46:33 +00:00
// unsafe { TODO: call ffi:gst_child_proxy_set() }
2017-07-29 14:10:10 +00:00
//}
//fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
2020-11-21 13:46:33 +00:00
// unsafe { TODO: call ffi:gst_child_proxy_set_valist() }
2017-07-29 14:10:10 +00:00
//}
fn connect_child_added<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn child_added_trampoline<
P,
F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static,
>(
2020-11-21 13:46:33 +00:00
this: *mut ffi::GstChildProxy,
object: *mut glib::gobject_ffi::GObject,
name: *mut libc::c_char,
2020-11-21 13:46:33 +00:00
f: glib::ffi::gpointer,
) where
P: IsA<ChildProxy>,
2019-06-18 10:10:46 +00:00
{
let f: &F = &*(f as *const F);
f(
&ChildProxy::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(object),
2020-11-21 13:46:33 +00:00
&glib::GString::from_glib_borrow(name),
)
2019-06-18 10:10:46 +00:00
}
2017-07-29 14:10:10 +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"child-added\0".as_ptr() as *const _,
2020-04-13 16:11:33 +00:00
Some(transmute::<_, unsafe extern "C" fn()>(
child_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
2017-07-29 14:10:10 +00:00
}
}
fn connect_child_removed<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn child_removed_trampoline<
P,
F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static,
>(
2020-11-21 13:46:33 +00:00
this: *mut ffi::GstChildProxy,
object: *mut glib::gobject_ffi::GObject,
name: *mut libc::c_char,
2020-11-21 13:46:33 +00:00
f: glib::ffi::gpointer,
) where
P: IsA<ChildProxy>,
2019-06-18 10:10:46 +00:00
{
let f: &F = &*(f as *const F);
f(
&ChildProxy::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(object),
2020-11-21 13:46:33 +00:00
&glib::GString::from_glib_borrow(name),
)
2019-06-18 10:10:46 +00:00
}
2017-07-29 14:10:10 +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"child-removed\0".as_ptr() as *const _,
2020-04-13 16:11:33 +00:00
Some(transmute::<_, unsafe extern "C" fn()>(
child_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
2017-07-29 14:10:10 +00:00
}
}
}