Generate Bus/ElementFactory without traits, generate Plugin

This commit is contained in:
Sebastian Dröge 2017-07-03 14:06:08 +03:00
parent aa3581cee9
commit 602c3f257f
7 changed files with 261 additions and 199 deletions

View file

@ -25,7 +25,6 @@ generate = [
"Gst.PadTemplate",
"Gst.URIHandler",
"Gst.URIType",
"Gst.ElementFactory",
"Gst.ElementFactoryListType",
"Gst.Format",
"Gst.MessageType",
@ -62,6 +61,7 @@ status = "generate"
[[object]]
name = "Gst.Bus"
status = "generate"
trait = false
[[object.function]]
name = "remove_watch"
# Needs manual bindings and GSource support in glib-rs
@ -136,6 +136,11 @@ status = "generate"
[object.function.return]
bool_return_is_error = "Failed to sync state with parent"
[[object]]
name = "Gst.ElementFactory"
status = "generate"
trait = false
[[object]]
name = "Gst.Object"
status = "generate"
@ -182,6 +187,11 @@ status = "generate"
[object.function.return]
bool_return_is_error = "Failed to activate pad"
[[object]]
name = "Gst.Plugin"
status = "generate"
trait = false
[[object]]
name = "Gst.*"
status = "generate"

View file

@ -5,9 +5,6 @@ use ClockTime;
use Message;
use Object;
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
@ -28,169 +25,125 @@ impl Bus {
from_glib_full(ffi::gst_bus_new())
}
}
}
unsafe impl Send for Bus {}
unsafe impl Sync for Bus {}
pub trait BusExt {
fn add_signal_watch(&self);
fn add_signal_watch_full(&self, priority: i32);
//fn add_watch<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/BusFunc, user_data: P) -> u32;
//fn add_watch_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priority: i32, func: /*Unknown conversion*//*Unimplemented*/BusFunc, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> u32;
//fn async_signal_func<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> bool;
//fn create_watch(&self) -> /*Ignored*/Option<glib::Source>;
fn disable_sync_message_emission(&self);
fn enable_sync_message_emission(&self);
fn have_pending(&self) -> bool;
fn peek(&self) -> Option<Message>;
fn pop(&self) -> Option<Message>;
fn post(&self, message: &mut Message) -> bool;
fn remove_signal_watch(&self);
fn set_flushing(&self, flushing: bool);
//fn set_sync_handler<'a, P: Into<Option<&'a /*Unimplemented*/BusSyncHandler>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
//fn sync_signal_handler<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> /*Ignored*/BusSyncReply;
fn timed_pop(&self, timeout: ClockTime) -> Option<Message>;
fn connect_message<F: Fn(&Self, &Message) + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_sync_message<F: Fn(&Self, &Message) + Send + Sync + 'static>(&self, f: F) -> u64;
}
impl<O: IsA<Bus> + IsA<glib::object::Object>> BusExt for O {
fn add_signal_watch(&self) {
pub fn add_signal_watch(&self) {
unsafe {
ffi::gst_bus_add_signal_watch(self.to_glib_none().0);
}
}
fn add_signal_watch_full(&self, priority: i32) {
pub fn add_signal_watch_full(&self, priority: i32) {
unsafe {
ffi::gst_bus_add_signal_watch_full(self.to_glib_none().0, priority);
}
}
//fn add_watch<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/BusFunc, user_data: P) -> u32 {
//pub fn add_watch<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/BusFunc, user_data: P) -> u32 {
// unsafe { TODO: call ffi::gst_bus_add_watch() }
//}
//fn add_watch_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priority: i32, func: /*Unknown conversion*//*Unimplemented*/BusFunc, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> u32 {
//pub fn add_watch_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priority: i32, func: /*Unknown conversion*//*Unimplemented*/BusFunc, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> u32 {
// unsafe { TODO: call ffi::gst_bus_add_watch_full() }
//}
//fn async_signal_func<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> bool {
//pub fn async_signal_func<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> bool {
// unsafe { TODO: call ffi::gst_bus_async_signal_func() }
//}
//fn create_watch(&self) -> /*Ignored*/Option<glib::Source> {
//pub fn create_watch(&self) -> /*Ignored*/Option<glib::Source> {
// unsafe { TODO: call ffi::gst_bus_create_watch() }
//}
fn disable_sync_message_emission(&self) {
pub fn disable_sync_message_emission(&self) {
unsafe {
ffi::gst_bus_disable_sync_message_emission(self.to_glib_none().0);
}
}
fn enable_sync_message_emission(&self) {
pub fn enable_sync_message_emission(&self) {
unsafe {
ffi::gst_bus_enable_sync_message_emission(self.to_glib_none().0);
}
}
fn have_pending(&self) -> bool {
pub fn have_pending(&self) -> bool {
unsafe {
from_glib(ffi::gst_bus_have_pending(self.to_glib_none().0))
}
}
fn peek(&self) -> Option<Message> {
pub fn peek(&self) -> Option<Message> {
unsafe {
from_glib_full(ffi::gst_bus_peek(self.to_glib_none().0))
}
}
fn pop(&self) -> Option<Message> {
pub fn pop(&self) -> Option<Message> {
unsafe {
from_glib_full(ffi::gst_bus_pop(self.to_glib_none().0))
}
}
fn post(&self, message: &mut Message) -> bool {
pub fn post(&self, message: &mut Message) -> bool {
unsafe {
from_glib(ffi::gst_bus_post(self.to_glib_none().0, message.to_glib_full()))
}
}
fn remove_signal_watch(&self) {
pub fn remove_signal_watch(&self) {
unsafe {
ffi::gst_bus_remove_signal_watch(self.to_glib_none().0);
}
}
fn set_flushing(&self, flushing: bool) {
pub fn set_flushing(&self, flushing: bool) {
unsafe {
ffi::gst_bus_set_flushing(self.to_glib_none().0, flushing.to_glib());
}
}
//fn set_sync_handler<'a, P: Into<Option<&'a /*Unimplemented*/BusSyncHandler>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
//pub fn set_sync_handler<'a, P: Into<Option<&'a /*Unimplemented*/BusSyncHandler>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::gst_bus_set_sync_handler() }
//}
//fn sync_signal_handler<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> /*Ignored*/BusSyncReply {
//pub fn sync_signal_handler<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> /*Ignored*/BusSyncReply {
// unsafe { TODO: call ffi::gst_bus_sync_signal_handler() }
//}
fn timed_pop(&self, timeout: ClockTime) -> Option<Message> {
pub fn timed_pop(&self, timeout: ClockTime) -> Option<Message> {
unsafe {
from_glib_full(ffi::gst_bus_timed_pop(self.to_glib_none().0, timeout))
}
}
fn connect_message<F: Fn(&Self, &Message) + Send + Sync + 'static>(&self, f: F) -> u64 {
pub fn connect_message<F: Fn(&Bus, &Message) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &Message) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
let f: Box_<Box_<Fn(&Bus, &Message) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "message",
transmute(message_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
transmute(message_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_sync_message<F: Fn(&Self, &Message) + Send + Sync + 'static>(&self, f: F) -> u64 {
pub fn connect_sync_message<F: Fn(&Bus, &Message) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &Message) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
let f: Box_<Box_<Fn(&Bus, &Message) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "sync-message",
transmute(sync_message_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
transmute(sync_message_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn message_trampoline<P>(this: *mut ffi::GstBus, message: *mut ffi::GstMessage, f: glib_ffi::gpointer)
where P: IsA<Bus> {
unsafe impl Send for Bus {}
unsafe impl Sync for Bus {}
unsafe extern "C" fn message_trampoline(this: *mut ffi::GstBus, message: *mut ffi::GstMessage, f: glib_ffi::gpointer) {
callback_guard!();
let f: &Box_<Fn(&P, &Message) + Send + Sync + 'static> = transmute(f);
f(&Bus::from_glib_none(this).downcast_unchecked(), &from_glib_none(message))
let f: &Box_<Fn(&Bus, &Message) + Send + Sync + 'static> = transmute(f);
f(&from_glib_none(this), &from_glib_none(message))
}
unsafe extern "C" fn sync_message_trampoline<P>(this: *mut ffi::GstBus, message: *mut ffi::GstMessage, f: glib_ffi::gpointer)
where P: IsA<Bus> {
unsafe extern "C" fn sync_message_trampoline(this: *mut ffi::GstBus, message: *mut ffi::GstMessage, f: glib_ffi::gpointer) {
callback_guard!();
let f: &Box_<Fn(&P, &Message) + Send + Sync + 'static> = transmute(f);
f(&Bus::from_glib_none(this).downcast_unchecked(), &from_glib_none(message))
let f: &Box_<Fn(&Bus, &Message) + Send + Sync + 'static> = transmute(f);
f(&from_glib_none(this), &from_glib_none(message))
}

View file

@ -11,6 +11,7 @@ use Message;
use Object;
use Pad;
use PadTemplate;
use Plugin;
use SeekFlags;
use SeekType;
use State;
@ -50,9 +51,13 @@ impl Element {
}
}
//pub fn register<'a, P: Into<Option<&'a /*Ignored*/Plugin>>>(plugin: P, name: &str, rank: u32, type_: glib::types::Type) -> bool {
// unsafe { TODO: call ffi::gst_element_register() }
//}
pub fn register<'a, P: Into<Option<&'a Plugin>>>(plugin: P, name: &str, rank: u32, type_: glib::types::Type) -> bool {
let plugin = plugin.into();
let plugin = plugin.to_glib_none();
unsafe {
from_glib(ffi::gst_element_register(plugin.0, name.to_glib_none().0, rank, type_.to_glib()))
}
}
pub fn state_change_return_get_name(state_ret: StateChangeReturn) -> Option<String> {
unsafe {

View file

@ -7,7 +7,6 @@ use Object;
use URIType;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
glib_wrapper! {
@ -19,6 +18,82 @@ glib_wrapper! {
}
impl ElementFactory {
//pub fn can_sink_all_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_sink_all_caps() }
//}
//pub fn can_sink_any_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_sink_any_caps() }
//}
//pub fn can_src_all_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_src_all_caps() }
//}
//pub fn can_src_any_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_src_any_caps() }
//}
pub fn create<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element> {
let name = name.into();
let name = name.to_glib_none();
unsafe {
from_glib_none(ffi::gst_element_factory_create(self.to_glib_none().0, name.0))
}
}
pub fn get_element_type(&self) -> glib::types::Type {
unsafe {
from_glib(ffi::gst_element_factory_get_element_type(self.to_glib_none().0))
}
}
pub fn get_metadata(&self, key: &str) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_element_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0))
}
}
pub fn get_metadata_keys(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_get_metadata_keys(self.to_glib_none().0))
}
}
pub fn get_num_pad_templates(&self) -> u32 {
unsafe {
ffi::gst_element_factory_get_num_pad_templates(self.to_glib_none().0)
}
}
//pub fn get_static_pad_templates(&self) -> /*Ignored*/Vec<StaticPadTemplate> {
// unsafe { TODO: call ffi::gst_element_factory_get_static_pad_templates() }
//}
pub fn get_uri_protocols(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_element_factory_get_uri_protocols(self.to_glib_none().0))
}
}
pub fn get_uri_type(&self) -> URIType {
unsafe {
from_glib(ffi::gst_element_factory_get_uri_type(self.to_glib_none().0))
}
}
pub fn has_interface(&self, interfacename: &str) -> bool {
unsafe {
from_glib(ffi::gst_element_factory_has_interface(self.to_glib_none().0, interfacename.to_glib_none().0))
}
}
pub fn list_is_type(&self, type_: ElementFactoryListType) -> bool {
unsafe {
from_glib(ffi::gst_element_factory_list_is_type(self.to_glib_none().0, type_))
}
}
pub fn find(name: &str) -> Option<ElementFactory> {
unsafe {
from_glib_full(ffi::gst_element_factory_find(name.to_glib_none().0))
@ -44,111 +119,3 @@ impl ElementFactory {
unsafe impl Send for ElementFactory {}
unsafe impl Sync for ElementFactory {}
pub trait ElementFactoryExt {
//fn can_sink_all_caps(&self, caps: /*Ignored*/&Caps) -> bool;
//fn can_sink_any_caps(&self, caps: /*Ignored*/&Caps) -> bool;
//fn can_src_all_caps(&self, caps: /*Ignored*/&Caps) -> bool;
//fn can_src_any_caps(&self, caps: /*Ignored*/&Caps) -> bool;
fn create<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element>;
fn get_element_type(&self) -> glib::types::Type;
fn get_metadata(&self, key: &str) -> Option<String>;
fn get_metadata_keys(&self) -> Vec<String>;
fn get_num_pad_templates(&self) -> u32;
//fn get_static_pad_templates(&self) -> /*Ignored*/Vec<StaticPadTemplate>;
fn get_uri_protocols(&self) -> Vec<String>;
fn get_uri_type(&self) -> URIType;
fn has_interface(&self, interfacename: &str) -> bool;
fn list_is_type(&self, type_: ElementFactoryListType) -> bool;
}
impl<O: IsA<ElementFactory>> ElementFactoryExt for O {
//fn can_sink_all_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_sink_all_caps() }
//}
//fn can_sink_any_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_sink_any_caps() }
//}
//fn can_src_all_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_src_all_caps() }
//}
//fn can_src_any_caps(&self, caps: /*Ignored*/&Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_src_any_caps() }
//}
fn create<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element> {
let name = name.into();
let name = name.to_glib_none();
unsafe {
from_glib_none(ffi::gst_element_factory_create(self.to_glib_none().0, name.0))
}
}
fn get_element_type(&self) -> glib::types::Type {
unsafe {
from_glib(ffi::gst_element_factory_get_element_type(self.to_glib_none().0))
}
}
fn get_metadata(&self, key: &str) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_element_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0))
}
}
fn get_metadata_keys(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_get_metadata_keys(self.to_glib_none().0))
}
}
fn get_num_pad_templates(&self) -> u32 {
unsafe {
ffi::gst_element_factory_get_num_pad_templates(self.to_glib_none().0)
}
}
//fn get_static_pad_templates(&self) -> /*Ignored*/Vec<StaticPadTemplate> {
// unsafe { TODO: call ffi::gst_element_factory_get_static_pad_templates() }
//}
fn get_uri_protocols(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_element_factory_get_uri_protocols(self.to_glib_none().0))
}
}
fn get_uri_type(&self) -> URIType {
unsafe {
from_glib(ffi::gst_element_factory_get_uri_type(self.to_glib_none().0))
}
}
fn has_interface(&self, interfacename: &str) -> bool {
unsafe {
from_glib(ffi::gst_element_factory_has_interface(self.to_glib_none().0, interfacename.to_glib_none().0))
}
}
fn list_is_type(&self, type_: ElementFactoryListType) -> bool {
unsafe {
from_glib(ffi::gst_element_factory_list_is_type(self.to_glib_none().0, type_))
}
}
}

View file

@ -6,6 +6,7 @@ use ClockTime;
use Element;
use Error;
use FlowReturn;
use Plugin;
use ffi;
use glib;
use glib::translate::*;
@ -161,9 +162,11 @@ pub fn deinit() {
}
}
//pub fn dynamic_type_register(plugin: /*Ignored*/&Plugin, type_: glib::types::Type) -> bool {
// unsafe { TODO: call ffi::gst_dynamic_type_register() }
//}
pub fn dynamic_type_register(plugin: &Plugin, type_: glib::types::Type) -> bool {
unsafe {
from_glib(ffi::gst_dynamic_type_register(plugin.to_glib_none().0, type_.to_glib()))
}
}
//pub fn error_get_message(domain: /*Ignored*/glib::Quark, code: i32) -> Option<String> {
// unsafe { TODO: call ffi::gst_error_get_message() }

View file

@ -7,7 +7,6 @@ pub use self::bin::BinExt;
mod bus;
pub use self::bus::Bus;
pub use self::bus::BusExt;
mod clock;
pub use self::clock::Clock;
@ -19,7 +18,6 @@ pub use self::element::ElementExt;
mod element_factory;
pub use self::element_factory::ElementFactory;
pub use self::element_factory::ElementFactoryExt;
mod object;
pub use self::object::Object;
@ -37,6 +35,9 @@ mod pipeline;
pub use self::pipeline::Pipeline;
pub use self::pipeline::PipelineExt;
mod plugin;
pub use self::plugin::Plugin;
mod u_r_i_handler;
pub use self::u_r_i_handler::URIHandler;
pub use self::u_r_i_handler::URIHandlerExt;
@ -116,10 +117,8 @@ pub mod functions;
#[doc(hidden)]
pub mod traits {
pub use super::BinExt;
pub use super::BusExt;
pub use super::ClockExt;
pub use super::ElementExt;
pub use super::ElementFactoryExt;
pub use super::ObjectExt;
pub use super::PadExt;
pub use super::PadTemplateExt;

View file

@ -0,0 +1,125 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use Error;
use Object;
use ffi;
use glib::translate::*;
use std::ptr;
glib_wrapper! {
pub struct Plugin(Object<ffi::GstPlugin>): Object;
match fn {
get_type => || ffi::gst_plugin_get_type(),
}
}
impl Plugin {
//pub fn add_dependency<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>, R: Into<Option<&'c str>>>(&self, env_vars: P, paths: Q, names: R, flags: /*Ignored*/PluginDependencyFlags) {
// unsafe { TODO: call ffi::gst_plugin_add_dependency() }
//}
//pub fn add_dependency_simple<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>, R: Into<Option<&'c str>>>(&self, env_vars: P, paths: Q, names: R, flags: /*Ignored*/PluginDependencyFlags) {
// unsafe { TODO: call ffi::gst_plugin_add_dependency_simple() }
//}
//pub fn get_cache_data(&self) -> /*Ignored*/Option<Structure> {
// unsafe { TODO: call ffi::gst_plugin_get_cache_data() }
//}
pub fn get_description(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_description(self.to_glib_none().0))
}
}
pub fn get_filename(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_filename(self.to_glib_none().0))
}
}
pub fn get_license(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_license(self.to_glib_none().0))
}
}
pub fn get_origin(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_origin(self.to_glib_none().0))
}
}
pub fn get_package(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_package(self.to_glib_none().0))
}
}
pub fn get_release_date_string(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_release_date_string(self.to_glib_none().0))
}
}
pub fn get_source(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_source(self.to_glib_none().0))
}
}
pub fn get_version(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_version(self.to_glib_none().0))
}
}
pub fn is_loaded(&self) -> bool {
unsafe {
from_glib(ffi::gst_plugin_is_loaded(self.to_glib_none().0))
}
}
pub fn load(&self) -> Option<Plugin> {
unsafe {
from_glib_full(ffi::gst_plugin_load(self.to_glib_none().0))
}
}
//pub fn set_cache_data(&self, cache_data: /*Ignored*/&mut Structure) {
// unsafe { TODO: call ffi::gst_plugin_set_cache_data() }
//}
pub fn list_free(list: &[Plugin]) {
unsafe {
ffi::gst_plugin_list_free(list.to_glib_full());
}
}
pub fn load_by_name(name: &str) -> Option<Plugin> {
unsafe {
from_glib_full(ffi::gst_plugin_load_by_name(name.to_glib_none().0))
}
}
pub fn load_file(filename: &str) -> Result<Plugin, Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::gst_plugin_load_file(filename.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
//pub fn register_static(major_version: i32, minor_version: i32, name: &str, description: &str, init_func: /*Unknown conversion*//*Unimplemented*/PluginInitFunc, version: &str, license: &str, source: &str, package: &str, origin: &str) -> bool {
// unsafe { TODO: call ffi::gst_plugin_register_static() }
//}
//pub fn register_static_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(major_version: i32, minor_version: i32, name: &str, description: &str, init_full_func: /*Unknown conversion*//*Unimplemented*/PluginInitFullFunc, version: &str, license: &str, source: &str, package: &str, origin: &str, user_data: P) -> bool {
// unsafe { TODO: call ffi::gst_plugin_register_static_full() }
//}
}
unsafe impl Send for Plugin {}
unsafe impl Sync for Plugin {}