gstreamer_rtsp_server/auto/
rtsp_mount_points.rs1use crate::{ffi, RTSPMediaFactory};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "GstRTSPMountPoints")]
11 pub struct RTSPMountPoints(Object<ffi::GstRTSPMountPoints, ffi::GstRTSPMountPointsClass>);
12
13 match fn {
14 type_ => || ffi::gst_rtsp_mount_points_get_type(),
15 }
16}
17
18impl RTSPMountPoints {
19 pub const NONE: Option<&'static RTSPMountPoints> = None;
20
21 #[doc(alias = "gst_rtsp_mount_points_new")]
22 pub fn new() -> RTSPMountPoints {
23 assert_initialized_main_thread!();
24 unsafe { from_glib_full(ffi::gst_rtsp_mount_points_new()) }
25 }
26}
27
28impl Default for RTSPMountPoints {
29 fn default() -> Self {
30 Self::new()
31 }
32}
33
34unsafe impl Send for RTSPMountPoints {}
35unsafe impl Sync for RTSPMountPoints {}
36
37pub trait RTSPMountPointsExt: IsA<RTSPMountPoints> + 'static {
38 #[doc(alias = "gst_rtsp_mount_points_add_factory")]
39 fn add_factory(&self, path: &str, factory: impl IsA<RTSPMediaFactory>) {
40 unsafe {
41 ffi::gst_rtsp_mount_points_add_factory(
42 self.as_ref().to_glib_none().0,
43 path.to_glib_none().0,
44 factory.upcast().into_glib_ptr(),
45 );
46 }
47 }
48
49 #[doc(alias = "gst_rtsp_mount_points_make_path")]
50 fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Result<glib::GString, glib::BoolError> {
51 unsafe {
52 Option::<_>::from_glib_full(ffi::gst_rtsp_mount_points_make_path(
53 self.as_ref().to_glib_none().0,
54 url.to_glib_none().0,
55 ))
56 .ok_or_else(|| glib::bool_error!("Failed to make path"))
57 }
58 }
59
60 #[doc(alias = "gst_rtsp_mount_points_match")]
61 #[doc(alias = "match")]
62 fn match_(&self, path: &str) -> (RTSPMediaFactory, i32) {
63 unsafe {
64 let mut matched = std::mem::MaybeUninit::uninit();
65 let ret = from_glib_full(ffi::gst_rtsp_mount_points_match(
66 self.as_ref().to_glib_none().0,
67 path.to_glib_none().0,
68 matched.as_mut_ptr(),
69 ));
70 (ret, matched.assume_init())
71 }
72 }
73
74 #[doc(alias = "gst_rtsp_mount_points_remove_factory")]
75 fn remove_factory(&self, path: &str) {
76 unsafe {
77 ffi::gst_rtsp_mount_points_remove_factory(
78 self.as_ref().to_glib_none().0,
79 path.to_glib_none().0,
80 );
81 }
82 }
83}
84
85impl<O: IsA<RTSPMountPoints>> RTSPMountPointsExt for O {}