From 21c687f2563009e8e2443f1046b1377e3e07d57c Mon Sep 17 00:00:00 2001 From: fengalin Date: Mon, 29 Jan 2018 13:25:12 +0100 Subject: [PATCH] Examples: message handlers: invoke generic Message method from the concrete message Generic methods for events, messages and queries can now be invoked from the concrete type. --- examples/src/bin/appsink.rs | 2 +- examples/src/bin/appsrc.rs | 2 +- examples/src/bin/decodebin.rs | 6 +++--- examples/src/bin/events.rs | 2 +- examples/src/bin/gtksink.rs | 2 +- examples/src/bin/gtkvideooverlay.rs | 2 +- examples/src/bin/launch.rs | 2 +- examples/src/bin/launch_glib_main.rs | 2 +- examples/src/bin/pad_probes.rs | 2 +- examples/src/bin/playbin.rs | 2 +- examples/src/bin/queries.rs | 2 +- examples/src/bin/tagsetter.rs | 2 +- examples/src/bin/toc.rs | 2 +- examples/src/bin/tokio.rs | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 468468e6e..ed3393fd6 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -137,7 +137,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { MessageView::Error(err) => { pipeline.set_state(gst::State::Null).into_result()?; Err(ErrorMessage { - src: msg.get_src() + src: err.get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index e4760ba39..337404f54 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -111,7 +111,7 @@ fn main_loop(pipeline: gst::Pipeline, appsrc: gst_app::AppSrc) -> Result<(), Err MessageView::Error(err) => { pipeline.set_state(gst::State::Null).into_result()?; Err(ErrorMessage { - src: msg.get_src() + src: err.get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index cc018b006..1966d3280 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -174,7 +174,7 @@ fn example_main() -> Result<(), Error> { .map(Result::Err) .expect("error-details message without actual error"), _ => Err(ErrorMessage { - src: msg.get_src() + src: err.get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), @@ -186,7 +186,7 @@ fn example_main() -> Result<(), Error> { #[cfg(not(feature = "v1_10"))] { Err(ErrorMessage { - src: msg.get_src() + src: err.get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), @@ -199,7 +199,7 @@ fn example_main() -> Result<(), Error> { MessageView::StateChanged(s) => { println!( "State changed from {:?}: {:?} -> {:?} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + s.get_src().map(|s| s.get_path_string()), s.get_old(), s.get_current(), s.get_pending() diff --git a/examples/src/bin/events.rs b/examples/src/bin/events.rs index 9dcd2eff6..58244e187 100644 --- a/examples/src/bin/events.rs +++ b/examples/src/bin/events.rs @@ -45,7 +45,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 3ce7e6bee..89b717167 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -89,7 +89,7 @@ fn create_ui(app: >k::Application) { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index b28c1ccea..57cef2356 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -159,7 +159,7 @@ fn create_ui(app: >k::Application) { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/launch.rs b/examples/src/bin/launch.rs index cb54b64ba..be8248ed5 100644 --- a/examples/src/bin/launch.rs +++ b/examples/src/bin/launch.rs @@ -39,7 +39,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/launch_glib_main.rs b/examples/src/bin/launch_glib_main.rs index 0e429d076..a82b8ae6c 100644 --- a/examples/src/bin/launch_glib_main.rs +++ b/examples/src/bin/launch_glib_main.rs @@ -34,7 +34,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index adb010600..b4ad02c75 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -61,7 +61,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 835d7f6b9..5d0bb0c7a 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -76,7 +76,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/queries.rs b/examples/src/bin/queries.rs index 4e154deb6..ca50168f9 100644 --- a/examples/src/bin/queries.rs +++ b/examples/src/bin/queries.rs @@ -73,7 +73,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/tagsetter.rs b/examples/src/bin/tagsetter.rs index 41911d8b0..71a6f55e3 100644 --- a/examples/src/bin/tagsetter.rs +++ b/examples/src/bin/tagsetter.rs @@ -71,7 +71,7 @@ fn example_main() -> Result<(), Error> { MessageView::Eos(..) => break, MessageView::Error(err) => { Err(ErrorMessage { - src: msg.get_src() + src: err.get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), diff --git a/examples/src/bin/toc.rs b/examples/src/bin/toc.rs index 007f357da..20021e4b2 100644 --- a/examples/src/bin/toc.rs +++ b/examples/src/bin/toc.rs @@ -63,7 +63,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() ); diff --git a/examples/src/bin/tokio.rs b/examples/src/bin/tokio.rs index 557562303..b60e9d229 100644 --- a/examples/src/bin/tokio.rs +++ b/examples/src/bin/tokio.rs @@ -41,7 +41,7 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - msg.get_src().map(|s| s.get_path_string()), + err.get_src().map(|s| s.get_path_string()), err.get_error(), err.get_debug() );