Add GObjectExtManual trait and implement set_property_from_string() there

This commit is contained in:
Sebastian Dröge 2017-07-20 11:39:44 +03:00
parent 91649b259a
commit ce33439465
2 changed files with 19 additions and 0 deletions

17
gstreamer/src/gobject.rs Normal file
View file

@ -0,0 +1,17 @@
use glib;
use glib::IsA;
use glib::translate::{ToGlibPtr, from_glib};
use ffi;
pub trait GObjectExtManualGst {
fn set_property_from_str(&self, name: &str, value: &str);
}
impl<O: IsA<glib::Object>> GObjectExtManualGst for O {
fn set_property_from_str(&self, name: &str, value: &str) {
unsafe {
ffi::gst_util_set_object_arg(self.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0);
}
}
}

View file

@ -61,7 +61,9 @@ pub use tags::*;
mod element;
mod bin;
mod bus;
mod gobject;
pub use bin::BinExtManual;
pub use gobject::GObjectExtManualGst;
mod value;
pub use value::*;