mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-01 05:51:14 +00:00
Use Object::set_property() instead of unsafe code for setting filesrc location
This commit is contained in:
parent
291f329fc3
commit
8f8ba45588
1 changed files with 3 additions and 5 deletions
|
@ -1,7 +1,9 @@
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
use gst::*;
|
use gst::*;
|
||||||
|
use gst::ObjectExt as GstObjectExt;
|
||||||
|
|
||||||
extern crate glib;
|
extern crate glib;
|
||||||
|
use glib::ObjectExt;
|
||||||
use glib::translate::{from_glib_none, ToGlibPtr};
|
use glib::translate::{from_glib_none, ToGlibPtr};
|
||||||
|
|
||||||
extern crate gstreamer_sys as gst_ffi;
|
extern crate gstreamer_sys as gst_ffi;
|
||||||
|
@ -24,11 +26,7 @@ fn main() {
|
||||||
let src = gst::ElementFactory::make("filesrc", None).unwrap();
|
let src = gst::ElementFactory::make("filesrc", None).unwrap();
|
||||||
let decodebin = gst::ElementFactory::make("decodebin", None).unwrap();
|
let decodebin = gst::ElementFactory::make("decodebin", None).unwrap();
|
||||||
|
|
||||||
// FIXME: https://github.com/gtk-rs/glib/pull/189
|
src.set_property("location", &Value::from(uri)).unwrap();
|
||||||
unsafe {
|
|
||||||
let uri = Value::from(uri);
|
|
||||||
gobject_ffi::g_object_set_property(src.to_glib_none().0, "location".to_glib_none().0, uri.to_glib_none().0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline.add_many(&[&src, &decodebin]).unwrap();
|
pipeline.add_many(&[&src, &decodebin]).unwrap();
|
||||||
gst::Element::link_many(&[&src, &decodebin]).unwrap();
|
gst::Element::link_many(&[&src, &decodebin]).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue