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

View file

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

View file

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