Skip to main content

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