2018-04-23 17:34:22 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
2021-04-01 13:58:41 +00:00
|
|
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
2017-05-12 12:24:03 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2020-11-21 13:46:33 +00:00
|
|
|
use crate::URIType;
|
2017-05-12 12:24:03 +00:00
|
|
|
use glib::object::IsA;
|
|
|
|
use glib::translate::*;
|
|
|
|
use std::ptr;
|
|
|
|
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::wrapper! {
|
2021-06-02 07:47:51 +00:00
|
|
|
#[doc(alias = "GstURIHandler")]
|
2021-03-08 10:25:37 +00:00
|
|
|
pub struct URIHandler(Interface<ffi::GstURIHandler, ffi::GstURIHandlerInterface>);
|
2017-05-12 12:24:03 +00:00
|
|
|
|
|
|
|
match fn {
|
2021-04-19 19:55:01 +00:00
|
|
|
type_ => || ffi::gst_uri_handler_get_type(),
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-03 17:28:46 +00:00
|
|
|
impl URIHandler {
|
|
|
|
pub const NONE: Option<&'static URIHandler> = None;
|
|
|
|
}
|
2019-01-16 11:32:39 +00:00
|
|
|
|
2021-11-16 14:02:58 +00:00
|
|
|
unsafe impl Send for URIHandler {}
|
|
|
|
unsafe impl Sync for URIHandler {}
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
pub trait URIHandlerExt: 'static {
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_uri_handler_get_protocols")]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "get_protocols")]
|
2021-04-11 19:38:18 +00:00
|
|
|
fn protocols(&self) -> Vec<glib::GString>;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_uri_handler_get_uri")]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "get_uri")]
|
2021-04-11 19:38:18 +00:00
|
|
|
fn uri(&self) -> Option<glib::GString>;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_uri_handler_get_uri_type")]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "get_uri_type")]
|
2021-04-11 19:38:18 +00:00
|
|
|
fn uri_type(&self) -> URIType;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_uri_handler_set_uri")]
|
2019-11-10 16:55:02 +00:00
|
|
|
fn set_uri(&self, uri: &str) -> Result<(), glib::Error>;
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<O: IsA<URIHandler>> URIHandlerExt for O {
|
2021-04-11 19:38:18 +00:00
|
|
|
fn protocols(&self) -> Vec<glib::GString> {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
FromGlibPtrContainer::from_glib_none(ffi::gst_uri_handler_get_protocols(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
))
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
fn uri(&self) -> Option<glib::GString> {
|
2020-11-21 13:46:33 +00:00
|
|
|
unsafe { from_glib_full(ffi::gst_uri_handler_get_uri(self.as_ref().to_glib_none().0)) }
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
fn uri_type(&self) -> URIType {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib(ffi::gst_uri_handler_get_uri_type(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
))
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-10 16:55:02 +00:00
|
|
|
fn set_uri(&self, uri: &str) -> Result<(), glib::Error> {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
|
|
|
let mut error = ptr::null_mut();
|
2020-11-21 13:46:33 +00:00
|
|
|
let _ = ffi::gst_uri_handler_set_uri(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
uri.to_glib_none().0,
|
|
|
|
&mut error,
|
|
|
|
);
|
|
|
|
if error.is_null() {
|
|
|
|
Ok(())
|
|
|
|
} else {
|
|
|
|
Err(from_glib_full(error))
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|