Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
dde47d92
Commit
dde47d92
authored
Apr 11, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: GrabVideo() cleanup
parent
7dc94047
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
12 deletions
+8
-12
modules/access/v4l2/access.c
modules/access/v4l2/access.c
+1
-1
modules/access/v4l2/demux.c
modules/access/v4l2/demux.c
+1
-1
modules/access/v4l2/v4l2.h
modules/access/v4l2/v4l2.h
+1
-1
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+5
-9
No files found.
modules/access/v4l2/access.c
View file @
dde47d92
...
...
@@ -231,7 +231,7 @@ static block_t *AccessRead( access_t *access )
if
(
poll
(
&
fd
,
1
,
500
)
<=
0
)
return
NULL
;
block_t
*
block
=
GrabVideo
(
VLC_OBJECT
(
access
),
sys
);
block_t
*
block
=
GrabVideo
(
VLC_OBJECT
(
access
),
sys
->
i_fd
,
sys
->
bufv
);
if
(
block
!=
NULL
)
{
block
->
i_pts
=
block
->
i_dts
=
mdate
();
...
...
modules/access/v4l2/demux.c
View file @
dde47d92
...
...
@@ -537,7 +537,7 @@ static void *StreamThread (void *data)
}
int
canc
=
vlc_savecancel
();
block_t
*
block
=
GrabVideo
(
VLC_OBJECT
(
demux
),
sys
);
block_t
*
block
=
GrabVideo
(
VLC_OBJECT
(
demux
),
fd
,
sys
->
bufv
);
if
(
block
!=
NULL
)
{
block
->
i_pts
=
block
->
i_dts
=
mdate
();
...
...
modules/access/v4l2/v4l2.h
View file @
dde47d92
...
...
@@ -111,7 +111,7 @@ int SetupFormat (vlc_object_t *, int, uint32_t,
#define SetupFormat(o,fd,fcc,fmt,p) \
SetupFormat(VLC_OBJECT(o),fd,fcc,fmt,p)
struct
buffer_t
*
InitMmap
(
vlc_object_t
*
,
int
,
uint32_t
*
);
block_t
*
GrabVideo
(
vlc_object_t
*
,
demux_sys
_t
*
);
block_t
*
GrabVideo
(
vlc_object_t
*
,
int
,
const
struct
buffer
_t
*
);
/* demux.c */
int
DemuxOpen
(
vlc_object_t
*
);
...
...
modules/access/v4l2/video.c
View file @
dde47d92
...
...
@@ -978,7 +978,8 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
/*****************************************************************************
* GrabVideo: Grab a video frame
*****************************************************************************/
block_t
*
GrabVideo
(
vlc_object_t
*
demux
,
demux_sys_t
*
sys
)
block_t
*
GrabVideo
(
vlc_object_t
*
demux
,
int
fd
,
const
struct
buffer_t
*
restrict
bufv
)
{
struct
v4l2_buffer
buf
=
{
.
type
=
V4L2_BUF_TYPE_VIDEO_CAPTURE
,
...
...
@@ -986,7 +987,7 @@ block_t* GrabVideo (vlc_object_t *demux, demux_sys_t *sys)
};
/* Wait for next frame */
if
(
v4l2_ioctl
(
sys
->
i_
fd
,
VIDIOC_DQBUF
,
&
buf
)
<
0
)
if
(
v4l2_ioctl
(
fd
,
VIDIOC_DQBUF
,
&
buf
)
<
0
)
{
switch
(
errno
)
{
...
...
@@ -1001,19 +1002,14 @@ block_t* GrabVideo (vlc_object_t *demux, demux_sys_t *sys)
}
}
if
(
buf
.
index
>=
sys
->
bufc
)
{
msg_Err
(
demux
,
"Failed capturing new frame as i>=nbuffers"
);
return
NULL
;
}
/* Copy frame */
block_t
*
block
=
block_Alloc
(
buf
.
bytesused
);
if
(
unlikely
(
block
==
NULL
))
return
NULL
;
memcpy
(
block
->
p_buffer
,
sys
->
bufv
[
buf
.
index
].
start
,
buf
.
bytesused
);
memcpy
(
block
->
p_buffer
,
bufv
[
buf
.
index
].
start
,
buf
.
bytesused
);
/* Unlock */
if
(
v4l2_ioctl
(
sys
->
i_
fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
if
(
v4l2_ioctl
(
fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
{
msg_Err
(
demux
,
"queue error: %m"
);
block_Release
(
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