Commit 4b4f3692 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Rename tokio example to futures

It has nothing to do with tokio anymore with the newer futures version,
tokio would only come in if actual tokio API (e.g. for sockets) is used.
parent a276c226
......@@ -17,8 +17,7 @@ gstreamer-rtsp-server-sys = { git = "https://github.com/sdroege/gstreamer-sys",
gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = true }
gdk = { git = "https://github.com/gtk-rs/gdk", optional = true }
gio = { git = "https://github.com/gtk-rs/gio", optional = true }
futures = { version = "0.1", optional = true }
tokio-core = { version = "0.1", optional = true }
futures = { version = "0.2", optional = true }
send-cell = "0.1"
byte-slice-cast = "0.1"
failure = "0.1"
......@@ -30,7 +29,7 @@ gtksink = ["gtk", "gio"]
gtkvideooverlay = ["gtk", "gdk", "gio"]
gtkvideooverlay-x11 = ["gtkvideooverlay"]
gtkvideooverlay-quartz = ["gtkvideooverlay"]
tokio = ["gstreamer/futures", "futures", "tokio-core"]
generic-futures = ["gstreamer/futures", "futures"]
gst-rtsp-server = ["gstreamer-rtsp-server"]
gst-rtsp-server-record = ["gstreamer-rtsp-server", "gstreamer-rtsp", "gio"]
default-features = []
......@@ -98,8 +97,8 @@ name = "tagsetter"
name = "toc"
[[bin]]
name = "tokio"
required-features = ["tokio"]
name = "futures"
required-features = ["generic-futures"]
[[bin]]
name = "rtsp-server-record"
......
......@@ -2,9 +2,8 @@ extern crate gstreamer as gst;
use gst::prelude::*;
extern crate futures;
use futures::stream::Stream;
extern crate tokio_core;
use tokio_core::reactor::Core;
use futures::executor::block_on;
use futures::prelude::*;
use std::env;
......@@ -16,39 +15,39 @@ fn example_main() {
gst::init().unwrap();
let mut core = Core::new().unwrap();
let pipeline = gst::parse_launch(&pipeline_str).unwrap();
let bus = pipeline.get_bus().unwrap();
let ret = pipeline.set_state(gst::State::Playing);
assert_ne!(ret, gst::StateChangeReturn::Failure);
let messages = gst::BusStream::new(&bus).for_each(|msg| {
use gst::MessageView;
let quit = match msg.view() {
MessageView::Eos(..) => true,
MessageView::Error(err) => {
println!(
"Error from {:?}: {} ({:?})",
err.get_src().map(|s| s.get_path_string()),
err.get_error(),
err.get_debug()
);
true
let messages = gst::BusStream::new(&bus)
.for_each(|msg| {
use gst::MessageView;
let quit = match msg.view() {
MessageView::Eos(..) => true,
MessageView::Error(err) => {
println!(
"Error from {:?}: {} ({:?})",
err.get_src().map(|s| s.get_path_string()),
err.get_error(),
err.get_debug()
);
true
}
_ => false,
};
if quit {
Err(())
} else {
Ok(())
}
_ => false,
};
if quit {
Err(())
} else {
Ok(())
}
});
})
.and_then(|_| Ok(()));
let _ = core.run(messages);
let _ = block_on(messages);
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