gstreamer_rtsp_server/
rtsp_client.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{ffi, RTSPClient, RTSPSession};
4use glib::{prelude::*, source::SourceId, translate::*};
5use gst_rtsp::rtsp_message::RTSPMessage;
6
7pub trait RTSPClientExtManual: IsA<RTSPClient> + 'static {
8    /// Attaches `self` to `context`. When the mainloop for `context` is run, the
9    /// client will be dispatched. When `context` is [`None`], the default context will be
10    /// used).
11    ///
12    /// This function should be called when the client properties and urls are fully
13    /// configured and the client is ready to start.
14    /// ## `context`
15    /// a [`glib::MainContext`][crate::glib::MainContext]
16    ///
17    /// # Returns
18    ///
19    /// the ID (greater than 0) for the source within the GMainContext.
20    #[doc(alias = "gst_rtsp_client_attach")]
21    fn attach(&self, context: Option<&glib::MainContext>) -> SourceId {
22        unsafe {
23            from_glib(ffi::gst_rtsp_client_attach(
24                self.as_ref().to_glib_none().0,
25                context.to_glib_none().0,
26            ))
27        }
28    }
29
30    #[doc(alias = "gst_rtsp_client_send_message")]
31    fn send_message(
32        &self,
33        message: &RTSPMessage,
34        session: Option<&RTSPSession>,
35    ) -> gst_rtsp::RTSPResult {
36        unsafe {
37            from_glib(ffi::gst_rtsp_client_send_message(
38                self.as_ref().to_glib_none().0,
39                session.to_glib_none().0,
40                message.to_glib_none().0,
41            ))
42        }
43    }
44}
45
46impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {}