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, URIType};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "GstURIHandler")]
11 pub struct URIHandler(Interface<ffi::GstURIHandler, ffi::GstURIHandlerInterface>);
12
13 match fn {
14 type_ => || ffi::gst_uri_handler_get_type(),
15 }
16}
17
18impl URIHandler {
19 pub const NONE: Option<&'static URIHandler> = None;
20}
21
22unsafe impl Send for URIHandler {}
23unsafe impl Sync for URIHandler {}
24
25mod sealed {
26 pub trait Sealed {}
27 impl<T: super::IsA<super::URIHandler>> Sealed for T {}
28}
29
30pub trait URIHandlerExt: IsA<URIHandler> + sealed::Sealed + 'static {
31 #[doc(alias = "gst_uri_handler_get_protocols")]
32 #[doc(alias = "get_protocols")]
33 fn protocols(&self) -> Vec<glib::GString> {
34 unsafe {
35 FromGlibPtrContainer::from_glib_none(ffi::gst_uri_handler_get_protocols(
36 self.as_ref().to_glib_none().0,
37 ))
38 }
39 }
40
41 #[doc(alias = "gst_uri_handler_get_uri")]
42 #[doc(alias = "get_uri")]
43 fn uri(&self) -> Option<glib::GString> {
44 unsafe { from_glib_full(ffi::gst_uri_handler_get_uri(self.as_ref().to_glib_none().0)) }
45 }
46
47 #[doc(alias = "gst_uri_handler_get_uri_type")]
48 #[doc(alias = "get_uri_type")]
49 fn uri_type(&self) -> URIType {
50 unsafe {
51 from_glib(ffi::gst_uri_handler_get_uri_type(
52 self.as_ref().to_glib_none().0,
53 ))
54 }
55 }
56
57 #[doc(alias = "gst_uri_handler_set_uri")]
58 fn set_uri(&self, uri: &str) -> Result<(), glib::Error> {
59 unsafe {
60 let mut error = std::ptr::null_mut();
61 let is_ok = ffi::gst_uri_handler_set_uri(
62 self.as_ref().to_glib_none().0,
63 uri.to_glib_none().0,
64 &mut error,
65 );
66 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
67 if error.is_null() {
68 Ok(())
69 } else {
70 Err(from_glib_full(error))
71 }
72 }
73 }
74}
75
76impl<O: IsA<URIHandler>> URIHandlerExt for O {}
77