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
13905341
Commit
13905341
authored
Dec 08, 2009
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: return NULL iso 0 for pointers
parent
08baed9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
modules/access/v4l2.c
modules/access/v4l2.c
+16
-16
No files found.
modules/access/v4l2.c
View file @
13905341
...
@@ -1301,7 +1301,7 @@ static block_t* GrabVideo( demux_t *p_demux )
...
@@ -1301,7 +1301,7 @@ static block_t* GrabVideo( demux_t *p_demux )
mtime_t
i_dur
=
(
mtime_t
)((
double
)
1000000
/
(
double
)
p_sys
->
f_fps
);
mtime_t
i_dur
=
(
mtime_t
)((
double
)
1000000
/
(
double
)
p_sys
->
f_fps
);
/* Did we wait long enough ? (frame rate reduction) */
/* Did we wait long enough ? (frame rate reduction) */
if
(
p_sys
->
i_video_pts
+
i_dur
>
mdate
()
)
return
0
;
if
(
p_sys
->
i_video_pts
+
i_dur
>
mdate
()
)
return
NULL
;
}
}
/* Grab Video Frame */
/* Grab Video Frame */
...
@@ -1314,18 +1314,18 @@ static block_t* GrabVideo( demux_t *p_demux )
...
@@ -1314,18 +1314,18 @@ static block_t* GrabVideo( demux_t *p_demux )
switch
(
errno
)
switch
(
errno
)
{
{
case
EAGAIN
:
case
EAGAIN
:
return
0
;
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 read frame"
);
msg_Err
(
p_demux
,
"Failed to read frame"
);
return
0
;
return
NULL
;
}
}
}
}
p_block
=
ProcessVideoFrame
(
p_demux
,
(
uint8_t
*
)
p_sys
->
p_buffers
[
0
].
start
,
i_ret
);
p_block
=
ProcessVideoFrame
(
p_demux
,
(
uint8_t
*
)
p_sys
->
p_buffers
[
0
].
start
,
i_ret
);
if
(
!
p_block
)
return
0
;
if
(
!
p_block
)
return
NULL
;
break
;
break
;
...
@@ -1340,19 +1340,19 @@ static block_t* GrabVideo( demux_t *p_demux )
...
@@ -1340,19 +1340,19 @@ static block_t* GrabVideo( demux_t *p_demux )
switch
(
errno
)
switch
(
errno
)
{
{
case
EAGAIN
:
case
EAGAIN
:
return
0
;
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
(
p_demux
,
"Failed to wait (VIDIOC_DQBUF)"
);
return
0
;
return
NULL
;
}
}
}
}
if
(
buf
.
index
>=
p_sys
->
i_nbuffers
)
{
if
(
buf
.
index
>=
p_sys
->
i_nbuffers
)
{
msg_Err
(
p_demux
,
"Failed capturing new frame as i>=nbuffers"
);
msg_Err
(
p_demux
,
"Failed capturing new frame as i>=nbuffers"
);
return
0
;
return
NULL
;
}
}
// msg_Err( p_demux, "New frame has size: %d (%d) %d",
// msg_Err( p_demux, "New frame has size: %d (%d) %d",
...
@@ -1363,14 +1363,14 @@ static block_t* GrabVideo( demux_t *p_demux )
...
@@ -1363,14 +1363,14 @@ static block_t* GrabVideo( demux_t *p_demux )
#else
#else
p_sys
->
i_pitch
*
p_sys
->
i_height
);
p_sys
->
i_pitch
*
p_sys
->
i_height
);
#endif
#endif
if
(
!
p_block
)
return
0
;
if
(
!
p_block
)
return
NULL
;
/* Unlock */
/* Unlock */
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
{
{
msg_Err
(
p_demux
,
"Failed to unlock (VIDIOC_QBUF)"
);
msg_Err
(
p_demux
,
"Failed to unlock (VIDIOC_QBUF)"
);
block_Release
(
p_block
);
block_Release
(
p_block
);
return
0
;
return
NULL
;
}
}
break
;
break
;
...
@@ -1386,13 +1386,13 @@ static block_t* GrabVideo( demux_t *p_demux )
...
@@ -1386,13 +1386,13 @@ static block_t* GrabVideo( demux_t *p_demux )
switch
(
errno
)
switch
(
errno
)
{
{
case
EAGAIN
:
case
EAGAIN
:
return
0
;
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
(
p_demux
,
"Failed to wait (VIDIOC_DQBUF)"
);
return
0
;
return
NULL
;
}
}
}
}
...
@@ -1407,18 +1407,18 @@ static block_t* GrabVideo( demux_t *p_demux )
...
@@ -1407,18 +1407,18 @@ static block_t* GrabVideo( demux_t *p_demux )
if
(
i
>=
p_sys
->
i_nbuffers
)
if
(
i
>=
p_sys
->
i_nbuffers
)
{
{
msg_Err
(
p_demux
,
"Failed capturing new frame as i>=nbuffers"
);
msg_Err
(
p_demux
,
"Failed capturing new frame as i>=nbuffers"
);
return
0
;
return
NULL
;
}
}
p_block
=
ProcessVideoFrame
(
p_demux
,
(
uint8_t
*
)
buf
.
m
.
userptr
,
buf
.
bytesused
);
p_block
=
ProcessVideoFrame
(
p_demux
,
(
uint8_t
*
)
buf
.
m
.
userptr
,
buf
.
bytesused
);
if
(
!
p_block
)
return
0
;
if
(
!
p_block
)
return
NULL
;
/* Unlock */
/* Unlock */
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
if
(
v4l2_ioctl
(
p_sys
->
i_fd
,
VIDIOC_QBUF
,
&
buf
)
<
0
)
{
{
msg_Err
(
p_demux
,
"Failed to unlock (VIDIOC_QBUF)"
);
msg_Err
(
p_demux
,
"Failed to unlock (VIDIOC_QBUF)"
);
block_Release
(
p_block
);
block_Release
(
p_block
);
return
0
;
return
NULL
;
}
}
break
;
break
;
...
@@ -1439,13 +1439,13 @@ static block_t* ProcessVideoFrame( demux_t *p_demux, uint8_t *p_frame, size_t i_
...
@@ -1439,13 +1439,13 @@ static block_t* ProcessVideoFrame( demux_t *p_demux, uint8_t *p_frame, size_t i_
{
{
block_t
*
p_block
;
block_t
*
p_block
;
if
(
!
p_frame
)
return
0
;
if
(
!
p_frame
)
return
NULL
;
/* New block */
/* New block */
if
(
!
(
p_block
=
block_New
(
p_demux
,
i_size
)
)
)
if
(
!
(
p_block
=
block_New
(
p_demux
,
i_size
)
)
)
{
{
msg_Warn
(
p_demux
,
"Cannot get new block"
);
msg_Warn
(
p_demux
,
"Cannot get new block"
);
return
0
;
return
NULL
;
}
}
/* Copy frame */
/* Copy frame */
...
...
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