Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build/
escapi.opensdf
escapi.sdf
/target/*
Cargo.lock
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: rust
rust:
- stable
- beta
- nightly
os:
- windows

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "escapi"
version = "3.1.0"
version = "4.0.0"
authors = [
"Daniel Abramov <dabramov@snapview.de>",
"Oliver Schneider <git-spam-1984941651981@oli-obk.de>",
Expand All @@ -16,7 +16,7 @@ kernel32-sys = "0.2.2"
libc = "0.2.10"

[dev-dependencies]
image = "0.13"
image = "0.21.1"

[build-dependencies]
gcc = "0.3"
cc = "1.0"
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

extern crate gcc;
extern crate cc;

fn main() {
let path = std::env::current_dir().expect("Could not get the current dir");
gcc::Config::new()
cc::Build::new()
.cpp(true)
.pic(true)
.include(path.join("escapi_dll"))
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ struct SimpleCapParams {
height: libc::c_uint,
}

unsafe impl Send for SimpleCapParams {}

pub fn num_devices() -> usize {
unsafe { countCaptureDevices() as usize }
}
Expand Down Expand Up @@ -43,7 +45,7 @@ pub fn init(index: usize, wdt: u32, hgt: u32, desired_fps: u64) -> Result<Device
/// The device requests BGRA format, so the frames are in BGRA.
pub struct Device {
device_idx: libc::c_uint,
buf: Box<[i32]>,
buf: Box<[libc::c_int]>,
params: Box<SimpleCapParams>,
desired_fps: u64,
}
Expand All @@ -66,7 +68,7 @@ impl Device {
}
pub fn name(&self) -> String {
let mut v = vec![0u8; 100];
unsafe { getCaptureDeviceName(self.device_idx, v.as_mut_ptr() as *mut i8, v.len() as i32) };
unsafe { getCaptureDeviceName(self.device_idx, v.as_mut_ptr() as *mut i8, v.len() as libc::c_int) };
let null = v.iter().position(|&c| c == 0).expect("null termination character");
v.truncate(null);
String::from_utf8(v).expect("device name contains invalid utf8 characters")
Expand Down