Commit 992105b4 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Implement basic GstStructure bindings

parent decf5da6
......@@ -37,7 +37,6 @@ generate = [
"Gst.URIError",
"Gst.StructureChangeType",
"Gst.StreamStatusType",
"Gst.Device",
"Gst.DeviceMonitor",
"Gst.DeviceProvider",
"Gst.DeviceProviderFactory",
......@@ -52,6 +51,7 @@ generate = [
manual = [
"GLib.Error",
"Gst.Message",
"Gst.Structure",
]
[[object]]
......@@ -160,6 +160,20 @@ name = "Gst.ElementFactory"
status = "generate"
trait = false
[[object]]
name = "Gst.Device"
status = "generate"
[[object.function]]
name = "get_properties"
# Structure is not a GObject
ignore = true
[[object.property]]
name = "properties"
# Structure is not a GObject
ignore = true
[[object]]
name = "Gst.Object"
status = "generate"
......
......@@ -35,8 +35,6 @@ pub trait DeviceExt {
fn get_display_name(&self) -> Option<String>;
//fn get_properties(&self) -> /*Ignored*/Option<Structure>;
fn has_classes(&self, classes: &str) -> bool;
fn has_classesv(&self, classes: &[&str]) -> bool;
......@@ -49,8 +47,6 @@ pub trait DeviceExt {
fn get_property_display_name(&self) -> Option<String>;
//fn get_property_properties(&self) -> /*Ignored*/Option<Structure>;
fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
}
......@@ -79,10 +75,6 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
}
}
//fn get_properties(&self) -> /*Ignored*/Option<Structure> {
// unsafe { TODO: call ffi::gst_device_get_properties() }
//}
fn has_classes(&self, classes: &str) -> bool {
unsafe {
from_glib(ffi::gst_device_has_classes(self.to_glib_none().0, classes.to_glib_none().0))
......@@ -125,14 +117,6 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
value.get()
}
//fn get_property_properties(&self) -> /*Ignored*/Option<Structure> {
// let mut value = Value::from(None::<&/*Ignored*/Structure>);
// unsafe {
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "properties".to_glib_none().0, value.to_glib_none_mut().0);
// }
// value.get()
//}
fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
......
......@@ -146,7 +146,7 @@ pub trait ElementExt {
//fn message_full<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32);
//#[cfg(feature = "v1_10")]
//fn message_full_with_details<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32, structure: /*Ignored*/&mut Structure);
//fn message_full_with_details<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32, structure: &mut Structure);
fn no_more_pads(&self);
......@@ -394,7 +394,7 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
//}
//#[cfg(feature = "v1_10")]
//fn message_full_with_details<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32, structure: /*Ignored*/&mut Structure) {
//fn message_full_with_details<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32, structure: &mut Structure) {
// unsafe { TODO: call ffi::gst_element_message_full_with_details() }
//}
......
......@@ -224,7 +224,7 @@ pub fn is_initialized() -> bool {
}
}
//pub fn make_element_message_details(name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> /*Ignored*/Option<Structure> {
//pub fn make_element_message_details(name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<Structure> {
// unsafe { TODO: call ffi::gst_make_element_message_details() }
//}
......@@ -641,7 +641,7 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 {
// unsafe { TODO: call ffi::gst_value_get_int_range_step() }
//}
//pub fn value_get_structure(value: /*Ignored*/&glib::Value) -> /*Ignored*/Option<Structure> {
//pub fn value_get_structure(value: /*Ignored*/&glib::Value) -> Option<Structure> {
// unsafe { TODO: call ffi::gst_value_get_structure() }
//}
......@@ -717,7 +717,7 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 {
// unsafe { TODO: call ffi::gst_value_set_int_range_step() }
//}
//pub fn value_set_structure(value: /*Ignored*/&mut glib::Value, structure: /*Ignored*/&Structure) {
//pub fn value_set_structure(value: /*Ignored*/&mut glib::Value, structure: &Structure) {
// unsafe { TODO: call ffi::gst_value_set_structure() }
//}
......
......@@ -3,6 +3,7 @@
use Error;
use Object;
use Structure;
use ffi;
use glib::translate::*;
use std::ptr;
......@@ -24,9 +25,11 @@ impl Plugin {
// 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_cache_data(&self) -> Option<Structure> {
unsafe {
from_glib_none(ffi::gst_plugin_get_cache_data(self.to_glib_none().0))
}
}
pub fn get_description(&self) -> Option<String> {
unsafe {
......@@ -88,9 +91,11 @@ impl Plugin {
}
}
//pub fn set_cache_data(&self, cache_data: /*Ignored*/&mut Structure) {
// unsafe { TODO: call ffi::gst_plugin_set_cache_data() }
//}
pub fn set_cache_data(&self, cache_data: &mut Structure) {
unsafe {
ffi::gst_plugin_set_cache_data(self.to_glib_none().0, cache_data.to_glib_full());
}
}
pub fn list_free(list: &[Plugin]) {
unsafe {
......
......@@ -47,6 +47,8 @@ pub use miniobject::GstRc;
pub mod message;
pub use message::Message;
pub use message::MessageView;
pub mod structure;
pub use structure::Structure;
mod element;
mod bin;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment