Skip to content

Commit

Permalink
Add YUYV frame format as default
Browse files Browse the repository at this point in the history
  • Loading branch information
ayakoakasaka committed Dec 11, 2023
1 parent 9e8cfb0 commit dc4a571
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions host_wasmtime/src/nokhwa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ impl SensorDevice for NokhwaDevice {
pool: Arc<dyn BufferPool + Send + Sync>,
) -> Result<(), DeviceError> {
let ref mut camera = self.camera;
match camera.set_frame_format(FrameFormat::YUYV) {
Ok(_) => {}, // Do nothing on success
Err(e) => {
// Attempted to set the YUYV format but encountered an error.
// Note: This error might be a false positive, and the format setting could actually be applied.
// This behavior may be specific to certain camera models/drivers,
// so it's important to carefully check the situation and implement additional verification if necessary.
println!("Attempted to set YUYV format, but an error was reported: {}", e);
}
}
camera.set_callback(move |buffer| {
println!("NokhwaDevice callback");
let resolution = buffer.resolution();
Expand Down

0 comments on commit dc4a571

Please sign in to comment.