@@ -70,8 +70,8 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
70
70
}
71
71
72
72
// Get capabilities
73
- struct video_caps caps = { 0 } ;
74
- if (video_get_caps (this ->vdev , VIDEO_EP_OUT, &caps)) {
73
+ struct video_caps caps;
74
+ if (video_get_caps (this ->vdev , &caps)) {
75
75
return false ;
76
76
}
77
77
@@ -96,7 +96,7 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
96
96
.pitch = width * 2 ,
97
97
};
98
98
99
- if (video_set_format (this ->vdev , VIDEO_EP_OUT, &fmt)) {
99
+ if (video_set_format (this ->vdev , &fmt)) {
100
100
Serial.println (" Failed to set video format" );
101
101
return false ;
102
102
}
@@ -110,11 +110,11 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
110
110
Serial.println (" Failed to allocate video buffers" );
111
111
return false ;
112
112
}
113
- video_enqueue (this ->vdev , VIDEO_EP_OUT, this ->vbuf [i]);
113
+ video_enqueue (this ->vdev , this ->vbuf [i]);
114
114
}
115
115
116
116
// Start video capture
117
- if (video_stream_start (this ->vdev )) {
117
+ if (video_stream_start (this ->vdev , VIDEO_BUF_TYPE_OUTPUT )) {
118
118
Serial.println (" Failed to start capture" );
119
119
return false ;
120
120
}
@@ -127,7 +127,7 @@ bool Camera::grabFrame(FrameBuffer &fb, uint32_t timeout) {
127
127
return false ;
128
128
}
129
129
130
- if (video_dequeue (this ->vdev , VIDEO_EP_OUT, &fb.vbuf , K_MSEC (timeout))) {
130
+ if (video_dequeue (this ->vdev , &fb.vbuf , K_MSEC (timeout))) {
131
131
return false ;
132
132
}
133
133
@@ -154,17 +154,19 @@ bool Camera::releaseFrame(FrameBuffer &fb) {
154
154
return false ;
155
155
}
156
156
157
- if (video_enqueue (this ->vdev , VIDEO_EP_OUT, fb.vbuf )) {
157
+ if (video_enqueue (this ->vdev , fb.vbuf )) {
158
158
return false ;
159
159
}
160
160
161
161
return true ;
162
162
}
163
163
164
164
bool Camera::setVerticalFlip (bool flip_enable) {
165
- return video_set_ctrl (this ->vdev , VIDEO_CID_VFLIP, (void *) flip_enable) == 0 ;
165
+ struct video_control ctrl = {.id = VIDEO_CID_VFLIP, .val = flip_enable};
166
+ return video_set_ctrl (this ->vdev , &ctrl) == 0 ;
166
167
}
167
168
168
169
bool Camera::setHorizontalMirror (bool mirror_enable) {
169
- return video_set_ctrl (this ->vdev , VIDEO_CID_HFLIP, (void *) mirror_enable) == 0 ;
170
+ struct video_control ctrl = {.id = VIDEO_CID_HFLIP, .val = mirror_enable};
171
+ return video_set_ctrl (this ->vdev , &ctrl) == 0 ;
170
172
}
0 commit comments