From 6f349665183cde4e0c659b1c7fc7636b0ea7857c Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 12 Jan 2024 22:44:30 -0500 Subject: [PATCH] keyfork-qrcode: use userptr instead of mmap stream --- keyfork-qrcode/src/bin/keyfork-qrcode-scan.rs | 12 ++++++++++++ keyfork-qrcode/src/lib.rs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 keyfork-qrcode/src/bin/keyfork-qrcode-scan.rs diff --git a/keyfork-qrcode/src/bin/keyfork-qrcode-scan.rs b/keyfork-qrcode/src/bin/keyfork-qrcode-scan.rs new file mode 100644 index 0000000..89f3846 --- /dev/null +++ b/keyfork-qrcode/src/bin/keyfork-qrcode-scan.rs @@ -0,0 +1,12 @@ +use std::time::Duration; + +use keyfork_qrcode::scan_camera; + +fn main() -> Result<(), Box> { + let output = scan_camera(Duration::from_secs(60 * 10), 0)?; + if let Some(scanned_text) = output { + println!("{scanned_text}"); + } + + Ok(()) +} diff --git a/keyfork-qrcode/src/lib.rs b/keyfork-qrcode/src/lib.rs index c6edd37..b97f694 100644 --- a/keyfork-qrcode/src/lib.rs +++ b/keyfork-qrcode/src/lib.rs @@ -7,7 +7,7 @@ use std::{ }; use v4l::{ buffer::Type, - io::{mmap::Stream, traits::CaptureStream}, + io::{userptr::Stream, traits::CaptureStream}, video::Capture, Device, FourCC, };