Commit c0707bed authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add initial caps bindings

parent 944c71f9
...@@ -24,6 +24,7 @@ generate = [ ...@@ -24,6 +24,7 @@ generate = [
"Gst.FlowReturn", "Gst.FlowReturn",
"Gst.PadDirection", "Gst.PadDirection",
"Gst.PadTemplate", "Gst.PadTemplate",
"Gst.PadPresence",
"Gst.URIHandler", "Gst.URIHandler",
"Gst.URIType", "Gst.URIType",
"Gst.ElementFactoryListType", "Gst.ElementFactoryListType",
...@@ -100,6 +101,11 @@ trait = false ...@@ -100,6 +101,11 @@ trait = false
# Uses enum as flags # Uses enum as flags
ignore = true ignore = true
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]] [[object]]
name = "Gst.Clock" name = "Gst.Clock"
status = "generate" status = "generate"
...@@ -131,11 +137,21 @@ status = "generate" ...@@ -131,11 +137,21 @@ status = "generate"
[object.function.return] [object.function.return]
bool_return_is_error = "Failed to link elements" bool_return_is_error = "Failed to link elements"
[[object.function]]
name = "link_filtered"
[object.function.return]
bool_return_is_error = "Failed to link elements"
[[object.function]] [[object.function]]
name = "link_pads" name = "link_pads"
[object.function.return] [object.function.return]
bool_return_is_error = "Failed to link pads" bool_return_is_error = "Failed to link pads"
[[object.function]]
name = "link_pads_filtered"
[object.function.return]
bool_return_is_error = "Failed to link pads"
[[object.function]] [[object.function]]
name = "seek" name = "seek"
[object.function.return] [object.function.return]
...@@ -164,14 +180,14 @@ trait = false ...@@ -164,14 +180,14 @@ trait = false
[[object]] [[object]]
name = "Gst.Device" name = "Gst.Device"
status = "generate" status = "generate"
[[object.function]] [[object.property]]
name = "get_properties" name = "properties"
# Structure is not a GObject # Structure is not a GObject
ignore = true ignore = true
[[object.property]] [[object.property]]
name = "properties" name = "caps"
# Structure is not a GObject # Caps is not a GObject
ignore = true ignore = true
...@@ -231,6 +247,11 @@ status = "generate" ...@@ -231,6 +247,11 @@ status = "generate"
[object.function.return] [object.function.return]
bool_return_is_error = "Failed to activate pad" bool_return_is_error = "Failed to activate pad"
[[object.property]]
name = "caps"
# Caps is not a GObject
ignore = true
[[object]] [[object]]
name = "Gst.Plugin" name = "Gst.Plugin"
status = "generate" status = "generate"
......
...@@ -4,10 +4,6 @@ use gst::ObjectExt as GstObjectExt; ...@@ -4,10 +4,6 @@ use gst::ObjectExt as GstObjectExt;
extern crate glib; extern crate glib;
use glib::ObjectExt; use glib::ObjectExt;
use glib::translate::{from_glib_none, ToGlibPtr};
extern crate gstreamer_sys as gst_ffi;
extern crate gobject_sys as gobject_ffi;
use std::env; use std::env;
use std::u64; use std::u64;
...@@ -36,12 +32,10 @@ fn main() { ...@@ -36,12 +32,10 @@ fn main() {
decodebin.connect_pad_added(move |_, src_pad| { decodebin.connect_pad_added(move |_, src_pad| {
let ref pipeline = pipeline_clone; let ref pipeline = pipeline_clone;
// FIXME: Needs caps/structure bindings let (is_audio, is_video) = {
let (is_audio, is_video) = unsafe { let caps = src_pad.get_current_caps().unwrap();
let caps = gst_ffi::gst_pad_get_current_caps(src_pad.to_glib_none().0); let structure = caps.get_structure(0).unwrap();
let structure = gst_ffi::gst_caps_get_structure(caps, 0); let name = structure.get_name();
let name: String = from_glib_none(gst_ffi::gst_structure_get_name(structure));
(name.starts_with("audio/"), name.starts_with("video/")) (name.starts_with("audio/"), name.starts_with("video/"))
}; };
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
pub type ClockTime = u64; pub type ClockTime = u64;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Element; use Element;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps;
use Element; use Element;
use Object; use Object;
use Structure;
use ffi; use ffi;
use glib; use glib;
use glib::Value; use glib::Value;
...@@ -29,20 +31,20 @@ unsafe impl Sync for Device {} ...@@ -29,20 +31,20 @@ unsafe impl Sync for Device {}
pub trait DeviceExt { pub trait DeviceExt {
fn create_element<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element>; fn create_element<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element>;
//fn get_caps(&self) -> /*Ignored*/Option<Caps>; fn get_caps(&self) -> Option<Caps>;
fn get_device_class(&self) -> Option<String>; fn get_device_class(&self) -> Option<String>;
fn get_display_name(&self) -> Option<String>; fn get_display_name(&self) -> Option<String>;
fn get_properties(&self) -> Option<Structure>;
fn has_classes(&self, classes: &str) -> bool; fn has_classes(&self, classes: &str) -> bool;
fn has_classesv(&self, classes: &[&str]) -> bool; fn has_classesv(&self, classes: &[&str]) -> bool;
fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool; fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool;
//fn get_property_caps(&self) -> /*Ignored*/Option<Caps>;
fn get_property_device_class(&self) -> Option<String>; fn get_property_device_class(&self) -> Option<String>;
fn get_property_display_name(&self) -> Option<String>; fn get_property_display_name(&self) -> Option<String>;
...@@ -59,9 +61,11 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O { ...@@ -59,9 +61,11 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
} }
} }
//fn get_caps(&self) -> /*Ignored*/Option<Caps> { fn get_caps(&self) -> Option<Caps> {
// unsafe { TODO: call ffi::gst_device_get_caps() } unsafe {
//} from_glib_full(ffi::gst_device_get_caps(self.to_glib_none().0))
}
}
fn get_device_class(&self) -> Option<String> { fn get_device_class(&self) -> Option<String> {
unsafe { unsafe {
...@@ -75,6 +79,12 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O { ...@@ -75,6 +79,12 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
} }
} }
fn get_properties(&self) -> Option<Structure> {
unsafe {
from_glib_full(ffi::gst_device_get_properties(self.to_glib_none().0))
}
}
fn has_classes(&self, classes: &str) -> bool { fn has_classes(&self, classes: &str) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_device_has_classes(self.to_glib_none().0, classes.to_glib_none().0)) from_glib(ffi::gst_device_has_classes(self.to_glib_none().0, classes.to_glib_none().0))
...@@ -93,14 +103,6 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O { ...@@ -93,14 +103,6 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
} }
} }
//fn get_property_caps(&self) -> /*Ignored*/Option<Caps> {
// let mut value = Value::from(None::<&/*Ignored*/Caps>);
// unsafe {
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "caps".to_glib_none().0, value.to_glib_none_mut().0);
// }
// value.get()
//}
fn get_property_device_class(&self) -> Option<String> { fn get_property_device_class(&self) -> Option<String> {
let mut value = Value::from(None::<&str>); let mut value = Value::from(None::<&str>);
unsafe { unsafe {
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;
use Caps;
use Device; use Device;
use Object; use Object;
use ffi; use ffi;
...@@ -32,7 +33,7 @@ unsafe impl Send for DeviceMonitor {} ...@@ -32,7 +33,7 @@ unsafe impl Send for DeviceMonitor {}
unsafe impl Sync for DeviceMonitor {} unsafe impl Sync for DeviceMonitor {}
pub trait DeviceMonitorExt { pub trait DeviceMonitorExt {
//fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, classes: P, caps: Q) -> u32; fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(&self, classes: P, caps: Q) -> u32;
fn get_bus(&self) -> Option<Bus>; fn get_bus(&self) -> Option<Bus>;
...@@ -56,9 +57,15 @@ pub trait DeviceMonitorExt { ...@@ -56,9 +57,15 @@ pub trait DeviceMonitorExt {
} }
impl<O: IsA<DeviceMonitor> + IsA<glib::object::Object>> DeviceMonitorExt for O { impl<O: IsA<DeviceMonitor> + IsA<glib::object::Object>> DeviceMonitorExt for O {
//fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, classes: P, caps: Q) -> u32 { fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(&self, classes: P, caps: Q) -> u32 {
// unsafe { TODO: call ffi::gst_device_monitor_add_filter() } let classes = classes.into();
//} let classes = classes.to_glib_none();
let caps = caps.into();
let caps = caps.to_glib_none();
unsafe {
ffi::gst_device_monitor_add_filter(self.to_glib_none().0, classes.0, caps.0)
}
}
fn get_bus(&self) -> Option<Bus> { fn get_bus(&self) -> Option<Bus> {
unsafe { unsafe {
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use DeviceProvider; use DeviceProvider;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;
use Caps;
use Clock; use Clock;
use ClockTime; use ClockTime;
use ElementFactory; use ElementFactory;
...@@ -105,7 +106,7 @@ pub trait ElementExt { ...@@ -105,7 +106,7 @@ pub trait ElementExt {
fn get_clock(&self) -> Option<Clock>; fn get_clock(&self) -> Option<Clock>;
//fn get_compatible_pad<'a, P: IsA<Pad>, Q: Into<Option<&'a /*Ignored*/Caps>>>(&self, pad: &P, caps: Q) -> Option<Pad>; fn get_compatible_pad<'a, P: IsA<Pad>, Q: Into<Option<&'a Caps>>>(&self, pad: &P, caps: Q) -> Option<Pad>;
fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option<PadTemplate>; fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option<PadTemplate>;
...@@ -135,13 +136,13 @@ pub trait ElementExt { ...@@ -135,13 +136,13 @@ pub trait ElementExt {
fn link<P: IsA<Element>>(&self, dest: &P) -> Result<(), glib::error::BoolError>; fn link<P: IsA<Element>>(&self, dest: &P) -> Result<(), glib::error::BoolError>;
//fn link_filtered<'a, P: IsA<Element>, Q: Into<Option<&'a /*Ignored*/Caps>>>(&self, dest: &P, filter: Q) -> bool; fn link_filtered<'a, P: IsA<Element>, Q: Into<Option<&'a Caps>>>(&self, dest: &P, filter: Q) -> Result<(), glib::error::BoolError>;
//fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool; //fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool;
fn link_pads<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> Result<(), glib::error::BoolError>; fn link_pads<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> Result<(), glib::error::BoolError>;
//fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c /*Ignored*/Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> bool; fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> Result<(), glib::error::BoolError>;
//fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool; //fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool;
...@@ -173,7 +174,7 @@ pub trait ElementExt { ...@@ -173,7 +174,7 @@ pub trait ElementExt {
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
fn remove_property_notify_watch(&self, watch_id: libc::c_ulong); fn remove_property_notify_watch(&self, watch_id: libc::c_ulong);
//fn request_pad<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option<Pad>; fn request_pad<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option<Pad>;
fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> Result<(), glib::error::BoolError>; fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> Result<(), glib::error::BoolError>;
...@@ -282,9 +283,13 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O { ...@@ -282,9 +283,13 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
//fn get_compatible_pad<'a, P: IsA<Pad>, Q: Into<Option<&'a /*Ignored*/Caps>>>(&self, pad: &P, caps: Q) -> Option<Pad> { fn get_compatible_pad<'a, P: IsA<Pad>, Q: Into<Option<&'a Caps>>>(&self, pad: &P, caps: Q) -> Option<Pad> {
// unsafe { TODO: call ffi::gst_element_get_compatible_pad() } let caps = caps.into();
//} let caps = caps.to_glib_none();
unsafe {
from_glib_full(ffi::gst_element_get_compatible_pad(self.to_glib_none().0, pad.to_glib_none().0, caps.0))
}
}
fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option<PadTemplate> { fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option<PadTemplate> {
unsafe { unsafe {
...@@ -361,9 +366,13 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O { ...@@ -361,9 +366,13 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
//fn link_filtered<'a, P: IsA<Element>, Q: Into<Option<&'a /*Ignored*/Caps>>>(&self, dest: &P, filter: Q) -> bool { fn link_filtered<'a, P: IsA<Element>, Q: Into<Option<&'a Caps>>>(&self, dest: &P, filter: Q) -> Result<(), glib::error::BoolError> {
// unsafe { TODO: call ffi::gst_element_link_filtered() } let filter = filter.into();
//} let filter = filter.to_glib_none();
unsafe {
glib::error::BoolError::from_glib(ffi::gst_element_link_filtered(self.to_glib_none().0, dest.to_glib_none().0, filter.0), "Failed to link elements")
}
}
//fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool { //fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
// unsafe { TODO: call ffi::gst_element_link_many() } // unsafe { TODO: call ffi::gst_element_link_many() }
...@@ -379,9 +388,17 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O { ...@@ -379,9 +388,17 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
//fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c /*Ignored*/Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> bool { fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> Result<(), glib::error::BoolError> {
// unsafe { TODO: call ffi::gst_element_link_pads_filtered() } let srcpadname = srcpadname.into();
//} let srcpadname = srcpadname.to_glib_none();
let destpadname = destpadname.into();
let destpadname = destpadname.to_glib_none();
let filter = filter.into();
let filter = filter.to_glib_none();
unsafe {
glib::error::BoolError::from_glib(ffi::gst_element_link_pads_filtered(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0, filter.0), "Failed to link pads")
}
}
//fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool { //fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool {
// unsafe { TODO: call ffi::gst_element_link_pads_full() } // unsafe { TODO: call ffi::gst_element_link_pads_full() }
...@@ -467,9 +484,15 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O { ...@@ -467,9 +484,15 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
//fn request_pad<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option<Pad> { fn request_pad<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option<Pad> {
// unsafe { TODO: call ffi::gst_element_request_pad() } let name = name.into();
//} let name = name.to_glib_none();
let caps = caps.into();
let caps = caps.to_glib_none();
unsafe {
from_glib_full(ffi::gst_element_request_pad(self.to_glib_none().0, templ.to_glib_none().0, name.0, caps.0))
}
}
fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> Result<(), glib::error::BoolError> { fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps;
use Element; use Element;
use ElementFactoryListType; use ElementFactoryListType;
use Object; use Object;
use PadDirection;
use URIType; use URIType;
use ffi; use ffi;
use glib; use glib;
...@@ -18,21 +20,29 @@ glib_wrapper! { ...@@ -18,21 +20,29 @@ glib_wrapper! {
} }
impl ElementFactory { impl ElementFactory {
//pub fn can_sink_all_caps(&self, caps: /*Ignored*/&Caps) -> bool { pub fn can_sink_all_caps(&self, caps: &Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_sink_all_caps() } unsafe {
//} from_glib(ffi::gst_element_factory_can_sink_all_caps(self.to_glib_none().0, caps.to_glib_none().0))
}
}
//pub fn can_sink_any_caps(&self, caps: /*Ignored*/&Caps) -> bool { pub fn can_sink_any_caps(&self, caps: &Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_sink_any_caps() } unsafe {
//} from_glib(ffi::gst_element_factory_can_sink_any_caps(self.to_glib_none().0, caps.to_glib_none().0))
}
}
//pub fn can_src_all_caps(&self, caps: /*Ignored*/&Caps) -> bool { pub fn can_src_all_caps(&self, caps: &Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_src_all_caps() } unsafe {
//} from_glib(ffi::gst_element_factory_can_src_all_caps(self.to_glib_none().0, caps.to_glib_none().0))
}
}
//pub fn can_src_any_caps(&self, caps: /*Ignored*/&Caps) -> bool { pub fn can_src_any_caps(&self, caps: &Caps) -> bool {
// unsafe { TODO: call ffi::gst_element_factory_can_src_any_caps() } unsafe {
//} from_glib(ffi::gst_element_factory_can_src_any_caps(self.to_glib_none().0, caps.to_glib_none().0))
}
}
pub fn create<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element> { pub fn create<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element> {
let name = name.into(); let name = name.into();
...@@ -101,9 +111,12 @@ impl ElementFactory { ...@@ -101,9 +111,12 @@ impl ElementFactory {
} }
} }
//pub fn list_filter(list: &[ElementFactory], caps: /*Ignored*/&Caps, direction: PadDirection, subsetonly: bool) -> Vec<ElementFactory> { pub fn list_filter(list: &[ElementFactory], caps: &Caps, direction: PadDirection, subsetonly: bool) -> Vec<ElementFactory> {
// unsafe { TODO: call ffi::gst_element_factory_list_filter() } assert_initialized_main_thread!();
//} unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_list_filter(list.to_glib_none().0, caps.to_glib_none().0, direction.to_glib(), subsetonly.to_glib()))
}
}
//pub fn list_get_elements(type_: ElementFactoryListType, minrank: /*Ignored*/Rank) -> Vec<ElementFactory> { //pub fn list_get_elements(type_: ElementFactoryListType, minrank: /*Ignored*/Rank) -> Vec<ElementFactory> {
// unsafe { TODO: call ffi::gst_element_factory_list_get_elements() } // unsafe { TODO: call ffi::gst_element_factory_list_get_elements() }
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;
...@@ -419,6 +419,42 @@ impl FromGlib<ffi::GstPadLinkReturn> for PadLinkReturn { ...@@ -419,6 +419,42 @@ impl FromGlib<ffi::GstPadLinkReturn> for PadLinkReturn {
} }
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum PadPresence {
Always,
Sometimes,
Request,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for PadPresence {
type GlibType = ffi::GstPadPresence;
fn to_glib(&self) -> ffi::GstPadPresence {
match *self {
PadPresence::Always => ffi::GST_PAD_ALWAYS,
PadPresence::Sometimes => ffi::GST_PAD_SOMETIMES,
PadPresence::Request => ffi::GST_PAD_REQUEST,
PadPresence::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstPadPresence> for PadPresence {
fn from_glib(value: ffi::GstPadPresence) -> Self {
skip_assert_initialized!();
match value as i32 {
0 => PadPresence::Always,
1 => PadPresence::Sometimes,
2 => PadPresence::Request,
value => PadPresence::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum ParseError { pub enum ParseError {
Syntax, Syntax,
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bin; use Bin;
...@@ -628,7 +628,7 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 { ...@@ -628,7 +628,7 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 {
// unsafe { TODO: call ffi::gst_value_get_bitmask() } // unsafe { TODO: call ffi::gst_value_get_bitmask() }
//} //}
//pub fn value_get_caps(value: /*Ignored*/&glib::Value) -> /*Ignored*/Option<Caps> { //pub fn value_get_caps(value: /*Ignored*/&glib::Value) -> Option<Caps> {
// unsafe { TODO: call ffi::gst_value_get_caps() } // unsafe { TODO: call ffi::gst_value_get_caps() }
//} //}
...@@ -724,7 +724,7 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 { ...@@ -724,7 +724,7 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 {
// unsafe { TODO: call ffi::gst_value_set_bitmask() } // unsafe { TODO: call ffi::gst_value_set_bitmask() }
//} //}
//pub fn value_set_caps(value: /*Ignored*/&mut glib::Value, caps: /*Ignored*/&Caps) { //pub fn value_set_caps(value: /*Ignored*/&mut glib::Value, caps: &Caps) {
// unsafe { TODO: call ffi::gst_value_set_caps() } // unsafe { TODO: call ffi::gst_value_set_caps() }
//} //}
......
// This file was generated by gir (33e9567) from gir-files (???) // This file was generated by gir (33e9567+) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
mod bin; mod bin;
...@@ -80,6 +80,7 @@ pub use self::enums::Format; ...@@ -80,6 +80,7 @@ pub use self::enums::Format;
pub use self::enums::LibraryError; pub use self::enums::LibraryError;
pub use self::enums::PadDirection; pub use self::enums::PadDirection;
pub use self::enums::PadLinkReturn; pub use self::enums::PadLinkReturn;