gstreamer_rtsp_server/auto/rtsp_mount_points.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, RTSPMediaFactory};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// Creates a [`RTSPMediaFactory`][crate::RTSPMediaFactory] object for a given url.
11 ///
12 /// # Implements
13 ///
14 /// [`RTSPMountPointsExt`][trait@crate::prelude::RTSPMountPointsExt], [`trait@glib::ObjectExt`]
15 #[doc(alias = "GstRTSPMountPoints")]
16 pub struct RTSPMountPoints(Object<ffi::GstRTSPMountPoints, ffi::GstRTSPMountPointsClass>);
17
18 match fn {
19 type_ => || ffi::gst_rtsp_mount_points_get_type(),
20 }
21}
22
23impl RTSPMountPoints {
24 pub const NONE: Option<&'static RTSPMountPoints> = None;
25
26 /// Make a new mount points object.
27 ///
28 /// # Returns
29 ///
30 /// a new [`RTSPMountPoints`][crate::RTSPMountPoints]
31 #[doc(alias = "gst_rtsp_mount_points_new")]
32 pub fn new() -> RTSPMountPoints {
33 assert_initialized_main_thread!();
34 unsafe { from_glib_full(ffi::gst_rtsp_mount_points_new()) }
35 }
36}
37
38impl Default for RTSPMountPoints {
39 fn default() -> Self {
40 Self::new()
41 }
42}
43
44unsafe impl Send for RTSPMountPoints {}
45unsafe impl Sync for RTSPMountPoints {}
46
47/// Trait containing all [`struct@RTSPMountPoints`] methods.
48///
49/// # Implementors
50///
51/// [`RTSPMountPoints`][struct@crate::RTSPMountPoints]
52pub trait RTSPMountPointsExt: IsA<RTSPMountPoints> + 'static {
53 /// Attach `factory` to the mount point `path` in `self`.
54 ///
55 /// `path` is either of the form (/node)+ or the root path '/'. (An empty path is
56 /// not allowed.) Any previous mount point will be freed.
57 ///
58 /// Ownership is taken of the reference on `factory` so that `factory` should not be
59 /// used after calling this function.
60 /// ## `path`
61 /// a mount point
62 /// ## `factory`
63 /// a [`RTSPMediaFactory`][crate::RTSPMediaFactory]
64 #[doc(alias = "gst_rtsp_mount_points_add_factory")]
65 fn add_factory(&self, path: &str, factory: impl IsA<RTSPMediaFactory>) {
66 unsafe {
67 ffi::gst_rtsp_mount_points_add_factory(
68 self.as_ref().to_glib_none().0,
69 path.to_glib_none().0,
70 factory.upcast().into_glib_ptr(),
71 );
72 }
73 }
74
75 /// Make a path string from `url`.
76 /// ## `url`
77 /// a [`gst_rtsp::RTSPUrl`][crate::gst_rtsp::RTSPUrl]
78 ///
79 /// # Returns
80 ///
81 /// a path string for `url`, `g_free()` after usage.
82 #[doc(alias = "gst_rtsp_mount_points_make_path")]
83 fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Result<glib::GString, glib::BoolError> {
84 unsafe {
85 Option::<_>::from_glib_full(ffi::gst_rtsp_mount_points_make_path(
86 self.as_ref().to_glib_none().0,
87 url.to_glib_none().0,
88 ))
89 .ok_or_else(|| glib::bool_error!("Failed to make path"))
90 }
91 }
92
93 /// Find the factory in `self` that has the longest match with `path`.
94 ///
95 /// If `matched` is [`None`], `path` will match the factory exactly otherwise
96 /// the amount of characters that matched is returned in `matched`.
97 /// ## `path`
98 /// a mount point
99 ///
100 /// # Returns
101 ///
102 /// the [`RTSPMediaFactory`][crate::RTSPMediaFactory] for `path`.
103 /// `g_object_unref()` after usage.
104 ///
105 /// ## `matched`
106 /// the amount of `path` matched
107 #[doc(alias = "gst_rtsp_mount_points_match")]
108 #[doc(alias = "match")]
109 fn match_(&self, path: &str) -> (RTSPMediaFactory, i32) {
110 unsafe {
111 let mut matched = std::mem::MaybeUninit::uninit();
112 let ret = from_glib_full(ffi::gst_rtsp_mount_points_match(
113 self.as_ref().to_glib_none().0,
114 path.to_glib_none().0,
115 matched.as_mut_ptr(),
116 ));
117 (ret, matched.assume_init())
118 }
119 }
120
121 /// Remove the [`RTSPMediaFactory`][crate::RTSPMediaFactory] associated with `path` in `self`.
122 /// ## `path`
123 /// a mount point
124 #[doc(alias = "gst_rtsp_mount_points_remove_factory")]
125 fn remove_factory(&self, path: &str) {
126 unsafe {
127 ffi::gst_rtsp_mount_points_remove_factory(
128 self.as_ref().to_glib_none().0,
129 path.to_glib_none().0,
130 );
131 }
132 }
133}
134
135impl<O: IsA<RTSPMountPoints>> RTSPMountPointsExt for O {}