gstreamer/auto/
child_proxy.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    #[doc(alias = "GstChildProxy")]
17    pub struct ChildProxy(Interface<ffi::GstChildProxy, ffi::GstChildProxyInterface>);
18
19    match fn {
20        type_ => || ffi::gst_child_proxy_get_type(),
21    }
22}
23
24impl ChildProxy {
25    pub const NONE: Option<&'static ChildProxy> = None;
26}
27
28unsafe impl Send for ChildProxy {}
29unsafe impl Sync for ChildProxy {}
30
31pub trait ChildProxyExt: IsA<ChildProxy> + 'static {
32    #[doc(alias = "gst_child_proxy_child_added")]
33    fn child_added(&self, child: &impl IsA<glib::Object>, name: &str) {
34        unsafe {
35            ffi::gst_child_proxy_child_added(
36                self.as_ref().to_glib_none().0,
37                child.as_ref().to_glib_none().0,
38                name.to_glib_none().0,
39            );
40        }
41    }
42
43    #[doc(alias = "gst_child_proxy_child_removed")]
44    fn child_removed(&self, child: &impl IsA<glib::Object>, name: &str) {
45        unsafe {
46            ffi::gst_child_proxy_child_removed(
47                self.as_ref().to_glib_none().0,
48                child.as_ref().to_glib_none().0,
49                name.to_glib_none().0,
50            );
51        }
52    }
53
54    //#[doc(alias = "gst_child_proxy_get")]
55    //fn get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
56    //    unsafe { TODO: call ffi:gst_child_proxy_get() }
57    //}
58
59    #[doc(alias = "gst_child_proxy_get_child_by_index")]
60    #[doc(alias = "get_child_by_index")]
61    fn child_by_index(&self, index: u32) -> Option<glib::Object> {
62        unsafe {
63            from_glib_full(ffi::gst_child_proxy_get_child_by_index(
64                self.as_ref().to_glib_none().0,
65                index,
66            ))
67        }
68    }
69
70    #[doc(alias = "gst_child_proxy_get_child_by_name")]
71    #[doc(alias = "get_child_by_name")]
72    fn child_by_name(&self, name: &str) -> Option<glib::Object> {
73        unsafe {
74            from_glib_full(ffi::gst_child_proxy_get_child_by_name(
75                self.as_ref().to_glib_none().0,
76                name.to_glib_none().0,
77            ))
78        }
79    }
80
81    #[cfg(feature = "v1_22")]
82    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
83    #[doc(alias = "gst_child_proxy_get_child_by_name_recurse")]
84    #[doc(alias = "get_child_by_name_recurse")]
85    fn child_by_name_recurse(&self, name: &str) -> Option<glib::Object> {
86        unsafe {
87            from_glib_full(ffi::gst_child_proxy_get_child_by_name_recurse(
88                self.as_ref().to_glib_none().0,
89                name.to_glib_none().0,
90            ))
91        }
92    }
93
94    #[doc(alias = "gst_child_proxy_get_children_count")]
95    #[doc(alias = "get_children_count")]
96    fn children_count(&self) -> u32 {
97        unsafe { ffi::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) }
98    }
99
100    //#[doc(alias = "gst_child_proxy_get_valist")]
101    //#[doc(alias = "get_valist")]
102    //fn valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
103    //    unsafe { TODO: call ffi:gst_child_proxy_get_valist() }
104    //}
105
106    //#[doc(alias = "gst_child_proxy_set")]
107    //fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
108    //    unsafe { TODO: call ffi:gst_child_proxy_set() }
109    //}
110
111    //#[doc(alias = "gst_child_proxy_set_valist")]
112    //fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
113    //    unsafe { TODO: call ffi:gst_child_proxy_set_valist() }
114    //}
115
116    #[doc(alias = "child-added")]
117    fn connect_child_added<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
118        &self,
119        f: F,
120    ) -> SignalHandlerId {
121        unsafe extern "C" fn child_added_trampoline<
122            P: IsA<ChildProxy>,
123            F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static,
124        >(
125            this: *mut ffi::GstChildProxy,
126            object: *mut glib::gobject_ffi::GObject,
127            name: *mut std::ffi::c_char,
128            f: glib::ffi::gpointer,
129        ) {
130            let f: &F = &*(f as *const F);
131            f(
132                ChildProxy::from_glib_borrow(this).unsafe_cast_ref(),
133                &from_glib_borrow(object),
134                &glib::GString::from_glib_borrow(name),
135            )
136        }
137        unsafe {
138            let f: Box_<F> = Box_::new(f);
139            connect_raw(
140                self.as_ptr() as *mut _,
141                c"child-added".as_ptr() as *const _,
142                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
143                    child_added_trampoline::<Self, F> as *const (),
144                )),
145                Box_::into_raw(f),
146            )
147        }
148    }
149
150    #[doc(alias = "child-removed")]
151    fn connect_child_removed<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
152        &self,
153        f: F,
154    ) -> SignalHandlerId {
155        unsafe extern "C" fn child_removed_trampoline<
156            P: IsA<ChildProxy>,
157            F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static,
158        >(
159            this: *mut ffi::GstChildProxy,
160            object: *mut glib::gobject_ffi::GObject,
161            name: *mut std::ffi::c_char,
162            f: glib::ffi::gpointer,
163        ) {
164            let f: &F = &*(f as *const F);
165            f(
166                ChildProxy::from_glib_borrow(this).unsafe_cast_ref(),
167                &from_glib_borrow(object),
168                &glib::GString::from_glib_borrow(name),
169            )
170        }
171        unsafe {
172            let f: Box_<F> = Box_::new(f);
173            connect_raw(
174                self.as_ptr() as *mut _,
175                c"child-removed".as_ptr() as *const _,
176                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
177                    child_removed_trampoline::<Self, F> as *const (),
178                )),
179                Box_::into_raw(f),
180            )
181        }
182    }
183}
184
185impl<O: IsA<ChildProxy>> ChildProxyExt for O {}