forked from mirrors/gstreamer-rs
Add comments from the C tutorial to basic-tutorial-1
This commit is contained in:
parent
6f6db8ac47
commit
24b8b383d8
1 changed files with 5 additions and 1 deletions
|
@ -4,16 +4,19 @@ use gst::prelude::*;
|
||||||
use std::u64;
|
use std::u64;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// Initialize GStreamer
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
|
|
||||||
|
// Build the pipeline
|
||||||
let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
|
let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
|
||||||
let pipeline = gst::parse_launch(&format!("playbin uri={}", uri)).unwrap();
|
let pipeline = gst::parse_launch(&format!("playbin uri={}", uri)).unwrap();
|
||||||
|
|
||||||
|
// Start playing
|
||||||
let ret = pipeline.set_state(gst::State::Playing);
|
let ret = pipeline.set_state(gst::State::Playing);
|
||||||
assert_ne!(ret, gst::StateChangeReturn::Failure);
|
assert_ne!(ret, gst::StateChangeReturn::Failure);
|
||||||
|
|
||||||
|
// Wait until error or EOS
|
||||||
let bus = pipeline.get_bus().unwrap();
|
let bus = pipeline.get_bus().unwrap();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
use gst::MessageView;
|
use gst::MessageView;
|
||||||
|
|
||||||
|
@ -37,6 +40,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shutdown pipeline
|
||||||
let ret = pipeline.set_state(gst::State::Null);
|
let ret = pipeline.set_state(gst::State::Null);
|
||||||
assert_ne!(ret, gst::StateChangeReturn::Failure);
|
assert_ne!(ret, gst::StateChangeReturn::Failure);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue