Merge pull request #3 from danhoffman699/master
Update dependencies and use new method for event subscriptions
This commit is contained in:
commit
cb7edfea36
2 changed files with 4 additions and 33 deletions
|
@ -5,12 +5,12 @@ authors = ["jazzfool"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
iced = { version = "0.1", features = ["image", "tokio"] }
|
||||
iced_native = "0.2"
|
||||
iced = { git = "https://github.com/hecrj/iced.git", features = ["image", "tokio"] }
|
||||
iced_native = "0.3.0"
|
||||
gstreamer = "0.16"
|
||||
gstreamer-app = "0.16" # appsink
|
||||
glib = "0.10" # gobject traits and error type
|
||||
tokio = { version = "0.2", features = ["time", "stream"] }# time subscription (every frame)
|
||||
tokio = { version = "1.2.0", features = ["time"] }
|
||||
thiserror = "1"
|
||||
url = "2" # media uri
|
||||
num-rational = "0.3" # framerates come in rationals
|
||||
|
|
31
src/lib.rs
31
src/lib.rs
|
@ -353,36 +353,7 @@ impl VideoPlayer {
|
|||
|
||||
// until iced 0.2 is released, which has this built-in
|
||||
mod time {
|
||||
use iced::futures;
|
||||
|
||||
pub fn every(duration: std::time::Duration) -> iced::Subscription<std::time::Instant> {
|
||||
iced::Subscription::from_recipe(Every(duration))
|
||||
}
|
||||
|
||||
struct Every(std::time::Duration);
|
||||
|
||||
impl<H, I> iced_native::subscription::Recipe<H, I> for Every
|
||||
where
|
||||
H: std::hash::Hasher,
|
||||
{
|
||||
type Output = std::time::Instant;
|
||||
|
||||
fn hash(&self, state: &mut H) {
|
||||
use std::hash::Hash;
|
||||
|
||||
std::any::TypeId::of::<Self>().hash(state);
|
||||
self.0.hash(state);
|
||||
}
|
||||
|
||||
fn stream(
|
||||
self: Box<Self>,
|
||||
_input: futures::stream::BoxStream<'static, I>,
|
||||
) -> futures::stream::BoxStream<'static, Self::Output> {
|
||||
use futures::stream::StreamExt;
|
||||
|
||||
tokio::time::interval(self.0)
|
||||
.map(|_| std::time::Instant::now())
|
||||
.boxed()
|
||||
}
|
||||
iced::time::every(duration)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue