From 7238e34869f6398d6c6823c84915933fb1d28ea7 Mon Sep 17 00:00:00 2001 From: Aron Heinecke Date: Sun, 25 Nov 2018 03:19:01 +0100 Subject: [PATCH] Implement Send to allow for shared state Signed-off-by: Aron Heinecke --- src/core.rs | 2 ++ src/media.rs | 2 ++ src/media_player.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/core.rs b/src/core.rs index eb9f924..078919b 100644 --- a/src/core.rs +++ b/src/core.rs @@ -28,6 +28,8 @@ pub struct Instance { pub(crate) ptr: *mut sys::libvlc_instance_t, } +unsafe impl Send for Instance {} + impl Instance { /// Create and initialize a libvlc instance. pub fn new() -> Option { diff --git a/src/media.rs b/src/media.rs index 60e4656..b3f32a8 100644 --- a/src/media.rs +++ b/src/media.rs @@ -12,6 +12,8 @@ pub struct Media { pub(crate) ptr: *mut sys::libvlc_media_t, } +unsafe impl Send for Media {} + impl Media { /// Create a media with a certain given media resource location, for instance a valid URL. pub fn new_location(instance: &Instance, mrl: &str) -> Option { diff --git a/src/media_player.rs b/src/media_player.rs index 15aebf0..56e0448 100644 --- a/src/media_player.rs +++ b/src/media_player.rs @@ -15,6 +15,8 @@ pub struct MediaPlayer { pub(crate) ptr: *mut sys::libvlc_media_player_t, } +unsafe impl Send for MediaPlayer {} + impl MediaPlayer { /// Create an empty Media Player object pub fn new(instance: &Instance) -> Option {