gstreamer_rtsp_server/auto/
rtsp_media_factory_uri.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, RTSPMediaFactory};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GstRTSPMediaFactoryURI")]
16    pub struct RTSPMediaFactoryURI(Object<ffi::GstRTSPMediaFactoryURI, ffi::GstRTSPMediaFactoryURIClass>) @extends RTSPMediaFactory;
17
18    match fn {
19        type_ => || ffi::gst_rtsp_media_factory_uri_get_type(),
20    }
21}
22
23impl RTSPMediaFactoryURI {
24    pub const NONE: Option<&'static RTSPMediaFactoryURI> = None;
25
26    #[doc(alias = "gst_rtsp_media_factory_uri_new")]
27    pub fn new() -> RTSPMediaFactoryURI {
28        assert_initialized_main_thread!();
29        unsafe { from_glib_full(ffi::gst_rtsp_media_factory_uri_new()) }
30    }
31}
32
33impl Default for RTSPMediaFactoryURI {
34    fn default() -> Self {
35        Self::new()
36    }
37}
38
39unsafe impl Send for RTSPMediaFactoryURI {}
40unsafe impl Sync for RTSPMediaFactoryURI {}
41
42pub trait RTSPMediaFactoryURIExt: IsA<RTSPMediaFactoryURI> + 'static {
43    #[doc(alias = "gst_rtsp_media_factory_uri_get_uri")]
44    #[doc(alias = "get_uri")]
45    fn uri(&self) -> glib::GString {
46        unsafe {
47            from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(
48                self.as_ref().to_glib_none().0,
49            ))
50        }
51    }
52
53    #[doc(alias = "gst_rtsp_media_factory_uri_set_uri")]
54    #[doc(alias = "uri")]
55    fn set_uri(&self, uri: &str) {
56        unsafe {
57            ffi::gst_rtsp_media_factory_uri_set_uri(
58                self.as_ref().to_glib_none().0,
59                uri.to_glib_none().0,
60            );
61        }
62    }
63
64    #[doc(alias = "use-gstpay")]
65    fn uses_gstpay(&self) -> bool {
66        ObjectExt::property(self.as_ref(), "use-gstpay")
67    }
68
69    #[doc(alias = "use-gstpay")]
70    fn set_use_gstpay(&self, use_gstpay: bool) {
71        ObjectExt::set_property(self.as_ref(), "use-gstpay", use_gstpay)
72    }
73
74    #[doc(alias = "uri")]
75    fn connect_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
76        unsafe extern "C" fn notify_uri_trampoline<
77            P: IsA<RTSPMediaFactoryURI>,
78            F: Fn(&P) + Send + Sync + 'static,
79        >(
80            this: *mut ffi::GstRTSPMediaFactoryURI,
81            _param_spec: glib::ffi::gpointer,
82            f: glib::ffi::gpointer,
83        ) {
84            let f: &F = &*(f as *const F);
85            f(RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast_ref())
86        }
87        unsafe {
88            let f: Box_<F> = Box_::new(f);
89            connect_raw(
90                self.as_ptr() as *mut _,
91                c"notify::uri".as_ptr() as *const _,
92                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
93                    notify_uri_trampoline::<Self, F> as *const (),
94                )),
95                Box_::into_raw(f),
96            )
97        }
98    }
99
100    #[doc(alias = "use-gstpay")]
101    fn connect_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(
102        &self,
103        f: F,
104    ) -> SignalHandlerId {
105        unsafe extern "C" fn notify_use_gstpay_trampoline<
106            P: IsA<RTSPMediaFactoryURI>,
107            F: Fn(&P) + Send + Sync + 'static,
108        >(
109            this: *mut ffi::GstRTSPMediaFactoryURI,
110            _param_spec: glib::ffi::gpointer,
111            f: glib::ffi::gpointer,
112        ) {
113            let f: &F = &*(f as *const F);
114            f(RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast_ref())
115        }
116        unsafe {
117            let f: Box_<F> = Box_::new(f);
118            connect_raw(
119                self.as_ptr() as *mut _,
120                c"notify::use-gstpay".as_ptr() as *const _,
121                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
122                    notify_use_gstpay_trampoline::<Self, F> as *const (),
123                )),
124                Box_::into_raw(f),
125            )
126        }
127    }
128}
129
130impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {}