forked from mirrors/gstreamer-rs
examples/tutorials: Update for new Bus::connect_message() API that takes signal details
This commit is contained in:
parent
5822785191
commit
8b71f5331a
5 changed files with 8 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue