Add bindings for TypeFindFactory

This commit is contained in:
Sebastian Dröge 2017-12-18 09:52:22 +02:00
parent 5dd89d01e2
commit 12ee7358e3
4 changed files with 133 additions and 0 deletions

View file

@ -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"

View file

@ -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<ffi::GstTypeFindProbability> 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<Self> {
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,

View file

@ -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;

View file

@ -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<ffi::GstTypeFindFactory, ffi::GstTypeFindFactoryClass>): 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<Caps> {
unsafe {
from_glib_none(ffi::gst_type_find_factory_get_caps(self.to_glib_none().0))
}
}
pub fn get_extensions(&self) -> Vec<String> {
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<TypeFindFactory> {
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 {}