Update for new simplified glib::Object::new() API

This commit is contained in:
Sebastian Dröge 2020-12-17 17:35:43 +02:00
parent b80a607737
commit 708c6aa57e
3 changed files with 4 additions and 23 deletions

View file

@ -741,10 +741,7 @@ fn setup(
let pipeline = gst::Pipeline::new(None);
// Src
let src_element = glib::Object::new(ElementSrcTest::static_type(), &[])
.unwrap()
.downcast::<ElementSrcTest>()
.unwrap();
let src_element = glib::Object::new::<ElementSrcTest>(&[]).unwrap();
src_element.set_property("context", &context_name).unwrap();
pipeline.add(&src_element).unwrap();
@ -763,10 +760,7 @@ fn setup(
}
// Sink
let sink_element = glib::Object::new(ElementSinkTest::static_type(), &[])
.unwrap()
.downcast::<ElementSinkTest>()
.unwrap();
let sink_element = glib::Object::new::<ElementSinkTest>(&[]).unwrap();
pipeline.add(&sink_element).unwrap();
last_element.link(&sink_element).unwrap();

View file

@ -15,8 +15,6 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
use glib::prelude::*;
mod imp;
glib::glib_wrapper! {
@ -30,9 +28,6 @@ unsafe impl Sync for CustomSource {}
impl CustomSource {
pub fn new(source: &gst::Element) -> CustomSource {
glib::Object::new(CustomSource::static_type(), &[("source", source)])
.unwrap()
.downcast()
.unwrap()
glib::Object::new(&[("source", source)]).unwrap()
}
}

View file

@ -16,8 +16,6 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
use glib::prelude::*;
mod imp;
glib::glib_wrapper! {
@ -31,12 +29,6 @@ unsafe impl Sync for VideoFallbackSource {}
impl VideoFallbackSource {
pub fn new(uri: Option<&str>, min_latency: u64) -> VideoFallbackSource {
glib::Object::new(
VideoFallbackSource::static_type(),
&[("uri", &uri), ("min-latency", &min_latency)],
)
.unwrap()
.downcast()
.unwrap()
glib::Object::new(&[("uri", &uri), ("min-latency", &min_latency)]).unwrap()
}
}