From 6803cb5facf69c8d7815e7afa94521f643b111ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 1 May 2018 17:55:27 +0300 Subject: [PATCH] Move gobject-subclass to its own repository --- Cargo.toml | 1 - gobject-subclass/Cargo.toml | 16 - gobject-subclass/src/anyimpl.rs | 79 ----- gobject-subclass/src/guard.rs | 48 --- gobject-subclass/src/lib.rs | 24 -- gobject-subclass/src/object.rs | 530 ----------------------------- gobject-subclass/src/properties.rs | 216 ------------ gst-plugin-audiofx/Cargo.toml | 4 +- gst-plugin-file/Cargo.toml | 2 +- gst-plugin-flv/Cargo.toml | 2 +- gst-plugin-http/Cargo.toml | 2 +- gst-plugin-simple/Cargo.toml | 4 +- gst-plugin-togglerecord/Cargo.toml | 4 +- gst-plugin-tutorial/Cargo.toml | 4 +- gst-plugin/Cargo.toml | 4 +- 15 files changed, 13 insertions(+), 927 deletions(-) delete mode 100644 gobject-subclass/Cargo.toml delete mode 100644 gobject-subclass/src/anyimpl.rs delete mode 100644 gobject-subclass/src/guard.rs delete mode 100644 gobject-subclass/src/lib.rs delete mode 100644 gobject-subclass/src/object.rs delete mode 100644 gobject-subclass/src/properties.rs diff --git a/Cargo.toml b/Cargo.toml index 53c88e2d..98caf511 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,6 @@ [workspace] members = [ - "gobject-subclass", "gst-plugin", "gst-plugin-simple", "gst-plugin-file", diff --git a/gobject-subclass/Cargo.toml b/gobject-subclass/Cargo.toml deleted file mode 100644 index e929f052..00000000 --- a/gobject-subclass/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "gobject-subclass" -version = "0.1.0" -authors = ["Sebastian Dröge "] -repository = "https://github.com/sdroege/gst-plugin-rs/tree/master/gobject-subclass" -license = "MIT/Apache-2.0" - -[dependencies] -libc = "0.2" -glib-sys = { git = "https://github.com/gtk-rs/sys" } -gobject-sys = { git = "https://github.com/gtk-rs/sys" } -glib = { git = "https://github.com/gtk-rs/glib" } - -[lib] -name = "gobject_subclass" -path = "src/lib.rs" diff --git a/gobject-subclass/src/anyimpl.rs b/gobject-subclass/src/anyimpl.rs deleted file mode 100644 index ab8eef87..00000000 --- a/gobject-subclass/src/anyimpl.rs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2017 Sebastian Dröge -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Heavily inspired by the mopa trait - -use std::any::{Any, TypeId}; - -pub trait AnyImpl: Any { - fn get_type_id(&self) -> TypeId; -} - -impl AnyImpl for T { - fn get_type_id(&self) -> TypeId { - TypeId::of::() - } -} - -// warning: constraints is defined as a repetition to minimize code duplication. -// multiple items will generate invalide code. -#[macro_export] -macro_rules! any_impl { - - ($bound:ident, $trait:ident $(, $constraint:ident)*) => { - impl $trait - $( - where T::InstanceStructType: $constraint - )* - { - #[inline] - pub fn downcast_ref>(&self) -> Option<&U> { - if self.is::() { - unsafe { Some(self.downcast_ref_unchecked()) } - } else { - None - } - } - - #[inline] - pub unsafe fn downcast_ref_unchecked>(&self) -> &U { - &*(self as *const Self as *const U) - } - - #[inline] - pub fn is>(&self) -> bool { - use std::any::TypeId; - TypeId::of::() == $crate::anyimpl::AnyImpl::get_type_id(self) - } - } - }; - - ($trait:ident) => { - impl $trait { - #[inline] - pub fn downcast_ref(&self) -> Option<&U> { - if self.is::() { - unsafe { Some(self.downcast_ref_unchecked()) } - } else { - None - } - } - - #[inline] - pub unsafe fn downcast_ref_unchecked(&self) -> &U { - &*(self as *const Self as *const U) - } - - #[inline] - pub fn is(&self) -> bool { - use std::any::TypeId; - TypeId::of::() == $crate::anyimpl::AnyImpl::get_type_id(self) - } - } - }; -} diff --git a/gobject-subclass/src/guard.rs b/gobject-subclass/src/guard.rs deleted file mode 100644 index 2a61a26b..00000000 --- a/gobject-subclass/src/guard.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2016-2017 Sebastian Dröge -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::ptr; - -use glib_ffi; -use gobject_ffi; - -#[macro_export] -macro_rules! callback_guard { - () => { - let _guard = $crate::glib::CallbackGuard::new(); - }; -} - -#[macro_export] -macro_rules! floating_reference_guard { - ($obj:ident) => { - let _guard = $crate::guard::FloatingReferenceGuard::new($obj as *mut _); - }; -} - -pub struct FloatingReferenceGuard(ptr::NonNull); - -impl FloatingReferenceGuard { - pub unsafe fn new(obj: *mut gobject_ffi::GObject) -> Option { - assert!(!obj.is_null()); - if gobject_ffi::g_object_is_floating(obj) != glib_ffi::GFALSE { - gobject_ffi::g_object_ref_sink(obj); - Some(FloatingReferenceGuard(ptr::NonNull::new_unchecked(obj))) - } else { - None - } - } -} - -impl Drop for FloatingReferenceGuard { - fn drop(&mut self) { - unsafe { - gobject_ffi::g_object_force_floating(self.0.as_ptr()); - } - } -} diff --git a/gobject-subclass/src/lib.rs b/gobject-subclass/src/lib.rs deleted file mode 100644 index e8dfc90f..00000000 --- a/gobject-subclass/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2016-2017 Sebastian Dröge -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; - -extern crate libc; - -pub extern crate glib; - -#[macro_use] -pub mod anyimpl; - -#[macro_use] -pub mod guard; - -pub mod properties; -#[macro_use] -pub mod object; diff --git a/gobject-subclass/src/object.rs b/gobject-subclass/src/object.rs deleted file mode 100644 index bf0b3a47..00000000 --- a/gobject-subclass/src/object.rs +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright (C) 2017 Sebastian Dröge -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::any::TypeId; -use std::collections::BTreeMap; -use std::ffi::CString; -use std::mem; -use std::ptr; -use std::sync::Mutex; - -use glib_ffi; -use gobject_ffi; - -use glib; -use glib::translate::*; - -pub use properties::*; - -pub trait ObjectImpl: 'static { - fn set_property(&self, _obj: &glib::Object, _id: u32, _value: &glib::Value) { - unimplemented!() - } - - fn get_property(&self, _obj: &glib::Object, _id: u32) -> Result { - unimplemented!() - } - - fn notify(&self, obj: &glib::Object, name: &str) { - unsafe { - gobject_ffi::g_object_notify(obj.to_glib_none().0, name.to_glib_none().0); - } - } -} - -// warning: constraints is defined as a repetition to minimize code duplication. -// multiple items will generate invalide code. -#[macro_export] -macro_rules! box_object_impl( - ($name:ident $(, $constraint:ident)*) => { - impl ObjectImpl for Box<$name> - $( - where T::InstanceStructType: $constraint - )* - { - fn set_property(&self, obj: &glib::Object, id: u32, value: &glib::Value) { - let imp: &$name = self.as_ref(); - imp.set_property(obj, id, value); - } - - fn get_property(&self, obj: &glib::Object, id: u32) -> Result { - let imp: &$name = self.as_ref(); - imp.get_property(obj, id) - } - } - }; -); - -pub trait ImplTypeStatic: Send + Sync + 'static { - fn get_name(&self) -> &str; - fn new(&self, &T) -> T::ImplType; - fn class_init(&self, &mut ClassStruct); - fn type_init(&self, _: &TypeInitToken, _type_: glib::Type) {} -} - -pub struct ClassInitToken(()); -pub struct TypeInitToken(()); - -pub trait ObjectType: FromGlibPtrBorrow<*mut ::InstanceStructType> -where - Self: Sized + 'static, - Self::InstanceStructType: Instance, -{ - const NAME: &'static str; - type InstanceStructType: Instance + 'static; - type GlibType; - type GlibClassType; - type ImplType: ObjectImpl; - - fn glib_type() -> glib::Type; - - fn class_init(token: &ClassInitToken, klass: &mut ClassStruct); - - fn set_property(_obj: &Self, _id: u32, _value: &glib::Value) { - unimplemented!() - } - - fn get_property(_obj: &Self, _id: u32) -> Result { - unimplemented!() - } - - unsafe fn get_instance(&self) -> *mut Self::InstanceStructType; - - fn get_impl(&self) -> &Self::ImplType { - unsafe { (*self.get_instance()).get_impl() } - } - - unsafe fn get_class(&self) -> *const ClassStruct { - (*self.get_instance()).get_class() - } -} - -#[macro_export] -macro_rules! object_type_fns( - () => { - unsafe fn get_instance(&self) -> *mut Self::InstanceStructType { - self.to_glib_none().0 - } - } -); - -pub trait Instance { - fn parent(&self) -> &T::GlibType; - - fn get_impl(&self) -> &T::ImplType; - - unsafe fn set_impl(&mut self, imp: ptr::NonNull); - - unsafe fn get_class(&self) -> *const ClassStruct; -} - -#[repr(C)] -pub struct InstanceStruct { - _parent: T::GlibType, - _imp: ptr::NonNull, -} - -impl Instance for InstanceStruct { - fn parent(&self) -> &T::GlibType { - &self._parent - } - - fn get_impl(&self) -> &T::ImplType { - unsafe { self._imp.as_ref() } - } - - unsafe fn set_impl(&mut self, imp: ptr::NonNull) { - self._imp = imp; - } - - unsafe fn get_class(&self) -> *const ClassStruct { - *(self as *const _ as *const *const ClassStruct) - } -} - -#[repr(C)] -pub struct ClassStruct { - pub parent: T::GlibClassType, - pub imp_static: ptr::NonNull>>, - pub parent_class: ptr::NonNull, - pub interfaces_static: *const Vec<(glib_ffi::GType, glib_ffi::gpointer)>, -} - -impl ClassStruct { - pub fn get_parent_class(&self) -> *const T::GlibClassType { - self.parent_class.as_ptr() - } -} - -impl ClassStruct { - pub fn get_interface_static(&self, type_: glib_ffi::GType) -> glib_ffi::gpointer { - unsafe { - if self.interfaces_static.is_null() { - return ptr::null_mut(); - } - - for &(t, p) in &(*self.interfaces_static) { - if t == type_ { - return p; - } - } - - ptr::null_mut() - } - } -} - -pub unsafe trait ObjectClass { - fn install_properties(&mut self, properties: &[Property]) { - if properties.is_empty() { - return; - } - - let mut pspecs = Vec::with_capacity(properties.len()); - - pspecs.push(ptr::null_mut()); - - for property in properties { - pspecs.push(property.into()); - } - - unsafe { - gobject_ffi::g_object_class_install_properties( - self as *mut _ as *mut gobject_ffi::GObjectClass, - pspecs.len() as u32, - pspecs.as_mut_ptr(), - ); - } - } - - fn add_signal(&mut self, name: &str, arg_types: &[glib::Type], ret_type: glib::Type) { - let arg_types = arg_types.iter().map(|t| t.to_glib()).collect::>(); - unsafe { - gobject_ffi::g_signal_newv( - name.to_glib_none().0, - *(self as *mut _ as *mut glib_ffi::GType), - gobject_ffi::G_SIGNAL_RUN_LAST, - ptr::null_mut(), - None, - ptr::null_mut(), - None, - ret_type.to_glib(), - arg_types.len() as u32, - arg_types.as_ptr() as *mut _, - ); - } - } - - fn add_signal_with_accumulator( - &mut self, - name: &str, - arg_types: &[glib::Type], - ret_type: glib::Type, - accumulator: F, - ) where - F: Fn(&mut glib::Value, &glib::Value) -> bool + Send + Sync + 'static, - { - let arg_types = arg_types.iter().map(|t| t.to_glib()).collect::>(); - - let accumulator: Box< - Box bool + Send + Sync + 'static>, - > = Box::new(Box::new(accumulator)); - - unsafe extern "C" fn accumulator_trampoline( - _ihint: *mut gobject_ffi::GSignalInvocationHint, - return_accu: *mut gobject_ffi::GValue, - handler_return: *const gobject_ffi::GValue, - data: glib_ffi::gpointer, - ) -> glib_ffi::gboolean { - callback_guard!(); - let accumulator: &&(Fn(&mut glib::Value, &glib::Value) -> bool - + Send - + Sync - + 'static) = mem::transmute(data); - accumulator( - &mut *(return_accu as *mut glib::Value), - &*(handler_return as *const glib::Value), - ).to_glib() - } - - unsafe { - gobject_ffi::g_signal_newv( - name.to_glib_none().0, - *(self as *mut _ as *mut glib_ffi::GType), - gobject_ffi::G_SIGNAL_RUN_LAST, - ptr::null_mut(), - Some(accumulator_trampoline), - Box::into_raw(accumulator) as glib_ffi::gpointer, - None, - ret_type.to_glib(), - arg_types.len() as u32, - arg_types.as_ptr() as *mut _, - ); - } - } - - fn add_action_signal( - &mut self, - name: &str, - arg_types: &[glib::Type], - ret_type: glib::Type, - handler: F, - ) where - F: Fn(&[glib::Value]) -> Option + Send + Sync + 'static, - { - let arg_types = arg_types.iter().map(|t| t.to_glib()).collect::>(); - let handler = glib::Closure::new(handler); - unsafe { - gobject_ffi::g_signal_newv( - name.to_glib_none().0, - *(self as *mut _ as *mut glib_ffi::GType), - gobject_ffi::G_SIGNAL_RUN_LAST | gobject_ffi::G_SIGNAL_ACTION, - handler.to_glib_none().0, - None, - ptr::null_mut(), - None, - ret_type.to_glib(), - arg_types.len() as u32, - arg_types.as_ptr() as *mut _, - ); - } - } -} - -unsafe impl ObjectClass for ClassStruct {} - -unsafe extern "C" fn class_init( - klass: glib_ffi::gpointer, - _klass_data: glib_ffi::gpointer, -) { - callback_guard!(); - { - let gobject_klass = &mut *(klass as *mut gobject_ffi::GObjectClass); - - gobject_klass.finalize = Some(finalize::); - gobject_klass.set_property = Some(set_property::); - gobject_klass.get_property = Some(get_property::); - } - - { - let klass = &mut *(klass as *mut ClassStruct); - let parent_class = gobject_ffi::g_type_class_peek_parent( - klass as *mut _ as glib_ffi::gpointer, - ) as *mut T::GlibClassType; - assert!(!parent_class.is_null()); - klass.parent_class = ptr::NonNull::new_unchecked(parent_class); - T::class_init(&ClassInitToken(()), klass); - } -} - -unsafe extern "C" fn finalize(obj: *mut gobject_ffi::GObject) { - callback_guard!(); - let instance = &mut *(obj as *mut T::InstanceStructType); - - drop(Box::from_raw(instance.get_impl() as *const _ as *mut T::ImplType)); - instance.set_impl(ptr::NonNull::dangling()); - - let klass = *(obj as *const glib_ffi::gpointer); - let parent_klass = gobject_ffi::g_type_class_peek_parent(klass); - let parent_klass = - &*(gobject_ffi::g_type_class_peek_parent(parent_klass) as *const gobject_ffi::GObjectClass); - parent_klass.finalize.map(|f| f(obj)); -} - -unsafe extern "C" fn get_property( - obj: *mut gobject_ffi::GObject, - id: u32, - value: *mut gobject_ffi::GValue, - _pspec: *mut gobject_ffi::GParamSpec, -) { - callback_guard!(); - floating_reference_guard!(obj); - match T::get_property(&from_glib_borrow(obj as *mut T::InstanceStructType), id - 1) { - Ok(v) => { - gobject_ffi::g_value_unset(value); - ptr::write(value, ptr::read(v.to_glib_none().0)); - mem::forget(v); - } - Err(()) => eprintln!("Failed to get property"), - } -} - -unsafe extern "C" fn set_property( - obj: *mut gobject_ffi::GObject, - id: u32, - value: *mut gobject_ffi::GValue, - _pspec: *mut gobject_ffi::GParamSpec, -) { - callback_guard!(); - floating_reference_guard!(obj); - T::set_property( - &from_glib_borrow(obj as *mut T::InstanceStructType), - id - 1, - &*(value as *mut glib::Value), - ); -} - -static mut TYPES: *mut Mutex> = 0 as *mut _; - -pub unsafe fn get_type() -> glib_ffi::GType { - use std::sync::{Once, ONCE_INIT}; - - static ONCE: Once = ONCE_INIT; - - ONCE.call_once(|| { - TYPES = Box::into_raw(Box::new(Mutex::new(BTreeMap::new()))); - }); - - let mut types = (*TYPES).lock().unwrap(); - types - .entry(TypeId::of::()) - .or_insert_with(|| { - let type_info = gobject_ffi::GTypeInfo { - class_size: mem::size_of::>() as u16, - base_init: None, - base_finalize: None, - class_init: Some(class_init::), - class_finalize: None, - class_data: ptr::null_mut(), - instance_size: mem::size_of::() as u16, - n_preallocs: 0, - instance_init: None, - value_table: ptr::null(), - }; - - let type_name = { - let mut idx = 0; - - loop { - let type_name = CString::new(format!("{}-{}", T::NAME, idx)).unwrap(); - if gobject_ffi::g_type_from_name(type_name.as_ptr()) - == gobject_ffi::G_TYPE_INVALID - { - break type_name; - } - idx += 1; - } - }; - - from_glib(gobject_ffi::g_type_register_static( - T::glib_type().to_glib(), - type_name.as_ptr(), - &type_info, - gobject_ffi::G_TYPE_FLAG_ABSTRACT, - )) - }) - .to_glib() -} - -unsafe extern "C" fn sub_class_init( - klass: glib_ffi::gpointer, - klass_data: glib_ffi::gpointer, -) { - callback_guard!(); - { - let gobject_klass = &mut *(klass as *mut gobject_ffi::GObjectClass); - - gobject_klass.set_property = Some(sub_set_property::); - gobject_klass.get_property = Some(sub_get_property::); - } - { - assert!(!klass_data.is_null()); - let klass = &mut *(klass as *mut ClassStruct); - let imp_static = klass_data as *mut Box>; - klass.imp_static = ptr::NonNull::new_unchecked(imp_static); - klass.interfaces_static = Box::into_raw(Box::new(Vec::new())); - - (*imp_static).class_init(klass); - } -} - -unsafe extern "C" fn sub_get_property( - obj: *mut gobject_ffi::GObject, - id: u32, - value: *mut gobject_ffi::GValue, - _pspec: *mut gobject_ffi::GParamSpec, -) { - callback_guard!(); - floating_reference_guard!(obj); - let instance = &*(obj as *mut T::InstanceStructType); - let imp = instance.get_impl(); - - match imp.get_property(&from_glib_borrow(obj), id - 1) { - Ok(v) => { - gobject_ffi::g_value_unset(value); - ptr::write(value, ptr::read(v.to_glib_none().0)); - mem::forget(v); - } - Err(()) => eprintln!("Failed to get property"), - } -} - -unsafe extern "C" fn sub_set_property( - obj: *mut gobject_ffi::GObject, - id: u32, - value: *mut gobject_ffi::GValue, - _pspec: *mut gobject_ffi::GParamSpec, -) { - callback_guard!(); - floating_reference_guard!(obj); - let instance = &*(obj as *mut T::InstanceStructType); - let imp = instance.get_impl(); - imp.set_property( - &from_glib_borrow(obj), - id - 1, - &*(value as *mut glib::Value), - ); -} - -unsafe extern "C" fn sub_init( - obj: *mut gobject_ffi::GTypeInstance, - _klass: glib_ffi::gpointer, -) { - callback_guard!(); - floating_reference_guard!(obj); - let instance = &mut *(obj as *mut T::InstanceStructType); - let klass = &**(obj as *const *const ClassStruct); - let rs_instance: T = from_glib_borrow(obj as *mut T::InstanceStructType); - - let imp = klass.imp_static.as_ref().new(&rs_instance); - instance.set_impl(ptr::NonNull::new_unchecked(Box::into_raw(Box::new(imp)))); -} - -pub fn register_type>(imp: I) -> glib::Type { - unsafe { - let parent_type = get_type::(); - let type_name = format!("{}-{}", T::NAME, imp.get_name()); - - let imp: Box> = Box::new(imp); - let imp_ptr = Box::into_raw(Box::new(imp)); - - let type_info = gobject_ffi::GTypeInfo { - class_size: mem::size_of::>() as u16, - base_init: None, - base_finalize: None, - class_init: Some(sub_class_init::), - class_finalize: None, - class_data: imp_ptr as glib_ffi::gpointer, - instance_size: mem::size_of::() as u16, - n_preallocs: 0, - instance_init: Some(sub_init::), - value_table: ptr::null(), - }; - - let type_ = from_glib(gobject_ffi::g_type_register_static( - parent_type, - type_name.to_glib_none().0, - &type_info, - 0, - )); - - (*imp_ptr).type_init(&TypeInitToken(()), type_); - - type_ - } -} diff --git a/gobject-subclass/src/properties.rs b/gobject-subclass/src/properties.rs deleted file mode 100644 index 81cad248..00000000 --- a/gobject-subclass/src/properties.rs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (C) 2017 Sebastian Dröge -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use gobject_ffi; - -use glib; -use glib::translate::*; - -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -pub enum PropertyMutability { - Readable, - Writable, - ReadWrite, -} - -impl Into for PropertyMutability { - fn into(self) -> gobject_ffi::GParamFlags { - use self::PropertyMutability::*; - - match self { - Readable => gobject_ffi::G_PARAM_READABLE, - Writable => gobject_ffi::G_PARAM_WRITABLE, - ReadWrite => gobject_ffi::G_PARAM_READWRITE, - } - } -} - -#[derive(Debug, Clone)] -pub enum Property<'a> { - Boolean(&'a str, &'a str, &'a str, bool, PropertyMutability), - Int( - &'a str, - &'a str, - &'a str, - (i32, i32), - i32, - PropertyMutability, - ), - Int64( - &'a str, - &'a str, - &'a str, - (i64, i64), - i64, - PropertyMutability, - ), - UInt( - &'a str, - &'a str, - &'a str, - (u32, u32), - u32, - PropertyMutability, - ), - UInt64( - &'a str, - &'a str, - &'a str, - (u64, u64), - u64, - PropertyMutability, - ), - Float( - &'a str, - &'a str, - &'a str, - (f32, f32), - f32, - PropertyMutability, - ), - Double( - &'a str, - &'a str, - &'a str, - (f64, f64), - f64, - PropertyMutability, - ), - String( - &'a str, - &'a str, - &'a str, - Option<&'a str>, - PropertyMutability, - ), - Boxed( - &'a str, - &'a str, - &'a str, - fn() -> glib::Type, - PropertyMutability, - ), - Object( - &'a str, - &'a str, - &'a str, - fn() -> glib::Type, - PropertyMutability, - ), -} - -impl<'a> Into<*mut gobject_ffi::GParamSpec> for &'a Property<'a> { - fn into(self) -> *mut gobject_ffi::GParamSpec { - unsafe { - match *self { - Property::Boolean(name, nick, description, default, mutability) => { - gobject_ffi::g_param_spec_boolean( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - default.to_glib(), - mutability.into(), - ) - } - Property::Int(name, nick, description, (min, max), default, mutability) => { - gobject_ffi::g_param_spec_int( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - min, - max, - default, - mutability.into(), - ) - } - Property::Int64(name, nick, description, (min, max), default, mutability) => { - gobject_ffi::g_param_spec_int64( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - min, - max, - default, - mutability.into(), - ) - } - Property::UInt(name, nick, description, (min, max), default, mutability) => { - gobject_ffi::g_param_spec_uint( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - min, - max, - default, - mutability.into(), - ) - } - Property::UInt64(name, nick, description, (min, max), default, mutability) => { - gobject_ffi::g_param_spec_uint64( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - min, - max, - default, - mutability.into(), - ) - } - Property::Float(name, nick, description, (min, max), default, mutability) => { - gobject_ffi::g_param_spec_float( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - min, - max, - default, - mutability.into(), - ) - } - Property::Double(name, nick, description, (min, max), default, mutability) => { - gobject_ffi::g_param_spec_double( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - min, - max, - default, - mutability.into(), - ) - } - Property::String(name, nick, description, default, mutability) => { - gobject_ffi::g_param_spec_string( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - default.to_glib_none().0, - mutability.into(), - ) - } - Property::Boxed(name, nick, description, get_type, mutability) => { - gobject_ffi::g_param_spec_boxed( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - get_type().to_glib(), - mutability.into(), - ) - } - Property::Object(name, nick, description, get_type, mutability) => { - gobject_ffi::g_param_spec_object( - name.to_glib_none().0, - nick.to_glib_none().0, - description.to_glib_none().0, - get_type().to_glib(), - mutability.into(), - ) - } - } - } - } -} diff --git a/gst-plugin-audiofx/Cargo.toml b/gst-plugin-audiofx/Cargo.toml index f6338cad..ec3b9599 100644 --- a/gst-plugin-audiofx/Cargo.toml +++ b/gst-plugin-audiofx/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gst-plugin-audiofx" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] repository = "https://github.com/sdroege/gst-plugin-rs" license = "MIT/Apache-2.0" [dependencies] -gobject-subclass = { path="../gobject-subclass" } +gobject-subclass = { git = "https://github.com/sdroege/gobject-subclass" } gst-plugin = { path="../gst-plugin" } glib = { git = "https://github.com/gtk-rs/glib" } gstreamer = { git = "https://github.com/sdroege/gstreamer-rs" } diff --git a/gst-plugin-file/Cargo.toml b/gst-plugin-file/Cargo.toml index ed479264..f4fb418f 100644 --- a/gst-plugin-file/Cargo.toml +++ b/gst-plugin-file/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gst-plugin-file" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] repository = "https://github.com/sdroege/gst-plugin-rs" license = "MIT/Apache-2.0" diff --git a/gst-plugin-flv/Cargo.toml b/gst-plugin-flv/Cargo.toml index cb9b4974..7715796e 100644 --- a/gst-plugin-flv/Cargo.toml +++ b/gst-plugin-flv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gst-plugin-flv" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] repository = "https://github.com/sdroege/gst-plugin-rs" license = "MIT/Apache-2.0" diff --git a/gst-plugin-http/Cargo.toml b/gst-plugin-http/Cargo.toml index b742622a..1f2c354e 100644 --- a/gst-plugin-http/Cargo.toml +++ b/gst-plugin-http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gst-plugin-http" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] repository = "https://github.com/sdroege/gst-plugin-rs" license = "MIT/Apache-2.0" diff --git a/gst-plugin-simple/Cargo.toml b/gst-plugin-simple/Cargo.toml index 6983197f..2117f294 100644 --- a/gst-plugin-simple/Cargo.toml +++ b/gst-plugin-simple/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gst-plugin-simple" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] repository = "https://github.com/sdroege/gst-plugin-rs" license = "MIT/Apache-2.0" @@ -8,7 +8,7 @@ license = "MIT/Apache-2.0" [dependencies] url = "1.1" glib = { git = "https://github.com/gtk-rs/glib" } -gobject-subclass = { path="../gobject-subclass" } +gobject-subclass = { git = "https://github.com/sdroege/gobject-subclass" } gst-plugin = { path="../gst-plugin" } gstreamer = { git = "https://github.com/sdroege/gstreamer-rs" } gstreamer-base = { git = "https://github.com/sdroege/gstreamer-rs" } diff --git a/gst-plugin-togglerecord/Cargo.toml b/gst-plugin-togglerecord/Cargo.toml index 4165a1da..ed46e3b3 100644 --- a/gst-plugin-togglerecord/Cargo.toml +++ b/gst-plugin-togglerecord/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gst-plugin-togglerecord" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] license = "LGPL-2.1+" @@ -8,7 +8,7 @@ license = "LGPL-2.1+" glib = { git = "https://github.com/gtk-rs/glib" } gstreamer = { git = "https://github.com/sdroege/gstreamer-rs" } gstreamer-video = { git = "https://github.com/sdroege/gstreamer-rs" } -gobject-subclass = { path="../gobject-subclass" } +gobject-subclass = { git = "https://github.com/sdroege/gobject-subclass" } gst-plugin = { path = "../gst-plugin" } gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = true } gio = { git = "https://github.com/gtk-rs/gio", optional = true } diff --git a/gst-plugin-tutorial/Cargo.toml b/gst-plugin-tutorial/Cargo.toml index 2f6784ca..5c6c4e84 100644 --- a/gst-plugin-tutorial/Cargo.toml +++ b/gst-plugin-tutorial/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gst-plugin-tutorial" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] repository = "https://github.com/sdroege/gst-plugin-rs" license = "MIT/Apache-2.0" [dependencies] -gobject-subclass = { path="../gobject-subclass" } +gobject-subclass = { git = "https://github.com/sdroege/gobject-subclass" } gst-plugin = { path="../gst-plugin" } glib = { git = "https://github.com/gtk-rs/glib" } gstreamer = { git = "https://github.com/sdroege/gstreamer-rs" } diff --git a/gst-plugin/Cargo.toml b/gst-plugin/Cargo.toml index 45172074..08884e40 100644 --- a/gst-plugin/Cargo.toml +++ b/gst-plugin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gst-plugin" -version = "0.1.0" +version = "0.3.0" authors = ["Sebastian Dröge "] categories = ["multimedia"] description = "Infrastructure for writing GStreamer plugins in Rust" @@ -15,7 +15,7 @@ keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"] libc = "0.2" lazy_static = "1.0" byteorder = "1.0" -gobject-subclass = { path="../gobject-subclass" } +gobject-subclass = { git = "https://github.com/sdroege/gobject-subclass" } glib-sys = { git = "https://github.com/gtk-rs/sys" } gobject-sys = { git = "https://github.com/gtk-rs/sys" } gstreamer-sys = { git = "https://github.com/sdroege/gstreamer-sys" }