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-12-03 12:40:38 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2020-11-21 13:46:33 +00:00
|
|
|
use crate::Object;
|
|
|
|
use crate::Plugin;
|
|
|
|
use crate::PluginFeature;
|
2017-12-03 12:40:38 +00:00
|
|
|
use glib::object::IsA;
|
2019-06-18 10:10:46 +00:00
|
|
|
use glib::object::ObjectType as ObjectType_;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2019-06-18 10:12:00 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2017-12-03 12:40:38 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use std::boxed::Box as Box_;
|
2020-04-13 16:11:33 +00:00
|
|
|
use std::mem::transmute;
|
2017-12-03 12:40:38 +00:00
|
|
|
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::wrapper! {
|
2021-06-02 07:47:51 +00:00
|
|
|
#[doc(alias = "GstRegistry")]
|
2020-11-21 13:46:33 +00:00
|
|
|
pub struct Registry(Object<ffi::GstRegistry, ffi::GstRegistryClass>) @extends Object;
|
2017-12-03 12:40:38 +00:00
|
|
|
|
|
|
|
match fn {
|
2021-04-19 19:55:01 +00:00
|
|
|
type_ => || ffi::gst_registry_get_type(),
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Registry {
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_add_feature")]
|
2021-05-23 19:22:45 +00:00
|
|
|
pub fn add_feature(
|
2019-06-18 10:12:00 +00:00
|
|
|
&self,
|
2021-05-23 19:22:45 +00:00
|
|
|
feature: &impl IsA<PluginFeature>,
|
2019-06-18 10:12:00 +00:00
|
|
|
) -> Result<(), glib::error::BoolError> {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::result_from_gboolean!(
|
2020-11-21 13:46:33 +00:00
|
|
|
ffi::gst_registry_add_feature(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
feature.as_ref().to_glib_none().0
|
|
|
|
),
|
|
|
|
"Failed to add feature"
|
|
|
|
)
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_add_plugin")]
|
2019-01-21 20:00:48 +00:00
|
|
|
pub fn add_plugin(&self, plugin: &Plugin) -> Result<(), glib::error::BoolError> {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::result_from_gboolean!(
|
2020-11-21 13:46:33 +00:00
|
|
|
ffi::gst_registry_add_plugin(self.to_glib_none().0, plugin.to_glib_none().0),
|
2019-06-18 10:12:00 +00:00
|
|
|
"Failed to add plugin"
|
|
|
|
)
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_check_feature_version")]
|
2019-06-18 10:12:00 +00:00
|
|
|
pub fn check_feature_version(
|
|
|
|
&self,
|
|
|
|
feature_name: &str,
|
|
|
|
min_major: u32,
|
|
|
|
min_minor: u32,
|
|
|
|
min_micro: u32,
|
|
|
|
) -> bool {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib(ffi::gst_registry_check_feature_version(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
feature_name.to_glib_none().0,
|
|
|
|
min_major,
|
|
|
|
min_minor,
|
|
|
|
min_micro,
|
|
|
|
))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_find_feature")]
|
2017-12-03 12:40:38 +00:00
|
|
|
pub fn find_feature(&self, name: &str, type_: glib::types::Type) -> Option<PluginFeature> {
|
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib_full(ffi::gst_registry_find_feature(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
name.to_glib_none().0,
|
2021-04-27 15:10:39 +00:00
|
|
|
type_.into_glib(),
|
2019-06-18 10:12:00 +00:00
|
|
|
))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_find_plugin")]
|
2017-12-03 12:40:38 +00:00
|
|
|
pub fn find_plugin(&self, name: &str) -> Option<Plugin> {
|
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib_full(ffi::gst_registry_find_plugin(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
name.to_glib_none().0,
|
|
|
|
))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_get_feature_list_cookie")]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "get_feature_list_cookie")]
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn feature_list_cookie(&self) -> u32 {
|
2020-11-21 13:46:33 +00:00
|
|
|
unsafe { ffi::gst_registry_get_feature_list_cookie(self.to_glib_none().0) }
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_lookup")]
|
2017-12-03 12:40:38 +00:00
|
|
|
pub fn lookup(&self, filename: &str) -> Option<Plugin> {
|
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib_full(ffi::gst_registry_lookup(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
filename.to_glib_none().0,
|
|
|
|
))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_lookup_feature")]
|
2017-12-03 12:40:38 +00:00
|
|
|
pub fn lookup_feature(&self, name: &str) -> Option<PluginFeature> {
|
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib_full(ffi::gst_registry_lookup_feature(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
name.to_glib_none().0,
|
|
|
|
))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_remove_feature")]
|
2021-05-23 19:22:45 +00:00
|
|
|
pub fn remove_feature(&self, feature: &impl IsA<PluginFeature>) {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
ffi::gst_registry_remove_feature(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
feature.as_ref().to_glib_none().0,
|
|
|
|
);
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_remove_plugin")]
|
2019-01-21 20:00:48 +00:00
|
|
|
pub fn remove_plugin(&self, plugin: &Plugin) {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
ffi::gst_registry_remove_plugin(self.to_glib_none().0, plugin.to_glib_none().0);
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_scan_path")]
|
2021-05-23 19:22:45 +00:00
|
|
|
pub fn scan_path(&self, path: impl AsRef<std::path::Path>) -> bool {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
from_glib(ffi::gst_registry_scan_path(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
path.as_ref().to_glib_none().0,
|
|
|
|
))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_registry_get")]
|
2017-12-03 12:40:38 +00:00
|
|
|
pub fn get() -> Registry {
|
|
|
|
assert_initialized_main_thread!();
|
2020-11-21 13:46:33 +00:00
|
|
|
unsafe { from_glib_none(ffi::gst_registry_get()) }
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "feature-added")]
|
2021-05-26 22:02:42 +00:00
|
|
|
pub fn connect_feature_added<F: Fn(&Self, &PluginFeature) + Send + Sync + 'static>(
|
2019-06-18 10:12:00 +00:00
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId {
|
|
|
|
unsafe extern "C" fn feature_added_trampoline<
|
|
|
|
F: Fn(&Registry, &PluginFeature) + Send + Sync + 'static,
|
|
|
|
>(
|
2020-11-21 13:46:33 +00:00
|
|
|
this: *mut ffi::GstRegistry,
|
|
|
|
feature: *mut ffi::GstPluginFeature,
|
|
|
|
f: glib::ffi::gpointer,
|
2019-06-18 10:12:00 +00:00
|
|
|
) {
|
2019-06-18 10:10:46 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
|
|
|
f(&from_glib_borrow(this), &from_glib_borrow(feature))
|
|
|
|
}
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-06-18 10:12:00 +00:00
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"feature-added\0".as_ptr() as *const _,
|
2020-04-13 16:11:33 +00:00
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
feature_added_trampoline::<F> as *const (),
|
|
|
|
)),
|
2019-06-18 10:12:00 +00:00
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "plugin-added")]
|
2021-05-26 22:02:42 +00:00
|
|
|
pub fn connect_plugin_added<F: Fn(&Self, &Plugin) + Send + Sync + 'static>(
|
2019-06-18 10:12:00 +00:00
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId {
|
|
|
|
unsafe extern "C" fn plugin_added_trampoline<
|
|
|
|
F: Fn(&Registry, &Plugin) + Send + Sync + 'static,
|
|
|
|
>(
|
2020-11-21 13:46:33 +00:00
|
|
|
this: *mut ffi::GstRegistry,
|
|
|
|
plugin: *mut ffi::GstPlugin,
|
|
|
|
f: glib::ffi::gpointer,
|
2019-06-18 10:12:00 +00:00
|
|
|
) {
|
2019-06-18 10:10:46 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
|
|
|
f(&from_glib_borrow(this), &from_glib_borrow(plugin))
|
|
|
|
}
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-06-18 10:12:00 +00:00
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"plugin-added\0".as_ptr() as *const _,
|
2020-04-13 16:11:33 +00:00
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
plugin_added_trampoline::<F> as *const (),
|
|
|
|
)),
|
2019-06-18 10:12:00 +00:00
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for Registry {}
|
|
|
|
unsafe impl Sync for Registry {}
|