@@ -2,6 +2,7 @@ mod utils;
2
2
3
3
use crate :: geometry:: Vec2D ;
4
4
use image:: { ImageBuffer , ImageError , Rgb } ;
5
+ use log:: { error, trace, warn} ;
5
6
use std:: fmt:: Display ;
6
7
use std:: io;
7
8
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
@@ -78,6 +79,8 @@ impl Camera {
78
79
///
79
80
/// This is going to panic if a supported output pixel format cannot be found
80
81
pub fn new ( camera_path : & str ) -> Result < Self , Error > {
82
+ trace ! ( "Creating Camera" ) ;
83
+
81
84
let device = Device :: with_path ( camera_path) ?;
82
85
let mut format = device. format ( ) ?;
83
86
let frame_size = Vec2D :: new ( format. width , format. height ) ;
@@ -95,6 +98,9 @@ impl Camera {
95
98
let Some ( pixel_format) = chosen_pixel_format else {
96
99
return Err ( Error :: CannotSetFormat ) ;
97
100
} ;
101
+
102
+ trace ! ( "Chosen camera format: {format:?}" ) ;
103
+
98
104
#[ cfg( not( feature = "rgb-webcam" ) ) ]
99
105
assert_eq ! (
100
106
pixel_format,
@@ -132,6 +138,8 @@ pub fn start(frame: &Arc<Mutex<Option<Frame>>>, finished: &Arc<AtomicBool>, came
132
138
let new_frame = match camera. get_frame ( ) {
133
139
Ok ( f) => f,
134
140
Err ( e) => {
141
+ error ! ( "Failed to get frame: {e}" ) ;
142
+
135
143
failed_frames_in_row += 1 ;
136
144
assert ! (
137
145
failed_frames_in_row < MAX_FAILED_FRAMES_IN_ROW ,
0 commit comments