Add comments from the C tutorial to basic-tutorial-1

This commit is contained in:
Sebastian Dröge 2017-09-08 16:33:09 +03:00
parent 6f6db8ac47
commit 24b8b383d8

View file

@ -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);
} }