gstreamer_rtsp_server/
rtsp_session.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::mem;
4
5use glib::{prelude::*, translate::*};
6
7use crate::{ffi, RTSPSession, RTSPSessionMedia};
8
9pub trait RTSPSessionExtManual: IsA<super::RTSPSession> + 'static {
10    #[doc(alias = "gst_rtsp_session_dup_media")]
11    #[doc(alias = "gst_rtsp_session_get_media")]
12    fn media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) {
13        #[cfg(feature = "v1_20")]
14        unsafe {
15            let mut matched = mem::MaybeUninit::uninit();
16            let ret = from_glib_full(ffi::gst_rtsp_session_dup_media(
17                self.as_ref().to_glib_none().0,
18                path.to_glib_none().0,
19                matched.as_mut_ptr(),
20            ));
21            (ret, matched.assume_init())
22        }
23        #[cfg(not(any(feature = "v1_20", docsrs)))]
24        unsafe {
25            let mut matched = mem::MaybeUninit::uninit();
26            let ret = from_glib_none(ffi::gst_rtsp_session_get_media(
27                self.as_ref().to_glib_none().0,
28                path.to_glib_none().0,
29                matched.as_mut_ptr(),
30            ));
31            (ret, matched.assume_init())
32        }
33    }
34}
35
36impl<O: IsA<RTSPSession>> RTSPSessionExtManual for O {}