Commit 6f6db8ac authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
parent 7dfab613
......@@ -7,4 +7,5 @@ members = [
"gstreamer-player",
"gstreamer-video",
"examples",
"tutorials",
]
[package]
name = "tutorials"
version = "0.9.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
[dependencies]
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
gstreamer = { path = "../gstreamer" }
[badges]
travis-ci = { repository = "sdroege/gstreamer-rs", branch = "master" }
extern crate gstreamer as gst;
use gst::prelude::*;
use std::u64;
fn main() {
gst::init().unwrap();
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 ret = pipeline.set_state(gst::State::Playing);
assert_ne!(ret, gst::StateChangeReturn::Failure);
let bus = pipeline.get_bus().unwrap();
loop {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {
println!(
"Error from {}: {} ({:?})",
msg.get_src().get_path_string(),
err.get_error(),
err.get_debug()
);
break;
}
_ => (),
}
}
let ret = pipeline.set_state(gst::State::Null);
assert_ne!(ret, gst::StateChangeReturn::Failure);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment