gstreamer_rtsp_server/
rtsp_server.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::{prelude::*, source::SourceId, translate::*};
4
5use crate::{ffi, RTSPServer};
6
7pub trait RTSPServerExtManual: IsA<RTSPServer> + 'static {
8    #[doc(alias = "gst_rtsp_server_attach")]
9    fn attach(
10        &self,
11        context: Option<&glib::MainContext>,
12    ) -> Result<SourceId, glib::error::BoolError> {
13        unsafe {
14            match ffi::gst_rtsp_server_attach(
15                self.as_ref().to_glib_none().0,
16                context.to_glib_none().0,
17            ) {
18                0 => Err(glib::bool_error!(
19                    "Failed to attach main context to RTSP server"
20                )),
21                id => Ok(from_glib(id)),
22            }
23        }
24    }
25}
26
27impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {}