Commit 630c2645 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

v4l2: remove useless switch(), cosmetic, no functional changes

parent 44b34340
...@@ -763,23 +763,17 @@ int SetupInput (vlc_object_t *obj, int fd) ...@@ -763,23 +763,17 @@ 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 Frame */ };
switch( p_sys->io )
{
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 */ /* Wait for next frame */
if (v4l2_ioctl( p_sys->i_fd, VIDIOC_DQBUF, &buf ) < 0 ) if (v4l2_ioctl (sys->i_fd, VIDIOC_DQBUF, &buf) < 0)
{ {
switch( errno ) switch (errno)
{ {
case EAGAIN: case EAGAIN:
return NULL; return NULL;
...@@ -787,33 +781,29 @@ block_t* GrabVideo( vlc_object_t *p_demux, demux_sys_t *p_sys ) ...@@ -787,33 +781,29 @@ block_t* GrabVideo( vlc_object_t *p_demux, demux_sys_t *p_sys )
/* 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 ) { if (buf.index >= sys->i_nbuffers) {
msg_Err( p_demux, "Failed capturing new frame as i>=nbuffers" ); msg_Err (demux, "Failed capturing new frame as i>=nbuffers");
return NULL; return NULL;
} }
p_block = ProcessVideoFrame( p_demux, p_sys->p_buffers[buf.index].start, buf.bytesused ); block_t *block = ProcessVideoFrame(demux, sys->p_buffers[buf.index].start,
if( !p_block ) buf.bytesused);
if (block == NULL)
return NULL; return NULL;
/* Unlock */ /* Unlock */
if( v4l2_ioctl( p_sys->i_fd, VIDIOC_QBUF, &buf ) < 0 ) if (v4l2_ioctl (sys->i_fd, VIDIOC_QBUF, &buf) < 0)
{ {
msg_Err( p_demux, "Failed to unlock (VIDIOC_QBUF)" ); msg_Err (demux, "queue error: %m");
block_Release( p_block ); block_Release (block);
return NULL; return NULL;
} }
return block;
break;
default:
assert(0);
}
return p_block;
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment