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

217 lines
7.4 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! {
#[doc(alias = "GstChildProxy")]
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 {
type_ => || ffi::gst_child_proxy_get_type(),
2017-07-29 14:10:10 +00:00
}
}
2021-11-03 17:28:46 +00:00
impl ChildProxy {
pub const NONE: Option<&'static ChildProxy> = None;
}
2019-01-16 11:32:39 +00:00
2021-11-16 14:02:58 +00:00
unsafe impl Send for ChildProxy {}
unsafe impl Sync for ChildProxy {}
pub trait ChildProxyExt: 'static {
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_child_added")]
fn child_added(&self, child: &impl IsA<glib::Object>, name: &str);
2017-07-29 14:10:10 +00:00
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_child_removed")]
fn child_removed(&self, child: &impl IsA<glib::Object>, name: &str);
2017-07-29 14:10:10 +00:00
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_get")]
2022-06-30 05:22:05 +00:00
//fn get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs);
2017-07-29 14:10:10 +00:00
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_get_child_by_index")]
#[doc(alias = "get_child_by_index")]
2021-04-19 20:13:58 +00:00
fn child_by_index(&self, index: u32) -> Option<glib::Object>;
2017-07-29 14:10:10 +00:00
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_get_child_by_name")]
#[doc(alias = "get_child_by_name")]
2021-04-19 20:13:58 +00:00
fn child_by_name(&self, name: &str) -> Option<glib::Object>;
2017-07-29 14:10:10 +00:00
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_child_proxy_get_child_by_name_recurse")]
#[doc(alias = "get_child_by_name_recurse")]
fn child_by_name_recurse(&self, name: &str) -> Option<glib::Object>;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_child_proxy_get_children_count")]
#[doc(alias = "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")]
//#[doc(alias = "get_valist")]
2021-04-19 20:13:58 +00:00
//fn valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
2017-07-29 14:10:10 +00:00
2020-12-08 13:00:17 +00:00
//#[doc(alias = "gst_child_proxy_set")]
2022-06-30 05:22:05 +00:00
//fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs);
2017-07-29 14:10:10 +00:00
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);
#[doc(alias = "child-added")]
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
#[doc(alias = "child-removed")]
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 {
fn child_added(&self, child: &impl IsA<glib::Object>, name: &str) {
2017-07-29 14:10:10 +00:00
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(&self, child: &impl IsA<glib::Object>, name: &str) {
2017-07-29 14:10:10 +00:00
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
}
}
2022-06-30 05:22:05 +00:00
//fn get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: 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
//}
2021-04-19 20:13:58 +00:00
fn child_by_index(&self, index: u32) -> Option<glib::Object> {
2017-07-29 14:10:10 +00:00
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
}
}
2021-04-19 20:13:58 +00:00
fn child_by_name(&self, name: &str) -> Option<glib::Object> {
2017-07-29 14:10:10 +00:00
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,
))
}
}
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
fn child_by_name_recurse(&self, name: &str) -> Option<glib::Object> {
unsafe {
from_glib_full(ffi::gst_child_proxy_get_child_by_name_recurse(
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
}
2021-04-19 20:13:58 +00:00
//fn 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
//}
2022-06-30 05:22:05 +00:00
//fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: 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: IsA<ChildProxy>,
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,
) {
2019-06-18 10:10:46 +00:00
let f: &F = &*(f as *const F);
f(
2021-06-21 21:07:45 +00:00
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: IsA<ChildProxy>,
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,
) {
2019-06-18 10:10:46 +00:00
let f: &F = &*(f as *const F);
f(
2021-06-21 21:07:45 +00:00
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
}
}
}