Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
630c2645
Commit
630c2645
authored
Apr 04, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: remove useless switch(), cosmetic, no functional changes
parent
44b34340
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
35 deletions
+25
-35
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+25
-35
No files found.
modules/access/v4l2/video.c
View file @
630c2645
...
@@ -763,57 +763,47 @@ int SetupInput (vlc_object_t *obj, int fd)
...
@@ -763,57 +763,47 @@ int SetupInput (vlc_object_t *obj, int fd)
/*****************************************************************************
/*****************************************************************************
* GrabVideo: Grab a video frame
* GrabVideo: Grab a video frame
*****************************************************************************/
*****************************************************************************/
block_t
*
GrabVideo
(
vlc_object_t
*
p_demux
,
demux_sys_t
*
p_sys
)
block_t
*
GrabVideo
(
vlc_object_t
*
demux
,
demux_sys_t
*
sys
)
{
{
block_t
*
p_block
;
struct
v4l2_buffer
buf
=
{
struct
v4l2_buffer
buf
;
.
type
=
V4L2_BUF_TYPE_VIDEO_CAPTURE
,
.
memory
=
V4L2_MEMORY_MMAP
,
};
/*
Grab Video F
rame */
/*
Wait for next f
rame */
switch
(
p_sys
->
io
)
if
(
v4l2_ioctl
(
sys
->
i_fd
,
VIDIOC_DQBUF
,
&
buf
)
<
0
)
{
{
case
IO_METHOD_MMAP
:
switch
(
errno
)
memset
(
&
buf
,
0
,
sizeof
(
buf
)
);
buf
.
type
=
V4L2_BUF_TYPE_VIDEO_CAPTURE
;
buf
.
memory
=
V4L2_MEMORY_MMAP
;
/* Wait for next frame */
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_DQBUF
,
&
buf
)
<
0
)
{
{
switch
(
errno
)
{
case
EAGAIN
:
case
EAGAIN
:
return
NULL
;
return
NULL
;
case
EIO
:
case
EIO
:
/* Could ignore EIO, see spec. */
/* Could ignore EIO, see spec. */
/* fall through */
/* fall through */
default:
default:
msg_Err
(
p_demux
,
"Failed to wait (VIDIOC_DQBUF)"
);
msg_Err
(
demux
,
"dequeue error: %m"
);
return
NULL
;
return
NULL
;
}
}
if
(
buf
.
index
>=
p_sys
->
i_nbuffers
)
{
msg_Err
(
p_demux
,
"Failed capturing new frame as i>=nbuffers"
);
return
NULL
;
}
}
}
p_block
=
ProcessVideoFrame
(
p_demux
,
p_sys
->
p_buffers
[
buf
.
index
].
start
,
buf
.
bytesused
);
if
(
buf
.
index
>=
sys
->
i_nbuffers
)
{
if
(
!
p_block
)
msg_Err
(
demux
,
"Failed capturing new frame as i>=nbuffers"
);
return
NULL
;
return
NULL
;
}
/* Unlock */
block_t
*
block
=
ProcessVideoFrame
(
demux
,
sys
->
p_buffers
[
buf
.
index
].
start
,
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
buf
.
bytesused
);
{
if
(
block
==
NULL
)
msg_Err
(
p_demux
,
"Failed to unlock (VIDIOC_QBUF)"
);
return
NULL
;
block_Release
(
p_block
);
return
NULL
;
}
break
;
/* Unlock */
default:
if
(
v4l2_ioctl
(
sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
assert
(
0
);
{
msg_Err
(
demux
,
"queue error: %m"
);
block_Release
(
block
);
return
NULL
;
}
}
return
p_
block
;
return
block
;
}
}
/*****************************************************************************
/*****************************************************************************
...
...
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