2022-09-13 09:13:07 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
|
2023-01-03 18:58:25 +00:00
|
|
|
use glib::{prelude::*, translate::*};
|
|
|
|
|
|
|
|
use crate::{RTSPSession, RTSPSessionMedia};
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
mod sealed {
|
|
|
|
pub trait Sealed {}
|
|
|
|
impl<T: super::IsA<super::RTSPSession>> Sealed for T {}
|
2022-09-13 09:13:07 +00:00
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
pub trait RTSPSessionExtManual: sealed::Sealed + IsA<super::RTSPSession> + 'static {
|
|
|
|
#[doc(alias = "gst_rtsp_session_dup_media")]
|
|
|
|
#[doc(alias = "gst_rtsp_session_get_media")]
|
2022-09-13 09:13:07 +00:00
|
|
|
fn media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) {
|
2023-05-04 05:55:48 +00:00
|
|
|
#[cfg(feature = "v1_20")]
|
2022-09-13 09:13:07 +00:00
|
|
|
unsafe {
|
|
|
|
let mut matched = mem::MaybeUninit::uninit();
|
|
|
|
let ret = from_glib_full(ffi::gst_rtsp_session_dup_media(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
path.to_glib_none().0,
|
|
|
|
matched.as_mut_ptr(),
|
|
|
|
));
|
|
|
|
(ret, matched.assume_init())
|
|
|
|
}
|
2023-05-04 05:55:48 +00:00
|
|
|
#[cfg(not(any(feature = "v1_20", docsrs)))]
|
2022-09-13 09:13:07 +00:00
|
|
|
unsafe {
|
|
|
|
let mut matched = mem::MaybeUninit::uninit();
|
|
|
|
let ret = from_glib_none(ffi::gst_rtsp_session_get_media(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
path.to_glib_none().0,
|
|
|
|
matched.as_mut_ptr(),
|
|
|
|
));
|
|
|
|
(ret, matched.assume_init())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-05 20:21:43 +00:00
|
|
|
|
|
|
|
impl<O: IsA<RTSPSession>> RTSPSessionExtManual for O {}
|