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)
|
2017-12-03 12:40:38 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
use Object;
|
|
|
|
use Plugin;
|
|
|
|
use PluginFeature;
|
|
|
|
use ffi;
|
|
|
|
use glib;
|
|
|
|
use glib::object::IsA;
|
2019-01-16 11:32:39 +00:00
|
|
|
use glib::object::ObjectType;
|
2017-12-03 12:40:38 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2017-12-03 12:40:38 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use glib_ffi;
|
2017-12-03 12:51:16 +00:00
|
|
|
use std;
|
2017-12-03 12:40:38 +00:00
|
|
|
use std::boxed::Box as Box_;
|
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
glib_wrapper! {
|
2019-01-16 11:32:39 +00:00
|
|
|
pub struct Registry(Object<ffi::GstRegistry, ffi::GstRegistryClass, RegistryClass>) @extends Object;
|
2017-12-03 12:40:38 +00:00
|
|
|
|
|
|
|
match fn {
|
|
|
|
get_type => || ffi::gst_registry_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Registry {
|
|
|
|
pub fn add_feature<P: IsA<PluginFeature>>(&self, feature: &P) -> Result<(), glib::error::BoolError> {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
glib_result_from_gboolean!(ffi::gst_registry_add_feature(self.to_glib_none().0, feature.as_ref().to_glib_none().0), "Failed to add feature")
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 {
|
2019-01-21 20:00:48 +00:00
|
|
|
glib_result_from_gboolean!(ffi::gst_registry_add_plugin(self.to_glib_none().0, plugin.to_glib_none().0), "Failed to add plugin")
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn check_feature_version(&self, feature_name: &str, min_major: u32, min_minor: u32, min_micro: u32) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_registry_check_feature_version(self.to_glib_none().0, feature_name.to_glib_none().0, min_major, min_minor, min_micro))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-29 13:53:44 +00:00
|
|
|
pub fn feature_filter<P: FnMut(&PluginFeature) -> bool>(&self, filter: P, first: bool) -> Vec<PluginFeature> {
|
|
|
|
let filter_data: P = filter;
|
|
|
|
unsafe extern "C" fn filter_func<P: FnMut(&PluginFeature) -> bool>(feature: *mut ffi::GstPluginFeature, user_data: glib_ffi::gpointer) -> glib_ffi::gboolean {
|
|
|
|
let feature = from_glib_borrow(feature);
|
|
|
|
let callback: *mut P = user_data as *const _ as usize as *mut P;
|
|
|
|
let res = (*callback)(&feature);
|
|
|
|
res.to_glib()
|
|
|
|
}
|
|
|
|
let filter = Some(filter_func::<P> as _);
|
|
|
|
let super_callback0: &P = &filter_data;
|
|
|
|
unsafe {
|
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::gst_registry_feature_filter(self.to_glib_none().0, filter, first.to_glib(), super_callback0 as *const _ as usize as *mut _))
|
|
|
|
}
|
|
|
|
}
|
2017-12-03 12:40:38 +00:00
|
|
|
|
|
|
|
pub fn find_feature(&self, name: &str, type_: glib::types::Type) -> Option<PluginFeature> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_registry_find_feature(self.to_glib_none().0, name.to_glib_none().0, type_.to_glib()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn find_plugin(&self, name: &str) -> Option<Plugin> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_registry_find_plugin(self.to_glib_none().0, name.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_feature_list(&self, type_: glib::types::Type) -> Vec<PluginFeature> {
|
|
|
|
unsafe {
|
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::gst_registry_get_feature_list(self.to_glib_none().0, type_.to_glib()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_feature_list_by_plugin(&self, name: &str) -> Vec<PluginFeature> {
|
|
|
|
unsafe {
|
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::gst_registry_get_feature_list_by_plugin(self.to_glib_none().0, name.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_feature_list_cookie(&self) -> u32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_registry_get_feature_list_cookie(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_plugin_list(&self) -> Vec<Plugin> {
|
|
|
|
unsafe {
|
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::gst_registry_get_plugin_list(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn lookup(&self, filename: &str) -> Option<Plugin> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_registry_lookup(self.to_glib_none().0, filename.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn lookup_feature(&self, name: &str) -> Option<PluginFeature> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_registry_lookup_feature(self.to_glib_none().0, name.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-29 13:53:44 +00:00
|
|
|
pub fn plugin_filter<P: FnMut(&Plugin) -> bool>(&self, filter: P, first: bool) -> Vec<Plugin> {
|
|
|
|
let filter_data: P = filter;
|
|
|
|
unsafe extern "C" fn filter_func<P: FnMut(&Plugin) -> bool>(plugin: *mut ffi::GstPlugin, user_data: glib_ffi::gpointer) -> glib_ffi::gboolean {
|
|
|
|
let plugin = from_glib_borrow(plugin);
|
|
|
|
let callback: *mut P = user_data as *const _ as usize as *mut P;
|
|
|
|
let res = (*callback)(&plugin);
|
|
|
|
res.to_glib()
|
|
|
|
}
|
|
|
|
let filter = Some(filter_func::<P> as _);
|
|
|
|
let super_callback0: &P = &filter_data;
|
|
|
|
unsafe {
|
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::gst_registry_plugin_filter(self.to_glib_none().0, filter, first.to_glib(), super_callback0 as *const _ as usize as *mut _))
|
|
|
|
}
|
|
|
|
}
|
2017-12-03 12:40:38 +00:00
|
|
|
|
|
|
|
pub fn remove_feature<P: IsA<PluginFeature>>(&self, feature: &P) {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::gst_registry_remove_feature(self.to_glib_none().0, feature.as_ref().to_glib_none().0);
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-21 20:00:48 +00:00
|
|
|
pub fn remove_plugin(&self, plugin: &Plugin) {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2019-01-21 20:00:48 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-03 12:54:52 +00:00
|
|
|
pub fn scan_path<P: AsRef<std::path::Path>>(&self, path: P) -> bool {
|
2017-12-03 12:40:38 +00:00
|
|
|
unsafe {
|
2017-12-03 12:54:52 +00:00
|
|
|
from_glib(ffi::gst_registry_scan_path(self.to_glib_none().0, path.as_ref().to_glib_none().0))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get() -> Registry {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_none(ffi::gst_registry_get())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn connect_feature_added<F: Fn(&Registry, &PluginFeature) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"feature-added\0".as_ptr() as *const _,
|
2019-01-29 13:53:44 +00:00
|
|
|
Some(transmute(feature_added_trampoline::<F> as usize)), Box_::into_raw(f))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn connect_plugin_added<F: Fn(&Registry, &Plugin) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"plugin-added\0".as_ptr() as *const _,
|
2019-01-29 13:53:44 +00:00
|
|
|
Some(transmute(plugin_added_trampoline::<F> as usize)), Box_::into_raw(f))
|
2017-12-03 12:40:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for Registry {}
|
|
|
|
unsafe impl Sync for Registry {}
|
|
|
|
|
2019-01-29 13:53:44 +00:00
|
|
|
unsafe extern "C" fn feature_added_trampoline<F: Fn(&Registry, &PluginFeature) + Send + Sync + 'static>(this: *mut ffi::GstRegistry, feature: *mut ffi::GstPluginFeature, f: glib_ffi::gpointer) {
|
|
|
|
let f: &F = transmute(f);
|
2017-12-03 12:40:38 +00:00
|
|
|
f(&from_glib_borrow(this), &from_glib_borrow(feature))
|
|
|
|
}
|
|
|
|
|
2019-01-29 13:53:44 +00:00
|
|
|
unsafe extern "C" fn plugin_added_trampoline<F: Fn(&Registry, &Plugin) + Send + Sync + 'static>(this: *mut ffi::GstRegistry, plugin: *mut ffi::GstPlugin, f: glib_ffi::gpointer) {
|
|
|
|
let f: &F = transmute(f);
|
2017-12-03 12:40:38 +00:00
|
|
|
f(&from_glib_borrow(this), &from_glib_borrow(plugin))
|
|
|
|
}
|