gstreamer_rtsp_server/auto/
rtsp_server.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::{
7    ffi, RTSPAuth, RTSPClient, RTSPFilterResult, RTSPMountPoints, RTSPSessionPool, RTSPThreadPool,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// This object listens on a port, creates and manages the clients connected to
19    /// it.
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `address`
25    ///  Readable | Writeable
26    ///
27    ///
28    /// #### `backlog`
29    ///  Readable | Writeable
30    ///
31    ///
32    /// #### `bound-port`
33    ///  Readable
34    ///
35    ///
36    /// #### `content-length-limit`
37    ///  Readable | Writeable
38    ///
39    ///
40    /// #### `mount-points`
41    ///  Readable | Writeable
42    ///
43    ///
44    /// #### `service`
45    ///  Readable | Writeable
46    ///
47    ///
48    /// #### `session-pool`
49    ///  Readable | Writeable
50    ///
51    /// ## Signals
52    ///
53    ///
54    /// #### `client-connected`
55    ///
56    ///
57    /// # Implements
58    ///
59    /// [`RTSPServerExt`][trait@crate::prelude::RTSPServerExt], [`trait@glib::ObjectExt`], [`RTSPServerExtManual`][trait@crate::prelude::RTSPServerExtManual]
60    #[doc(alias = "GstRTSPServer")]
61    pub struct RTSPServer(Object<ffi::GstRTSPServer, ffi::GstRTSPServerClass>);
62
63    match fn {
64        type_ => || ffi::gst_rtsp_server_get_type(),
65    }
66}
67
68impl RTSPServer {
69    pub const NONE: Option<&'static RTSPServer> = None;
70
71    /// Create a new [`RTSPServer`][crate::RTSPServer] instance.
72    ///
73    /// # Returns
74    ///
75    /// a new [`RTSPServer`][crate::RTSPServer]
76    #[doc(alias = "gst_rtsp_server_new")]
77    pub fn new() -> RTSPServer {
78        assert_initialized_main_thread!();
79        unsafe { from_glib_full(ffi::gst_rtsp_server_new()) }
80    }
81
82    /// A default `GSocketSourceFunc` that creates a new [`RTSPClient`][crate::RTSPClient] to accept and handle a
83    /// new connection on `socket` or `server`.
84    /// ## `socket`
85    /// a [`gio::Socket`][crate::gio::Socket]
86    /// ## `condition`
87    /// the condition on `source`
88    /// ## `server`
89    /// a [`RTSPServer`][crate::RTSPServer]
90    ///
91    /// # Returns
92    ///
93    /// TRUE if the source could be connected, FALSE if an error occurred.
94    #[doc(alias = "gst_rtsp_server_io_func")]
95    pub fn io_func(
96        socket: &impl IsA<gio::Socket>,
97        condition: glib::IOCondition,
98        server: &impl IsA<RTSPServer>,
99    ) -> Result<(), glib::error::BoolError> {
100        skip_assert_initialized!();
101        unsafe {
102            glib::result_from_gboolean!(
103                ffi::gst_rtsp_server_io_func(
104                    socket.as_ref().to_glib_none().0,
105                    condition.into_glib(),
106                    server.as_ref().to_glib_none().0
107                ),
108                "Failed to connect the source"
109            )
110        }
111    }
112}
113
114impl Default for RTSPServer {
115    fn default() -> Self {
116        Self::new()
117    }
118}
119
120unsafe impl Send for RTSPServer {}
121unsafe impl Sync for RTSPServer {}
122
123/// Trait containing all [`struct@RTSPServer`] methods.
124///
125/// # Implementors
126///
127/// [`RTSPOnvifServer`][struct@crate::RTSPOnvifServer], [`RTSPServer`][struct@crate::RTSPServer]
128pub trait RTSPServerExt: IsA<RTSPServer> + 'static {
129    /// Call `func` for each client managed by `self`. The result value of `func`
130    /// determines what happens to the client. `func` will be called with `self`
131    /// locked so no further actions on `self` can be performed from `func`.
132    ///
133    /// If `func` returns [`RTSPFilterResult::Remove`][crate::RTSPFilterResult::Remove], the client will be removed from
134    /// `self`.
135    ///
136    /// If `func` returns [`RTSPFilterResult::Keep`][crate::RTSPFilterResult::Keep], the client will remain in `self`.
137    ///
138    /// If `func` returns [`RTSPFilterResult::Ref`][crate::RTSPFilterResult::Ref], the client will remain in `self` but
139    /// will also be added with an additional ref to the result `GList` of this
140    /// function..
141    ///
142    /// When `func` is [`None`], [`RTSPFilterResult::Ref`][crate::RTSPFilterResult::Ref] will be assumed for each client.
143    /// ## `func`
144    /// a callback
145    ///
146    /// # Returns
147    ///
148    /// a `GList` with all
149    /// clients for which `func` returned [`RTSPFilterResult::Ref`][crate::RTSPFilterResult::Ref]. After usage, each
150    /// element in the `GList` should be unreffed before the list is freed.
151    #[doc(alias = "gst_rtsp_server_client_filter")]
152    fn client_filter(
153        &self,
154        func: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>,
155    ) -> Vec<RTSPClient> {
156        let mut func_data: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)> =
157            func;
158        unsafe extern "C" fn func_func(
159            server: *mut ffi::GstRTSPServer,
160            client: *mut ffi::GstRTSPClient,
161            user_data: glib::ffi::gpointer,
162        ) -> ffi::GstRTSPFilterResult {
163            let server = from_glib_borrow(server);
164            let client = from_glib_borrow(client);
165            let callback = user_data
166                as *mut Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>;
167            if let Some(ref mut callback) = *callback {
168                callback(&server, &client)
169            } else {
170                panic!("cannot get closure...")
171            }
172            .into_glib()
173        }
174        let func = if func_data.is_some() {
175            Some(func_func as _)
176        } else {
177            None
178        };
179        let super_callback0: &mut Option<
180            &mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult),
181        > = &mut func_data;
182        unsafe {
183            FromGlibPtrContainer::from_glib_full(ffi::gst_rtsp_server_client_filter(
184                self.as_ref().to_glib_none().0,
185                func,
186                super_callback0 as *mut _ as *mut _,
187            ))
188        }
189    }
190
191    /// Create a [`gio::Socket`][crate::gio::Socket] for `self`. The socket will listen on the
192    /// configured service.
193    /// ## `cancellable`
194    /// a [`gio::Cancellable`][crate::gio::Cancellable]
195    ///
196    /// # Returns
197    ///
198    /// the [`gio::Socket`][crate::gio::Socket] for `self` or [`None`] when an error
199    /// occurred.
200    #[doc(alias = "gst_rtsp_server_create_socket")]
201    fn create_socket(
202        &self,
203        cancellable: Option<&impl IsA<gio::Cancellable>>,
204    ) -> Result<gio::Socket, glib::Error> {
205        unsafe {
206            let mut error = std::ptr::null_mut();
207            let ret = ffi::gst_rtsp_server_create_socket(
208                self.as_ref().to_glib_none().0,
209                cancellable.map(|p| p.as_ref()).to_glib_none().0,
210                &mut error,
211            );
212            if error.is_null() {
213                Ok(from_glib_full(ret))
214            } else {
215                Err(from_glib_full(error))
216            }
217        }
218    }
219
220    /// Create a [`glib::Source`][crate::glib::Source] for `self`. The new source will have a default
221    /// `GSocketSourceFunc` of [`RTSPServer::io_func()`][crate::RTSPServer::io_func()].
222    ///
223    /// `cancellable` if not [`None`] can be used to cancel the source, which will cause
224    /// the source to trigger, reporting the current condition (which is likely 0
225    /// unless cancellation happened at the same time as a condition change). You can
226    /// check for this in the callback using [`CancellableExtManual::is_cancelled()`][crate::gio::prelude::CancellableExtManual::is_cancelled()].
227    ///
228    /// This takes a reference on `self` until `source` is destroyed.
229    /// ## `cancellable`
230    /// a [`gio::Cancellable`][crate::gio::Cancellable] or [`None`].
231    ///
232    /// # Returns
233    ///
234    /// the [`glib::Source`][crate::glib::Source] for `self` or [`None`] when an error
235    /// occurred. Free with g_source_unref ()
236    #[doc(alias = "gst_rtsp_server_create_source")]
237    fn create_source(
238        &self,
239        cancellable: Option<&impl IsA<gio::Cancellable>>,
240    ) -> Result<glib::Source, glib::Error> {
241        unsafe {
242            let mut error = std::ptr::null_mut();
243            let ret = ffi::gst_rtsp_server_create_source(
244                self.as_ref().to_glib_none().0,
245                cancellable.map(|p| p.as_ref()).to_glib_none().0,
246                &mut error,
247            );
248            if error.is_null() {
249                Ok(from_glib_full(ret))
250            } else {
251                Err(from_glib_full(error))
252            }
253        }
254    }
255
256    /// Get the address on which the server will accept connections.
257    ///
258    /// # Returns
259    ///
260    /// the server address. `g_free()` after usage.
261    #[doc(alias = "gst_rtsp_server_get_address")]
262    #[doc(alias = "get_address")]
263    fn address(&self) -> Option<glib::GString> {
264        unsafe {
265            from_glib_full(ffi::gst_rtsp_server_get_address(
266                self.as_ref().to_glib_none().0,
267            ))
268        }
269    }
270
271    /// Get the [`RTSPAuth`][crate::RTSPAuth] used as the authentication manager of `self`.
272    ///
273    /// # Returns
274    ///
275    /// the [`RTSPAuth`][crate::RTSPAuth] of `self`. `g_object_unref()` after
276    /// usage.
277    #[doc(alias = "gst_rtsp_server_get_auth")]
278    #[doc(alias = "get_auth")]
279    fn auth(&self) -> Option<RTSPAuth> {
280        unsafe {
281            from_glib_full(ffi::gst_rtsp_server_get_auth(
282                self.as_ref().to_glib_none().0,
283            ))
284        }
285    }
286
287    /// The maximum amount of queued requests for the server.
288    ///
289    /// # Returns
290    ///
291    /// the server backlog.
292    #[doc(alias = "gst_rtsp_server_get_backlog")]
293    #[doc(alias = "get_backlog")]
294    fn backlog(&self) -> i32 {
295        unsafe { ffi::gst_rtsp_server_get_backlog(self.as_ref().to_glib_none().0) }
296    }
297
298    /// Get the port number where the server was bound to.
299    ///
300    /// # Returns
301    ///
302    /// the port number
303    #[doc(alias = "gst_rtsp_server_get_bound_port")]
304    #[doc(alias = "get_bound_port")]
305    #[doc(alias = "bound-port")]
306    fn bound_port(&self) -> i32 {
307        unsafe { ffi::gst_rtsp_server_get_bound_port(self.as_ref().to_glib_none().0) }
308    }
309
310    /// Get the Content-Length limit of `self`.
311    ///
312    /// # Returns
313    ///
314    /// the Content-Length limit.
315    #[cfg(feature = "v1_18")]
316    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
317    #[doc(alias = "gst_rtsp_server_get_content_length_limit")]
318    #[doc(alias = "get_content_length_limit")]
319    #[doc(alias = "content-length-limit")]
320    fn content_length_limit(&self) -> u32 {
321        unsafe { ffi::gst_rtsp_server_get_content_length_limit(self.as_ref().to_glib_none().0) }
322    }
323
324    /// Get the [`RTSPMountPoints`][crate::RTSPMountPoints] used as the mount points of `self`.
325    ///
326    /// # Returns
327    ///
328    /// the [`RTSPMountPoints`][crate::RTSPMountPoints] of `self`. `g_object_unref()` after
329    /// usage.
330    #[doc(alias = "gst_rtsp_server_get_mount_points")]
331    #[doc(alias = "get_mount_points")]
332    #[doc(alias = "mount-points")]
333    fn mount_points(&self) -> Option<RTSPMountPoints> {
334        unsafe {
335            from_glib_full(ffi::gst_rtsp_server_get_mount_points(
336                self.as_ref().to_glib_none().0,
337            ))
338        }
339    }
340
341    /// Get the service on which the server will accept connections.
342    ///
343    /// # Returns
344    ///
345    /// the service. use `g_free()` after usage.
346    #[doc(alias = "gst_rtsp_server_get_service")]
347    #[doc(alias = "get_service")]
348    fn service(&self) -> glib::GString {
349        unsafe {
350            from_glib_full(ffi::gst_rtsp_server_get_service(
351                self.as_ref().to_glib_none().0,
352            ))
353        }
354    }
355
356    /// Get the [`RTSPSessionPool`][crate::RTSPSessionPool] used as the session pool of `self`.
357    ///
358    /// # Returns
359    ///
360    /// the [`RTSPSessionPool`][crate::RTSPSessionPool] used for sessions. `g_object_unref()` after
361    /// usage.
362    #[doc(alias = "gst_rtsp_server_get_session_pool")]
363    #[doc(alias = "get_session_pool")]
364    #[doc(alias = "session-pool")]
365    fn session_pool(&self) -> Option<RTSPSessionPool> {
366        unsafe {
367            from_glib_full(ffi::gst_rtsp_server_get_session_pool(
368                self.as_ref().to_glib_none().0,
369            ))
370        }
371    }
372
373    /// Get the [`RTSPThreadPool`][crate::RTSPThreadPool] used as the thread pool of `self`.
374    ///
375    /// # Returns
376    ///
377    /// the [`RTSPThreadPool`][crate::RTSPThreadPool] of `self`. `g_object_unref()` after
378    /// usage.
379    #[doc(alias = "gst_rtsp_server_get_thread_pool")]
380    #[doc(alias = "get_thread_pool")]
381    fn thread_pool(&self) -> Option<RTSPThreadPool> {
382        unsafe {
383            from_glib_full(ffi::gst_rtsp_server_get_thread_pool(
384                self.as_ref().to_glib_none().0,
385            ))
386        }
387    }
388
389    /// Configure `self` to accept connections on the given address.
390    ///
391    /// This function must be called before the server is bound.
392    /// ## `address`
393    /// the address
394    #[doc(alias = "gst_rtsp_server_set_address")]
395    #[doc(alias = "address")]
396    fn set_address(&self, address: &str) {
397        unsafe {
398            ffi::gst_rtsp_server_set_address(
399                self.as_ref().to_glib_none().0,
400                address.to_glib_none().0,
401            );
402        }
403    }
404
405    /// configure `auth` to be used as the authentication manager of `self`.
406    /// ## `auth`
407    /// a [`RTSPAuth`][crate::RTSPAuth]
408    #[doc(alias = "gst_rtsp_server_set_auth")]
409    fn set_auth(&self, auth: Option<&impl IsA<RTSPAuth>>) {
410        unsafe {
411            ffi::gst_rtsp_server_set_auth(
412                self.as_ref().to_glib_none().0,
413                auth.map(|p| p.as_ref()).to_glib_none().0,
414            );
415        }
416    }
417
418    /// configure the maximum amount of requests that may be queued for the
419    /// server.
420    ///
421    /// This function must be called before the server is bound.
422    /// ## `backlog`
423    /// the backlog
424    #[doc(alias = "gst_rtsp_server_set_backlog")]
425    #[doc(alias = "backlog")]
426    fn set_backlog(&self, backlog: i32) {
427        unsafe {
428            ffi::gst_rtsp_server_set_backlog(self.as_ref().to_glib_none().0, backlog);
429        }
430    }
431
432    /// Define an appropriate request size limit and reject requests exceeding the
433    /// limit.
434    #[cfg(feature = "v1_18")]
435    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
436    #[doc(alias = "gst_rtsp_server_set_content_length_limit")]
437    #[doc(alias = "content-length-limit")]
438    fn set_content_length_limit(&self, limit: u32) {
439        unsafe {
440            ffi::gst_rtsp_server_set_content_length_limit(self.as_ref().to_glib_none().0, limit);
441        }
442    }
443
444    /// configure `mounts` to be used as the mount points of `self`.
445    /// ## `mounts`
446    /// a [`RTSPMountPoints`][crate::RTSPMountPoints]
447    #[doc(alias = "gst_rtsp_server_set_mount_points")]
448    #[doc(alias = "mount-points")]
449    fn set_mount_points(&self, mounts: Option<&impl IsA<RTSPMountPoints>>) {
450        unsafe {
451            ffi::gst_rtsp_server_set_mount_points(
452                self.as_ref().to_glib_none().0,
453                mounts.map(|p| p.as_ref()).to_glib_none().0,
454            );
455        }
456    }
457
458    /// Configure `self` to accept connections on the given service.
459    /// `service` should be a string containing the service name (see services(5)) or
460    /// a string containing a port number between 1 and 65535.
461    ///
462    /// When `service` is set to "0", the server will listen on a random free
463    /// port. The actual used port can be retrieved with
464    /// [`bound_port()`][Self::bound_port()].
465    ///
466    /// This function must be called before the server is bound.
467    /// ## `service`
468    /// the service
469    #[doc(alias = "gst_rtsp_server_set_service")]
470    #[doc(alias = "service")]
471    fn set_service(&self, service: &str) {
472        unsafe {
473            ffi::gst_rtsp_server_set_service(
474                self.as_ref().to_glib_none().0,
475                service.to_glib_none().0,
476            );
477        }
478    }
479
480    /// configure `pool` to be used as the session pool of `self`.
481    /// ## `pool`
482    /// a [`RTSPSessionPool`][crate::RTSPSessionPool]
483    #[doc(alias = "gst_rtsp_server_set_session_pool")]
484    #[doc(alias = "session-pool")]
485    fn set_session_pool(&self, pool: Option<&impl IsA<RTSPSessionPool>>) {
486        unsafe {
487            ffi::gst_rtsp_server_set_session_pool(
488                self.as_ref().to_glib_none().0,
489                pool.map(|p| p.as_ref()).to_glib_none().0,
490            );
491        }
492    }
493
494    /// configure `pool` to be used as the thread pool of `self`.
495    /// ## `pool`
496    /// a [`RTSPThreadPool`][crate::RTSPThreadPool]
497    #[doc(alias = "gst_rtsp_server_set_thread_pool")]
498    fn set_thread_pool(&self, pool: Option<&impl IsA<RTSPThreadPool>>) {
499        unsafe {
500            ffi::gst_rtsp_server_set_thread_pool(
501                self.as_ref().to_glib_none().0,
502                pool.map(|p| p.as_ref()).to_glib_none().0,
503            );
504        }
505    }
506
507    /// Take an existing network socket and use it for an RTSP connection. This
508    /// is used when transferring a socket from an HTTP server which should be used
509    /// as an RTSP over HTTP tunnel. The `initial_buffer` contains any remaining data
510    /// that the HTTP server read from the socket while parsing the HTTP header.
511    /// ## `socket`
512    /// a network socket
513    /// ## `ip`
514    /// the IP address of the remote client
515    /// ## `port`
516    /// the port used by the other end
517    /// ## `initial_buffer`
518    /// any initial data that was already read from the socket
519    ///
520    /// # Returns
521    ///
522    /// TRUE if all was ok, FALSE if an error occurred.
523    #[doc(alias = "gst_rtsp_server_transfer_connection")]
524    fn transfer_connection(
525        &self,
526        socket: impl IsA<gio::Socket>,
527        ip: &str,
528        port: i32,
529        initial_buffer: Option<&str>,
530    ) -> Result<(), glib::error::BoolError> {
531        unsafe {
532            glib::result_from_gboolean!(
533                ffi::gst_rtsp_server_transfer_connection(
534                    self.as_ref().to_glib_none().0,
535                    socket.upcast().into_glib_ptr(),
536                    ip.to_glib_none().0,
537                    port,
538                    initial_buffer.to_glib_none().0
539                ),
540                "Failed to transfer to the connection"
541            )
542        }
543    }
544
545    #[cfg(not(feature = "v1_18"))]
546    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_18"))))]
547    #[doc(alias = "content-length-limit")]
548    fn content_length_limit(&self) -> u32 {
549        ObjectExt::property(self.as_ref(), "content-length-limit")
550    }
551
552    #[cfg(not(feature = "v1_18"))]
553    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_18"))))]
554    #[doc(alias = "content-length-limit")]
555    fn set_content_length_limit(&self, content_length_limit: u32) {
556        ObjectExt::set_property(self.as_ref(), "content-length-limit", content_length_limit)
557    }
558
559    #[doc(alias = "client-connected")]
560    fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(
561        &self,
562        f: F,
563    ) -> SignalHandlerId {
564        unsafe extern "C" fn client_connected_trampoline<
565            P: IsA<RTSPServer>,
566            F: Fn(&P, &RTSPClient) + Send + Sync + 'static,
567        >(
568            this: *mut ffi::GstRTSPServer,
569            object: *mut ffi::GstRTSPClient,
570            f: glib::ffi::gpointer,
571        ) {
572            let f: &F = &*(f as *const F);
573            f(
574                RTSPServer::from_glib_borrow(this).unsafe_cast_ref(),
575                &from_glib_borrow(object),
576            )
577        }
578        unsafe {
579            let f: Box_<F> = Box_::new(f);
580            connect_raw(
581                self.as_ptr() as *mut _,
582                c"client-connected".as_ptr() as *const _,
583                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
584                    client_connected_trampoline::<Self, F> as *const (),
585                )),
586                Box_::into_raw(f),
587            )
588        }
589    }
590
591    #[doc(alias = "address")]
592    fn connect_address_notify<F: Fn(&Self) + Send + Sync + 'static>(
593        &self,
594        f: F,
595    ) -> SignalHandlerId {
596        unsafe extern "C" fn notify_address_trampoline<
597            P: IsA<RTSPServer>,
598            F: Fn(&P) + Send + Sync + 'static,
599        >(
600            this: *mut ffi::GstRTSPServer,
601            _param_spec: glib::ffi::gpointer,
602            f: glib::ffi::gpointer,
603        ) {
604            let f: &F = &*(f as *const F);
605            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
606        }
607        unsafe {
608            let f: Box_<F> = Box_::new(f);
609            connect_raw(
610                self.as_ptr() as *mut _,
611                c"notify::address".as_ptr() as *const _,
612                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
613                    notify_address_trampoline::<Self, F> as *const (),
614                )),
615                Box_::into_raw(f),
616            )
617        }
618    }
619
620    #[doc(alias = "backlog")]
621    fn connect_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(
622        &self,
623        f: F,
624    ) -> SignalHandlerId {
625        unsafe extern "C" fn notify_backlog_trampoline<
626            P: IsA<RTSPServer>,
627            F: Fn(&P) + Send + Sync + 'static,
628        >(
629            this: *mut ffi::GstRTSPServer,
630            _param_spec: glib::ffi::gpointer,
631            f: glib::ffi::gpointer,
632        ) {
633            let f: &F = &*(f as *const F);
634            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
635        }
636        unsafe {
637            let f: Box_<F> = Box_::new(f);
638            connect_raw(
639                self.as_ptr() as *mut _,
640                c"notify::backlog".as_ptr() as *const _,
641                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
642                    notify_backlog_trampoline::<Self, F> as *const (),
643                )),
644                Box_::into_raw(f),
645            )
646        }
647    }
648
649    #[doc(alias = "bound-port")]
650    fn connect_bound_port_notify<F: Fn(&Self) + Send + Sync + 'static>(
651        &self,
652        f: F,
653    ) -> SignalHandlerId {
654        unsafe extern "C" fn notify_bound_port_trampoline<
655            P: IsA<RTSPServer>,
656            F: Fn(&P) + Send + Sync + 'static,
657        >(
658            this: *mut ffi::GstRTSPServer,
659            _param_spec: glib::ffi::gpointer,
660            f: glib::ffi::gpointer,
661        ) {
662            let f: &F = &*(f as *const F);
663            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
664        }
665        unsafe {
666            let f: Box_<F> = Box_::new(f);
667            connect_raw(
668                self.as_ptr() as *mut _,
669                c"notify::bound-port".as_ptr() as *const _,
670                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
671                    notify_bound_port_trampoline::<Self, F> as *const (),
672                )),
673                Box_::into_raw(f),
674            )
675        }
676    }
677
678    #[doc(alias = "content-length-limit")]
679    fn connect_content_length_limit_notify<F: Fn(&Self) + Send + Sync + 'static>(
680        &self,
681        f: F,
682    ) -> SignalHandlerId {
683        unsafe extern "C" fn notify_content_length_limit_trampoline<
684            P: IsA<RTSPServer>,
685            F: Fn(&P) + Send + Sync + 'static,
686        >(
687            this: *mut ffi::GstRTSPServer,
688            _param_spec: glib::ffi::gpointer,
689            f: glib::ffi::gpointer,
690        ) {
691            let f: &F = &*(f as *const F);
692            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
693        }
694        unsafe {
695            let f: Box_<F> = Box_::new(f);
696            connect_raw(
697                self.as_ptr() as *mut _,
698                c"notify::content-length-limit".as_ptr() as *const _,
699                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
700                    notify_content_length_limit_trampoline::<Self, F> as *const (),
701                )),
702                Box_::into_raw(f),
703            )
704        }
705    }
706
707    #[doc(alias = "mount-points")]
708    fn connect_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(
709        &self,
710        f: F,
711    ) -> SignalHandlerId {
712        unsafe extern "C" fn notify_mount_points_trampoline<
713            P: IsA<RTSPServer>,
714            F: Fn(&P) + Send + Sync + 'static,
715        >(
716            this: *mut ffi::GstRTSPServer,
717            _param_spec: glib::ffi::gpointer,
718            f: glib::ffi::gpointer,
719        ) {
720            let f: &F = &*(f as *const F);
721            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
722        }
723        unsafe {
724            let f: Box_<F> = Box_::new(f);
725            connect_raw(
726                self.as_ptr() as *mut _,
727                c"notify::mount-points".as_ptr() as *const _,
728                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
729                    notify_mount_points_trampoline::<Self, F> as *const (),
730                )),
731                Box_::into_raw(f),
732            )
733        }
734    }
735
736    #[doc(alias = "service")]
737    fn connect_service_notify<F: Fn(&Self) + Send + Sync + 'static>(
738        &self,
739        f: F,
740    ) -> SignalHandlerId {
741        unsafe extern "C" fn notify_service_trampoline<
742            P: IsA<RTSPServer>,
743            F: Fn(&P) + Send + Sync + 'static,
744        >(
745            this: *mut ffi::GstRTSPServer,
746            _param_spec: glib::ffi::gpointer,
747            f: glib::ffi::gpointer,
748        ) {
749            let f: &F = &*(f as *const F);
750            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
751        }
752        unsafe {
753            let f: Box_<F> = Box_::new(f);
754            connect_raw(
755                self.as_ptr() as *mut _,
756                c"notify::service".as_ptr() as *const _,
757                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758                    notify_service_trampoline::<Self, F> as *const (),
759                )),
760                Box_::into_raw(f),
761            )
762        }
763    }
764
765    #[doc(alias = "session-pool")]
766    fn connect_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(
767        &self,
768        f: F,
769    ) -> SignalHandlerId {
770        unsafe extern "C" fn notify_session_pool_trampoline<
771            P: IsA<RTSPServer>,
772            F: Fn(&P) + Send + Sync + 'static,
773        >(
774            this: *mut ffi::GstRTSPServer,
775            _param_spec: glib::ffi::gpointer,
776            f: glib::ffi::gpointer,
777        ) {
778            let f: &F = &*(f as *const F);
779            f(RTSPServer::from_glib_borrow(this).unsafe_cast_ref())
780        }
781        unsafe {
782            let f: Box_<F> = Box_::new(f);
783            connect_raw(
784                self.as_ptr() as *mut _,
785                c"notify::session-pool".as_ptr() as *const _,
786                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
787                    notify_session_pool_trampoline::<Self, F> as *const (),
788                )),
789                Box_::into_raw(f),
790            )
791        }
792    }
793}
794
795impl<O: IsA<RTSPServer>> RTSPServerExt for O {}