Commit 21c687f2 authored by François Laignel's avatar François Laignel Committed by Sebastian Dröge

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.
parent da924e5d
......@@ -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(),
......
......@@ -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(),
......
......@@ -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()
......
......@@ -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()
);
......
......@@ -89,7 +89,7 @@ fn create_ui(app: &gtk::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()
);
......
......@@ -159,7 +159,7 @@ fn create_ui(app: &gtk::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()
);
......
......@@ -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()
);
......
......@@ -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()
);
......
......@@ -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()
);
......
......@@ -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()
);
......
......@@ -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()
);
......
......@@ -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(),
......
......@@ -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()
);
......
......@@ -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()
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment