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
1deeca98
Commit
1deeca98
authored
Aug 21, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12262 from sivaraam:v4l2_mainloop
parents
6acabd1f
a527e8cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
31 deletions
+25
-31
cap_v4l.cpp
modules/videoio/src/cap_v4l.cpp
+25
-31
No files found.
modules/videoio/src/cap_v4l.cpp
View file @
1deeca98
...
...
@@ -857,45 +857,39 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
}
static
int
mainloop_v4l2
(
CvCaptureCAM_V4L
*
capture
)
{
unsigned
int
count
;
for
(;;)
{
fd_set
fds
;
struct
timeval
tv
;
int
r
;
count
=
1
;
FD_ZERO
(
&
fds
);
FD_SET
(
capture
->
deviceHandle
,
&
fds
);
while
(
count
--
>
0
)
{
for
(;;)
{
fd_set
fds
;
struct
timeval
tv
;
int
r
;
/* Timeout. */
tv
.
tv_sec
=
10
;
tv
.
tv_usec
=
0
;
FD_ZERO
(
&
fds
);
FD_SET
(
capture
->
deviceHandle
,
&
fds
);
r
=
select
(
capture
->
deviceHandle
+
1
,
&
fds
,
NULL
,
NULL
,
&
tv
);
/* Timeout. */
tv
.
tv_sec
=
10
;
tv
.
tv_usec
=
0
;
if
(
-
1
==
r
)
{
if
(
EINTR
==
errno
)
continue
;
r
=
select
(
capture
->
deviceHandle
+
1
,
&
fds
,
NULL
,
NULL
,
&
tv
);
if
(
-
1
==
r
)
{
if
(
EINTR
==
errno
)
continue
;
perror
(
"select"
);
}
perror
(
"select"
);
}
if
(
0
==
r
)
{
fprintf
(
stderr
,
"select timeout
\n
"
);
if
(
0
==
r
)
{
fprintf
(
stderr
,
"select timeout
\n
"
);
/* end the infinite loop */
break
;
}
int
returnCode
=
read_frame_v4l2
(
capture
);
if
(
returnCode
==
-
1
)
return
-
1
;
if
(
returnCode
==
1
)
return
1
;
/* end the infinite loop */
break
;
}
int
returnCode
=
read_frame_v4l2
(
capture
);
if
(
returnCode
==
-
1
)
return
-
1
;
if
(
returnCode
==
1
)
return
1
;
}
return
0
;
}
...
...
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