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