@@ -70,8 +70,8 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
7070 }
7171
7272 // 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)) {
7575 return false ;
7676 }
7777
@@ -96,7 +96,7 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
9696 .pitch = width * 2 ,
9797 };
9898
99- if (video_set_format (this ->vdev , VIDEO_EP_OUT, &fmt)) {
99+ if (video_set_format (this ->vdev , &fmt)) {
100100 Serial.println (" Failed to set video format" );
101101 return false ;
102102 }
@@ -110,11 +110,11 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
110110 Serial.println (" Failed to allocate video buffers" );
111111 return false ;
112112 }
113- video_enqueue (this ->vdev , VIDEO_EP_OUT, this ->vbuf [i]);
113+ video_enqueue (this ->vdev , this ->vbuf [i]);
114114 }
115115
116116 // Start video capture
117- if (video_stream_start (this ->vdev )) {
117+ if (video_stream_start (this ->vdev , VIDEO_BUF_TYPE_OUTPUT )) {
118118 Serial.println (" Failed to start capture" );
119119 return false ;
120120 }
@@ -127,7 +127,7 @@ bool Camera::grabFrame(FrameBuffer &fb, uint32_t timeout) {
127127 return false ;
128128 }
129129
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))) {
131131 return false ;
132132 }
133133
@@ -154,17 +154,19 @@ bool Camera::releaseFrame(FrameBuffer &fb) {
154154 return false ;
155155 }
156156
157- if (video_enqueue (this ->vdev , VIDEO_EP_OUT, fb.vbuf )) {
157+ if (video_enqueue (this ->vdev , fb.vbuf )) {
158158 return false ;
159159 }
160160
161161 return true ;
162162}
163163
164164bool 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 ;
166167}
167168
168169bool 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 ;
170172}
0 commit comments