examples: Fix compilation after GValue API changes

This commit is contained in:
Sebastian Dröge 2019-08-13 18:00:17 +03:00
parent 22d8828015
commit 39ef834cfe
5 changed files with 12 additions and 9 deletions

View file

@ -271,6 +271,7 @@ fn example_main() -> Result<(), Error> {
// application's execution. // application's execution.
Some(details) if details.get_name() == "error-details" => details Some(details) if details.get_name() == "error-details" => details
.get::<&ErrorValue>("error") .get::<&ErrorValue>("error")
.unwrap()
.and_then(|v| v.0.lock().unwrap().take()) .and_then(|v| v.0.lock().unwrap().take())
.map(Result::Err) .map(Result::Err)
.expect("error-details message without actual error"), .expect("error-details message without actual error"),

View file

@ -299,6 +299,7 @@ fn example_main() -> Result<(), Error> {
match err.get_details() { match err.get_details() {
Some(details) if details.get_name() == "error-details" => details Some(details) if details.get_name() == "error-details" => details
.get::<&ErrorValue>("error") .get::<&ErrorValue>("error")
.unwrap()
.cloned() .cloned()
.and_then(|v| v.0.lock().unwrap().take()) .and_then(|v| v.0.lock().unwrap().take())
.map(Result::Err) .map(Result::Err)

View file

@ -659,7 +659,8 @@ fn main_loop(mut app: App) -> Result<glutin::WindowedContext<glutin::PossiblyCur
.glupload .glupload
.get_property("context") .get_property("context")
.unwrap() .unwrap()
.get::<gst_gl::GLContext>(); .get::<gst_gl::GLContext>()
.unwrap();
} }
let sync_meta = buffer.get_meta::<gst_gl::GLSyncMeta>().unwrap(); let sync_meta = buffer.get_meta::<gst_gl::GLSyncMeta>().unwrap();

View file

@ -45,7 +45,7 @@ fn create_ui(app: &gtk::Application) {
// The gtkglsink creates the gtk widget for us. This is accessible through a property. // The gtkglsink creates the gtk widget for us. This is accessible through a property.
// So we get it and use it later to add it to our gui. // So we get it and use it later to add it to our gui.
let widget = gtkglsink.get_property("widget").unwrap(); let widget = gtkglsink.get_property("widget").unwrap();
(glsinkbin, widget.get::<gtk::Widget>().unwrap()) (glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap())
} else { } else {
// Unfortunately, using the OpenGL widget didn't work out, so we will have to render // Unfortunately, using the OpenGL widget didn't work out, so we will have to render
// our frames manually, using the CPU. An example why this may fail is, when // our frames manually, using the CPU. An example why this may fail is, when
@ -54,7 +54,7 @@ fn create_ui(app: &gtk::Application) {
// The gtksink creates the gtk widget for us. This is accessible through a property. // The gtksink creates the gtk widget for us. This is accessible through a property.
// So we get it and use it later to add it to our gui. // So we get it and use it later to add it to our gui.
let widget = sink.get_property("widget").unwrap(); let widget = sink.get_property("widget").unwrap();
(sink, widget.get::<gtk::Widget>().unwrap()) (sink, widget.get::<gtk::Widget>().unwrap().unwrap())
}; };
pipeline.add_many(&[&src, &sink]).unwrap(); pipeline.add_many(&[&src, &sink]).unwrap();

View file

@ -148,12 +148,12 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
let drawer = drawer.lock().unwrap(); let drawer = drawer.lock().unwrap();
// Get the signal's arguments // Get the signal's arguments
let _overlay = args[0].get::<gst::Element>().unwrap(); let _overlay = args[0].get::<gst::Element>().unwrap().unwrap();
// This is the cairo context. This is the root of all of cairo's // This is the cairo context. This is the root of all of cairo's
// drawing functionality. // drawing functionality.
let cr = args[1].get::<cairo::Context>().unwrap(); let cr = args[1].get::<cairo::Context>().unwrap().unwrap();
let timestamp = args[2].get::<gst::ClockTime>().unwrap(); let timestamp = args[2].get_some::<gst::ClockTime>().unwrap();
let _duration = args[3].get::<gst::ClockTime>().unwrap(); let _duration = args[3].get_some::<gst::ClockTime>().unwrap();
let info = drawer.info.as_ref().unwrap(); let info = drawer.info.as_ref().unwrap();
let layout = drawer.layout.borrow(); let layout = drawer.layout.borrow();
@ -223,8 +223,8 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// stream that dynamically changes resolution when enough bandwith is available. // stream that dynamically changes resolution when enough bandwith is available.
overlay overlay
.connect("caps-changed", false, move |args| { .connect("caps-changed", false, move |args| {
let _overlay = args[0].get::<gst::Element>().unwrap(); let _overlay = args[0].get::<gst::Element>().unwrap().unwrap();
let caps = args[1].get::<gst::Caps>().unwrap(); let caps = args[1].get::<gst::Caps>().unwrap().unwrap();
let drawer = &drawer_clone; let drawer = &drawer_clone;
let mut drawer = drawer.lock().unwrap(); let mut drawer = drawer.lock().unwrap();