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
149/// Trait containing all [`struct@RTSPMediaFactoryURI`] methods.
150///
151/// # Implementors
152///
153/// [`RTSPMediaFactoryURI`][struct@crate::RTSPMediaFactoryURI]
154pub trait RTSPMediaFactoryURIExt: IsA<RTSPMediaFactoryURI> + 'static {
155    /// Get the URI that will provide media for this factory.
156    ///
157    /// # Returns
158    ///
159    /// the configured URI. `g_free()` after usage.
160    #[doc(alias = "gst_rtsp_media_factory_uri_get_uri")]
161    #[doc(alias = "get_uri")]
162    fn uri(&self) -> glib::GString {
163        unsafe {
164            from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(
165                self.as_ref().to_glib_none().0,
166            ))
167        }
168    }
169
170    /// Set the URI of the resource that will be streamed by this factory.
171    /// ## `uri`
172    /// the uri the stream
173    #[doc(alias = "gst_rtsp_media_factory_uri_set_uri")]
174    #[doc(alias = "uri")]
175    fn set_uri(&self, uri: &str) {
176        unsafe {
177            ffi::gst_rtsp_media_factory_uri_set_uri(
178                self.as_ref().to_glib_none().0,
179                uri.to_glib_none().0,
180            );
181        }
182    }
183
184    #[doc(alias = "use-gstpay")]
185    fn uses_gstpay(&self) -> bool {
186        ObjectExt::property(self.as_ref(), "use-gstpay")
187    }
188
189    #[doc(alias = "use-gstpay")]
190    fn set_use_gstpay(&self, use_gstpay: bool) {
191        ObjectExt::set_property(self.as_ref(), "use-gstpay", use_gstpay)
192    }
193
194    #[doc(alias = "uri")]
195    fn connect_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
196        unsafe extern "C" fn notify_uri_trampoline<
197            P: IsA<RTSPMediaFactoryURI>,
198            F: Fn(&P) + Send + Sync + 'static,
199        >(
200            this: *mut ffi::GstRTSPMediaFactoryURI,
201            _param_spec: glib::ffi::gpointer,
202            f: glib::ffi::gpointer,
203        ) {
204            let f: &F = &*(f as *const F);
205            f(RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast_ref())
206        }
207        unsafe {
208            let f: Box_<F> = Box_::new(f);
209            connect_raw(
210                self.as_ptr() as *mut _,
211                c"notify::uri".as_ptr() as *const _,
212                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
213                    notify_uri_trampoline::<Self, F> as *const (),
214                )),
215                Box_::into_raw(f),
216            )
217        }
218    }
219
220    #[doc(alias = "use-gstpay")]
221    fn connect_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(
222        &self,
223        f: F,
224    ) -> SignalHandlerId {
225        unsafe extern "C" fn notify_use_gstpay_trampoline<
226            P: IsA<RTSPMediaFactoryURI>,
227            F: Fn(&P) + Send + Sync + 'static,
228        >(
229            this: *mut ffi::GstRTSPMediaFactoryURI,
230            _param_spec: glib::ffi::gpointer,
231            f: glib::ffi::gpointer,
232        ) {
233            let f: &F = &*(f as *const F);
234            f(RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast_ref())
235        }
236        unsafe {
237            let f: Box_<F> = Box_::new(f);
238            connect_raw(
239                self.as_ptr() as *mut _,
240                c"notify::use-gstpay".as_ptr() as *const _,
241                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
242                    notify_use_gstpay_trampoline::<Self, F> as *const (),
243                )),
244                Box_::into_raw(f),
245            )
246        }
247    }
248}
249
250impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {}