[pwc] pwc, v4l2, VIDIOC_DQBUF and mplayer

Andrea mariofutire at googlemail.com
Sat Jul 5 00:17:07 CEST 2008


Hi,

I have a Logitech QuickCam 4000 Pro USB and I am trying to use mplayer to play the video.
This is the command I use

mplayer -tv width=640:height=480:driver=v4l2 -fps 15 tv://

But when I quit mplayer hangs in the following line, while shutting down the video

         /* unqueue all remaining buffers */
         memset(&buf,0,sizeof(buf));
         buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
         buf.memory = V4L2_MEMORY_MMAP;
         while (!ioctl(priv->video_fd, VIDIOC_DQBUF, &buf));

Which is more or less at line 1111 of stream/tvi_v4l2.c.

The problem is that the ioctl call VIDIOC_DQBUF never returns.
Reading the doc for VIDIOC_DQBUF
http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec/r8849.htm

The function should stop if there is no block to unqueue, unless it has been opened with O_NONBLOCK.
mplayer DOES NOT use O_NONBLOCK, so the call is allowed to block.

The problems are 2

1) I've tried to open with O_NONBLOCK and the ioctl blocks anyway.
pwc-v4l.c at line 1120 does not check for O_NONBLOCK.
Is this a bug?

2) should mplayer handle the situation in a different way? is there a way to check if there are 
queued blocks?

Andrea



More information about the pwc mailing list