1#[cfg(any(target_os = "windows", docsrs))]
2#[cxx::bridge]
3mod ffi {
4 unsafe extern "C++" {
5 include!("spout_bridge.h");
6
7 #[cxx_name = "SpoutSenderBridge"]
8 type SpoutSender;
9 fn new_spout_sender() -> UniquePtr<SpoutSender>;
10 fn set_sender_name(self: Pin<&mut SpoutSender>, name: &str);
11 fn send_texture(
12 self: Pin<&mut SpoutSender>,
13 tex_id: u32,
14 target: u32,
15 width: u32,
16 height: u32,
17 invert: bool,
18 host_fbo: u32,
19 ) -> bool;
20 fn send_image(
21 self: Pin<&mut SpoutSender>,
22 pixels: &[u8],
23 width: u32,
24 height: u32,
25 gl_format: u32,
26 invert: bool,
27 host_fbo: u32,
28 ) -> bool;
29 fn release_sender(self: Pin<&mut SpoutSender>);
30 fn is_initialized(self: Pin<&mut SpoutSender>) -> bool;
31 fn get_name(self: Pin<&mut SpoutSender>) -> String;
32 fn get_width(self: Pin<&mut SpoutSender>) -> u32;
33 fn get_height(self: Pin<&mut SpoutSender>) -> u32;
34 fn hold_fps(self: Pin<&mut SpoutSender>, fps: i32);
35
36 #[cxx_name = "SpoutReceiverBridge"]
37 type SpoutReceiver;
38 fn new_spout_receiver() -> UniquePtr<SpoutReceiver>;
39 fn set_receiver_name(self: Pin<&mut SpoutReceiver>, name: &str);
40 fn receive_texture(
41 self: Pin<&mut SpoutReceiver>,
42 tex_id: u32,
43 target: u32,
44 invert: bool,
45 host_fbo: u32,
46 ) -> bool;
47 fn receive_texture_connect(self: Pin<&mut SpoutReceiver>) -> bool;
48 fn release_receiver(self: Pin<&mut SpoutReceiver>);
49 fn is_updated(self: Pin<&mut SpoutReceiver>) -> bool;
50 fn is_connected(self: Pin<&mut SpoutReceiver>) -> bool;
51 fn is_frame_new(self: Pin<&mut SpoutReceiver>) -> bool;
52 fn get_sender_name(self: Pin<&mut SpoutReceiver>) -> String;
53 fn get_sender_width(self: Pin<&mut SpoutReceiver>) -> u32;
54 fn get_sender_height(self: Pin<&mut SpoutReceiver>) -> u32;
55 fn get_sender_fps(self: Pin<&mut SpoutReceiver>) -> f64;
56
57 fn spout_sender_count() -> i32;
59 fn spout_get_sender(index: i32) -> String;
60 }
61}
62
63#[cfg(any(target_os = "windows", docsrs))]
64pub mod directory;
65#[cfg(any(target_os = "windows", docsrs))]
66pub mod error;
67#[cfg(any(target_os = "windows", docsrs))]
68pub mod frame;
69#[cfg(any(target_os = "windows", docsrs))]
70pub mod receiver;
71#[cfg(any(target_os = "windows", docsrs))]
72pub mod sender;
73#[cfg(any(target_os = "windows", docsrs))]
74pub mod types;
75
76#[cfg(any(target_os = "windows", docsrs))]
77pub use directory::Directory;
78#[cfg(any(target_os = "windows", docsrs))]
79pub use error::SpoutError;
80#[cfg(any(target_os = "windows", docsrs))]
81pub use frame::Frame;
82#[cfg(any(target_os = "windows", docsrs))]
83pub use receiver::SpoutReceiver;
84#[cfg(any(target_os = "windows", docsrs))]
85pub use sender::SpoutSender;
86#[cfg(any(target_os = "windows", docsrs))]
87pub use types::SenderInfo;