From 12ee7358e3611441c79eef58505b847035bf0577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 18 Dec 2017 09:52:22 +0200 Subject: [PATCH] Add bindings for TypeFindFactory --- Gir_Gst.toml | 6 +++ gstreamer/src/auto/enums.rs | 69 +++++++++++++++++++++++++ gstreamer/src/auto/mod.rs | 4 ++ gstreamer/src/auto/type_find_factory.rs | 54 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 gstreamer/src/auto/type_find_factory.rs diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 8cc03ee95..c0e36571f 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -70,6 +70,7 @@ generate = [ "Gst.TaskState", "Gst.PluginDependencyFlags", "Gst.DateTime", + "Gst.TypeFindProbability", ] manual = [ @@ -366,6 +367,11 @@ name = "Gst.ElementFactory" status = "generate" trait = false +[[object]] +name = "Gst.TypeFindFactory" +status = "generate" +trait = false + [[object]] name = "Gst.DeviceProviderFactory" status = "generate" diff --git a/gstreamer/src/auto/enums.rs b/gstreamer/src/auto/enums.rs index e1413857f..860726832 100644 --- a/gstreamer/src/auto/enums.rs +++ b/gstreamer/src/auto/enums.rs @@ -2597,6 +2597,75 @@ impl SetValue for TocScope { } } +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +pub enum TypeFindProbability { + None, + Minimum, + Possible, + Likely, + NearlyCertain, + Maximum, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for TypeFindProbability { + type GlibType = ffi::GstTypeFindProbability; + + fn to_glib(&self) -> ffi::GstTypeFindProbability { + match *self { + TypeFindProbability::None => ffi::GST_TYPE_FIND_NONE, + TypeFindProbability::Minimum => ffi::GST_TYPE_FIND_MINIMUM, + TypeFindProbability::Possible => ffi::GST_TYPE_FIND_POSSIBLE, + TypeFindProbability::Likely => ffi::GST_TYPE_FIND_LIKELY, + TypeFindProbability::NearlyCertain => ffi::GST_TYPE_FIND_NEARLY_CERTAIN, + TypeFindProbability::Maximum => ffi::GST_TYPE_FIND_MAXIMUM, + TypeFindProbability::__Unknown(value) => value + } + } +} + +#[doc(hidden)] +impl FromGlib for TypeFindProbability { + fn from_glib(value: ffi::GstTypeFindProbability) -> Self { + skip_assert_initialized!(); + match value { + 0 => TypeFindProbability::None, + 1 => TypeFindProbability::Minimum, + 50 => TypeFindProbability::Possible, + 80 => TypeFindProbability::Likely, + 99 => TypeFindProbability::NearlyCertain, + 100 => TypeFindProbability::Maximum, + value => TypeFindProbability::__Unknown(value), + } + } +} + +impl StaticType for TypeFindProbability { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_type_find_probability_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for TypeFindProbability { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for TypeFindProbability { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for TypeFindProbability { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum URIError { UnsupportedProtocol, diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index 38905c3ce..b63b2843f 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -97,6 +97,9 @@ mod toc_setter; pub use self::toc_setter::TocSetter; pub use self::toc_setter::TocSetterExt; +mod type_find_factory; +pub use self::type_find_factory::TypeFindFactory; + mod u_r_i_handler; pub use self::u_r_i_handler::URIHandler; pub use self::u_r_i_handler::URIHandlerExt; @@ -139,6 +142,7 @@ pub use self::enums::TaskState; pub use self::enums::TocEntryType; pub use self::enums::TocLoopType; pub use self::enums::TocScope; +pub use self::enums::TypeFindProbability; pub use self::enums::URIError; pub use self::enums::URIType; diff --git a/gstreamer/src/auto/type_find_factory.rs b/gstreamer/src/auto/type_find_factory.rs new file mode 100644 index 000000000..77a4570cd --- /dev/null +++ b/gstreamer/src/auto/type_find_factory.rs @@ -0,0 +1,54 @@ +// This file was generated by gir (d50d839) from gir-files (???) +// DO NOT EDIT + +use Caps; +use Object; +use PluginFeature; +use ffi; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct TypeFindFactory(Object): PluginFeature, Object; + + match fn { + get_type => || ffi::gst_type_find_factory_get_type(), + } +} + +impl TypeFindFactory { + //pub fn call_function(&self, find: /*Ignored*/&mut TypeFind) { + // unsafe { TODO: call ffi::gst_type_find_factory_call_function() } + //} + + pub fn get_caps(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_type_find_factory_get_caps(self.to_glib_none().0)) + } + } + + pub fn get_extensions(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_type_find_factory_get_extensions(self.to_glib_none().0)) + } + } + + pub fn has_function(&self) -> bool { + unsafe { + from_glib(ffi::gst_type_find_factory_has_function(self.to_glib_none().0)) + } + } + + pub fn get_list() -> Vec { + assert_initialized_main_thread!(); + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::gst_type_find_factory_get_list()) + } + } +} + +unsafe impl Send for TypeFindFactory {} +unsafe impl Sync for TypeFindFactory {}