keyfork-qrcode: enforce use of MPG1 video streams
This commit is contained in:
parent
60261aa3e9
commit
f47d7c92b8
|
@ -9,6 +9,8 @@ use std::{
|
|||
use v4l::{
|
||||
buffer::Type,
|
||||
io::{userptr::Stream, traits::CaptureStream},
|
||||
video::Capture,
|
||||
FourCC,
|
||||
Device,
|
||||
};
|
||||
|
||||
|
@ -100,6 +102,9 @@ pub fn qrencode(
|
|||
#[cfg(feature = "decode-backend-rqrr")]
|
||||
pub fn scan_camera(timeout: Duration, index: usize) -> Result<Option<String>, QRCodeScanError> {
|
||||
let device = Device::new(index)?;
|
||||
let mut fmt = device.format().expect("Failed to read format");
|
||||
fmt.fourcc = FourCC::new(b"MPG1");
|
||||
device.set_format(&fmt)?;
|
||||
let mut stream = Stream::with_buffers(&device, Type::VideoCapture, 4)?;
|
||||
let start = SystemTime::now();
|
||||
|
||||
|
@ -128,6 +133,9 @@ pub fn scan_camera(timeout: Duration, index: usize) -> Result<Option<String>, QR
|
|||
#[cfg(feature = "decode-backend-zbar")]
|
||||
pub fn scan_camera(timeout: Duration, index: usize) -> Result<Option<String>, QRCodeScanError> {
|
||||
let device = Device::new(index)?;
|
||||
let mut fmt = device.format().expect("Failed to read format");
|
||||
fmt.fourcc = FourCC::new(b"MPG1");
|
||||
device.set_format(&fmt)?;
|
||||
let mut stream = Stream::with_buffers(&device, Type::VideoCapture, 4)?;
|
||||
let start = SystemTime::now();
|
||||
let mut scanner = keyfork_zbar::image_scanner::ImageScanner::new();
|
||||
|
|
Loading…
Reference in New Issue