Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
688b4d9d
Commit
688b4d9d
authored
Mar 23, 2016
by
Lucas Solomon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return 0 from VideoCapture::read() when cannot connect to camera
parent
fd1b66b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
+19
-10
cap_libv4l.cpp
modules/videoio/src/cap_libv4l.cpp
+9
-5
cap_v4l.cpp
modules/videoio/src/cap_v4l.cpp
+10
-5
No files found.
modules/videoio/src/cap_libv4l.cpp
View file @
688b4d9d
...
...
@@ -1113,7 +1113,7 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
default:
/* display the error and stop processing */
perror
(
"VIDIOC_DQBUF"
);
return
1
;
return
-
1
;
}
}
...
...
@@ -1141,7 +1141,7 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
return
1
;
}
static
void
mainloop_v4l2
(
CvCaptureCAM_V4L
*
capture
)
{
static
int
mainloop_v4l2
(
CvCaptureCAM_V4L
*
capture
)
{
unsigned
int
count
;
count
=
1
;
...
...
@@ -1175,10 +1175,14 @@ static void mainloop_v4l2(CvCaptureCAM_V4L* capture) {
break
;
}
if
(
read_frame_v4l2
(
capture
))
break
;
int
returnCode
=
read_frame_v4l2
(
capture
);
if
(
returnCode
==
-
1
)
return
-
1
;
if
(
returnCode
==
1
)
return
0
;
}
}
return
0
;
}
static
int
icvGrabFrameCAM_V4L
(
CvCaptureCAM_V4L
*
capture
)
{
...
...
@@ -1246,7 +1250,7 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
if
(
capture
->
is_v4l2_device
==
1
)
{
mainloop_v4l2
(
capture
)
;
if
(
mainloop_v4l2
(
capture
)
==
-
1
)
return
0
;
}
else
{
...
...
modules/videoio/src/cap_v4l.cpp
View file @
688b4d9d
...
...
@@ -830,7 +830,7 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
default
:
/* display the error and stop processing */
perror
(
"VIDIOC_DQBUF"
);
return
1
;
return
-
1
;
}
}
...
...
@@ -852,7 +852,7 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
return
1
;
}
static
void
mainloop_v4l2
(
CvCaptureCAM_V4L
*
capture
)
{
static
int
mainloop_v4l2
(
CvCaptureCAM_V4L
*
capture
)
{
unsigned
int
count
;
count
=
1
;
...
...
@@ -886,10 +886,14 @@ static void mainloop_v4l2(CvCaptureCAM_V4L* capture) {
break
;
}
if
(
read_frame_v4l2
(
capture
))
int
returnCode
=
read_frame_v4l2
(
capture
);
if
(
returnCode
==
-
1
)
return
-
1
;
if
(
returnCode
==
1
)
break
;
}
}
return
0
;
}
static
bool
icvGrabFrameCAM_V4L
(
CvCaptureCAM_V4L
*
capture
)
{
...
...
@@ -931,14 +935,15 @@ static bool icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
#if defined(V4L_ABORT_BADJPEG)
// skip first frame. it is often bad -- this is unnotied in traditional apps,
// but could be fatal if bad jpeg is enabled
mainloop_v4l2
(
capture
);
if
(
mainloop_v4l2
(
capture
)
==
-
1
)
return
false
;
#endif
/* preparation is ok */
capture
->
FirstCapture
=
0
;
}
mainloop_v4l2
(
capture
)
;
if
(
mainloop_v4l2
(
capture
)
==
-
1
)
return
false
;
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment