tutorials/basic-tutorial-13: Add "\r" at each println to fix the raw terminal display

This commit is contained in:
Guillaume Gomez 2021-01-09 15:40:00 +01:00
parent 89acc11e2c
commit a3f6f710a9

View file

@ -29,7 +29,7 @@ fn send_seek_event(pipeline: &Element, rate: f64) -> bool {
let position = match pipeline.query_position::<gst::ClockTime>() { let position = match pipeline.query_position::<gst::ClockTime>() {
Some(pos) => pos, Some(pos) => pos,
None => { None => {
eprintln!("Unable to retrieve current position..."); eprintln!("Unable to retrieve current position...\r");
return false; return false;
} }
}; };
@ -61,11 +61,11 @@ fn send_seek_event(pipeline: &Element, rate: f64) -> bool {
.unwrap() .unwrap()
.get::<Element>() .get::<Element>()
{ {
println!("Current rate: {}", rate); println!("Current rate: {}\r", rate);
// Send the event // Send the event
video_sink.send_event(seek_event) video_sink.send_event(seek_event)
} else { } else {
eprintln!("Failed to update rate..."); eprintln!("Failed to update rate...\r");
false false
} }
} }
@ -157,7 +157,7 @@ USAGE: Choose one of the following options, then press enter:
"PLAYING" "PLAYING"
}; };
playing = !playing; playing = !playing;
println!("Setting state to {}", status); println!("Setting state to {}\r", status);
} }
Command::DataRateUp => { Command::DataRateUp => {
if send_seek_event(&pipeline, rate * 2.) { if send_seek_event(&pipeline, rate * 2.) {
@ -183,7 +183,7 @@ USAGE: Choose one of the following options, then press enter:
// Send the event // Send the event
let step = Step::new(gst::format::Buffers(Some(1)), rate.abs(), true, false); let step = Step::new(gst::format::Buffers(Some(1)), rate.abs(), true, false);
video_sink.send_event(step); video_sink.send_event(step);
println!("Stepping one frame"); println!("Stepping one frame\r");
} }
} }
Command::Quit => { Command::Quit => {