Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mohamed Emad
VLC
Commits
630c2645
Commit
630c2645
authored
13 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
v4l2: remove useless switch(), cosmetic, no functional changes
parent
44b34340
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/access/v4l2/video.c
+25
-35
25 additions, 35 deletions
modules/access/v4l2/video.c
with
25 additions
and
35 deletions
modules/access/v4l2/video.c
+
25
−
35
View file @
630c2645
...
...
@@ -763,57 +763,47 @@ int SetupInput (vlc_object_t *obj, int fd)
/*****************************************************************************
* 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 */
switch
(
p_sys
->
io
)
/*
Wait for next f
rame */
if
(
v4l2_ioctl
(
sys
->
i_fd
,
VIDIOC_DQBUF
,
&
buf
)
<
0
)
{
case
IO_METHOD_MMAP
:
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
)
{
switch
(
errno
)
{
case
EAGAIN
:
return
NULL
;
case
EIO
:
/* Could ignore EIO, see spec. */
/* fall through */
default:
msg_Err
(
p_
demux
,
"
Failed to wait (VIDIOC_DQBUF)"
);
msg_Err
(
demux
,
"
dequeue error: %m"
);
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
(
!
p_block
)
return
NULL
;
if
(
buf
.
index
>=
sys
->
i_nbuffers
)
{
msg_Err
(
demux
,
"Failed capturing new frame as i>=nbuffers"
);
return
NULL
;
}
/* Unlock */
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
{
msg_Err
(
p_demux
,
"Failed to unlock (VIDIOC_QBUF)"
);
block_Release
(
p_block
);
return
NULL
;
}
block_t
*
block
=
ProcessVideoFrame
(
demux
,
sys
->
p_buffers
[
buf
.
index
].
start
,
buf
.
bytesused
);
if
(
block
==
NULL
)
return
NULL
;
break
;
default:
assert
(
0
);
/* Unlock */
if
(
v4l2_ioctl
(
sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
{
msg_Err
(
demux
,
"queue error: %m"
);
block_Release
(
block
);
return
NULL
;
}
return
p_
block
;
return
block
;
}
/*****************************************************************************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment