forked from mirrors/gstreamer-rs
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.
This commit is contained in:
parent
a276c226fd
commit
4b4f369200
2 changed files with 30 additions and 32 deletions
|
@ -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,15 +15,14 @@ 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| {
|
||||
let messages = gst::BusStream::new(&bus)
|
||||
.for_each(|msg| {
|
||||
use gst::MessageView;
|
||||
|
||||
let quit = match msg.view() {
|
||||
|
@ -46,9 +44,10 @@ fn example_main() {
|
|||
} 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);
|
Loading…
Reference in a new issue