diff --git a/tutorials/src/bin/basic-tutorial-1.rs b/tutorials/src/bin/basic-tutorial-1.rs index 19fec3c8f..166f857bf 100644 --- a/tutorials/src/bin/basic-tutorial-1.rs +++ b/tutorials/src/bin/basic-tutorial-1.rs @@ -4,16 +4,19 @@ use gst::prelude::*; use std::u64; fn main() { + // Initialize GStreamer gst::init().unwrap(); + // Build the pipeline 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(); + // Start playing let ret = pipeline.set_state(gst::State::Playing); assert_ne!(ret, gst::StateChangeReturn::Failure); + // Wait until error or EOS let bus = pipeline.get_bus().unwrap(); - loop { use gst::MessageView; @@ -37,6 +40,7 @@ fn main() { } } + // Shutdown pipeline let ret = pipeline.set_state(gst::State::Null); assert_ne!(ret, gst::StateChangeReturn::Failure); }