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    /// A media factory that creates a pipeline to play any uri.
16    ///
17    /// ## Properties
18    ///
19    ///
20    /// #### `uri`
21    ///  Readable | Writeable
22    ///
23    ///
24    /// #### `use-gstpay`
25    ///  Readable | Writeable
26    /// <details><summary><h4>RTSPMediaFactory</h4></summary>
27    ///
28    ///
29    /// #### `bind-mcast-address`
30    ///  Readable | Writeable
31    ///
32    ///
33    /// #### `buffer-size`
34    ///  Readable | Writeable
35    ///
36    ///
37    /// #### `clock`
38    ///  Readable | Writeable
39    ///
40    ///
41    /// #### `dscp-qos`
42    ///  Readable | Writeable
43    ///
44    ///
45    /// #### `enable-rtcp`
46    ///  Whether the created media should send and receive RTCP
47    ///
48    /// Readable | Writeable
49    ///
50    ///
51    /// #### `ensure-keyunit-on-start`
52    ///  If media from this factory should ensure a key unit when a client connects.
53    ///
54    /// This property will ensure that the stream always starts on a key unit
55    /// instead of a delta unit which the client would not be able to decode.
56    ///
57    /// Note that this will only affect non-shared medias for now.
58    ///
59    /// Readable | Writeable
60    ///
61    ///
62    /// #### `ensure-keyunit-on-start-timeout`
63    ///  Timeout in milliseconds used to determine if a keyunit should be discarded
64    /// when a client connects.
65    ///
66    /// If the timeout has been reached a new keyframe will be forced, otherwise
67    /// the currently blocking keyframe will be used.
68    ///
69    /// This options is only relevant when ensure-keyunit-on-start is enabled.
70    ///
71    /// Readable | Writeable
72    ///
73    ///
74    /// #### `eos-shutdown`
75    ///  Readable | Writeable
76    ///
77    ///
78    /// #### `latency`
79    ///  Readable | Writeable
80    ///
81    ///
82    /// #### `launch`
83    ///  Readable | Writeable
84    ///
85    ///
86    /// #### `max-mcast-ttl`
87    ///  Readable | Writeable
88    ///
89    ///
90    /// #### `profiles`
91    ///  Readable | Writeable
92    ///
93    ///
94    /// #### `protocols`
95    ///  Readable | Writeable
96    ///
97    ///
98    /// #### `shared`
99    ///  Readable | Writeable
100    ///
101    ///
102    /// #### `stop-on-disconnect`
103    ///  Readable | Writeable
104    ///
105    ///
106    /// #### `suspend-mode`
107    ///  Readable | Writeable
108    ///
109    ///
110    /// #### `transport-mode`
111    ///  Readable | Writeable
112    /// </details>
113    ///
114    /// # Implements
115    ///
116    /// [`RTSPMediaFactoryURIExt`][trait@crate::prelude::RTSPMediaFactoryURIExt], [`RTSPMediaFactoryExt`][trait@crate::prelude::RTSPMediaFactoryExt], [`trait@glib::ObjectExt`], [`RTSPMediaFactoryExtManual`][trait@crate::prelude::RTSPMediaFactoryExtManual]
117    #[doc(alias = "GstRTSPMediaFactoryURI")]
118    pub struct RTSPMediaFactoryURI(Object<ffi::GstRTSPMediaFactoryURI, ffi::GstRTSPMediaFactoryURIClass>) @extends RTSPMediaFactory;
119
120    match fn {
121        type_ => || ffi::gst_rtsp_media_factory_uri_get_type(),
122    }
123}
124
125impl RTSPMediaFactoryURI {
126    pub const NONE: Option<&'static RTSPMediaFactoryURI> = None;
127
128    /// Create a new [`RTSPMediaFactoryURI`][crate::RTSPMediaFactoryURI] instance.
129    ///
130    /// # Returns
131    ///
132    /// a new [`RTSPMediaFactoryURI`][crate::RTSPMediaFactoryURI] object.
133    #[doc(alias = "gst_rtsp_media_factory_uri_new")]
134    pub fn new() -> RTSPMediaFactoryURI {
135        assert_initialized_main_thread!();
136        unsafe { from_glib_full(ffi::gst_rtsp_media_factory_uri_new()) }
137    }
138}
139
140impl Default for RTSPMediaFactoryURI {
141    fn default() -> Self {
142        Self::new()
143    }
144}
145
146unsafe impl Send for RTSPMediaFactoryURI {}
147unsafe impl Sync for RTSPMediaFactoryURI {}
148
149mod sealed {
150    pub trait Sealed {}
151    impl<T: super::IsA<super::RTSPMediaFactoryURI>> Sealed for T {}
152}
153
154/// Trait containing all [`struct@RTSPMediaFactoryURI`] methods.
155///
156/// # Implementors
157///
158/// [`RTSPMediaFactoryURI`][struct@crate::RTSPMediaFactoryURI]
159pub trait RTSPMediaFactoryURIExt: IsA<RTSPMediaFactoryURI> + sealed::Sealed + 'static {
160    /// Get the URI that will provide media for this factory.
161    ///
162    /// # Returns
163    ///
164    /// the configured URI. `g_free()` after usage.
165    #[doc(alias = "gst_rtsp_media_factory_uri_get_uri")]
166    #[doc(alias = "get_uri")]
167    fn uri(&self) -> glib::GString {
168        unsafe {
169            from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(
170                self.as_ref().to_glib_none().0,
171            ))
172        }
173    }
174
175    /// Set the URI of the resource that will be streamed by this factory.
176    /// ## `uri`
177    /// the uri the stream
178    #[doc(alias = "gst_rtsp_media_factory_uri_set_uri")]
179    #[doc(alias = "uri")]
180    fn set_uri(&self, uri: &str) {
181        unsafe {
182            ffi::gst_rtsp_media_factory_uri_set_uri(
183                self.as_ref().to_glib_none().0,
184                uri.to_glib_none().0,
185            );
186        }
187    }
188
189    #[doc(alias = "use-gstpay")]
190    fn uses_gstpay(&self) -> bool {
191        ObjectExt::property(self.as_ref(), "use-gstpay")
192    }
193
194    #[doc(alias = "use-gstpay")]
195    fn set_use_gstpay(&self, use_gstpay: bool) {
196        ObjectExt::set_property(self.as_ref(), "use-gstpay", use_gstpay)
197    }
198
199    #[doc(alias = "uri")]
200    fn connect_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
201        unsafe extern "C" fn notify_uri_trampoline<
202            P: IsA<RTSPMediaFactoryURI>,
203            F: Fn(&P) + Send + Sync + 'static,
204        >(
205            this: *mut ffi::GstRTSPMediaFactoryURI,
206            _param_spec: glib::ffi::gpointer,
207            f: glib::ffi::gpointer,
208        ) {
209            let f: &F = &*(f as *const F);
210            f(RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast_ref())
211        }
212        unsafe {
213            let f: Box_<F> = Box_::new(f);
214            connect_raw(
215                self.as_ptr() as *mut _,
216                b"notify::uri\0".as_ptr() as *const _,
217                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
218                    notify_uri_trampoline::<Self, F> as *const (),
219                )),
220                Box_::into_raw(f),
221            )
222        }
223    }
224
225    #[doc(alias = "use-gstpay")]
226    fn connect_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(
227        &self,
228        f: F,
229    ) -> SignalHandlerId {
230        unsafe extern "C" fn notify_use_gstpay_trampoline<
231            P: IsA<RTSPMediaFactoryURI>,
232            F: Fn(&P) + Send + Sync + 'static,
233        >(
234            this: *mut ffi::GstRTSPMediaFactoryURI,
235            _param_spec: glib::ffi::gpointer,
236            f: glib::ffi::gpointer,
237        ) {
238            let f: &F = &*(f as *const F);
239            f(RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast_ref())
240        }
241        unsafe {
242            let f: Box_<F> = Box_::new(f);
243            connect_raw(
244                self.as_ptr() as *mut _,
245                b"notify::use-gstpay\0".as_ptr() as *const _,
246                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
247                    notify_use_gstpay_trampoline::<Self, F> as *const (),
248                )),
249                Box_::into_raw(f),
250            )
251        }
252    }
253}
254
255impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {}