examples/tutorials: Update for new Bus::connect_message() API that takes signal details

This commit is contained in:
Sebastian Dröge 2021-02-28 18:32:44 +02:00
parent 5822785191
commit 8b71f5331a
5 changed files with 8 additions and 8 deletions

View file

@ -81,7 +81,7 @@ fn example_main() {
});
//bus.add_signal_watch();
//bus.connect_message(move |_, msg| {
//bus.connect_message(None, move |_, msg| {
let main_loop_clone = main_loop.clone();
// This sets the bus's signal handler (don't be mislead by the "add", there can only be one).
// Every message from the bus is passed through this function. Its returnvalue determines

View file

@ -34,7 +34,7 @@ fn example_main() {
let main_loop_clone = main_loop.clone();
//bus.add_signal_watch();
//bus.connect_message(move |_, msg| {
//bus.connect_message(None, move |_, msg| {
bus.add_watch(move |_, msg| {
use gst::MessageView;

View file

@ -94,7 +94,7 @@ fn example_main() {
// Need to move a new reference into the closure.
let main_loop_clone = main_loop.clone();
//bus.add_signal_watch();
//bus.connect_message(move |_, msg| {
//bus.connect_message(None, move |_, msg| {
bus.add_watch(move |_, msg| {
use gst::MessageView;

View file

@ -247,7 +247,7 @@ mod tutorial5 {
let bus = playbin.get_bus().unwrap();
#[allow(clippy::single_match)]
bus.connect_message(move |_, msg| match msg.view() {
bus.connect_message(Some("application"), move |_, msg| match msg.view() {
gst::MessageView::Application(application) => {
let pipeline = match pipeline_weak.upgrade() {
Some(pipeline) => pipeline,
@ -266,7 +266,7 @@ mod tutorial5 {
analyze_streams(&pipeline, &textbuf);
}
}
_ => (),
_ => unreachable!(),
});
let vbox = gtk::Box::new(gtk::Orientation::Horizontal, 0);
@ -364,7 +364,7 @@ mod tutorial5 {
bus.add_signal_watch();
let pipeline_weak = playbin.downgrade();
bus.connect_message(move |_, msg| {
bus.connect_message(None, move |_, msg| {
let pipeline = match pipeline_weak.upgrade() {
Some(pipeline) => pipeline,
None => return,

View file

@ -240,7 +240,7 @@ fn main() {
let main_loop_clone = main_loop.clone();
let bus = pipeline.get_bus().unwrap();
#[allow(clippy::single_match)]
bus.connect_message(move |_, msg| match msg.view() {
bus.connect_message(Some("error"), move |_, msg| match msg.view() {
gst::MessageView::Error(err) => {
let main_loop = &main_loop_clone;
eprintln!(
@ -251,7 +251,7 @@ fn main() {
eprintln!("Debugging information: {:?}", err.get_debug());
main_loop.quit();
}
_ => (),
_ => unreachable!(),
});
bus.add_signal_watch();