[MPlayer-users] MPlayer hangs after playing video from webcam (pwc)

Andrea mariofutire at googlemail.com
Sat Jul 5 12:46:55 CEST 2008


Hi,

I'm trying to play video from my webcam Logitech QuickCam 4000 Pro USB.
MPlayer is the latest svn (27205), and the kernel driver (PWC) comes from 2.6.25.10.

This is the command line

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

When I stop the player with Q, mplayer hangs and I have to press Crtl-C to stop it.
No messages are written to the screen.
The same happened a while ago, and I think the "culprit" is this code in stream/tvi_v4l2.c (around 
line 1132, in funtion "uninit"):

         /* 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));

The ioctl call VIDIOC_DQBUF never returns (it is called only once).
Reading the document
http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec/r8849.htmation

VIDIOC_DQBUF should block if there are no buffers to unqueue, unless the device is opened with 
O_NONBLOCK.

Here the device is NOT opened with O_NONBLOCK (function "init", same file, line 1198), so it blocks.

I cannot figure out how

         while (!ioctl(priv->video_fd, VIDIOC_DQBUF, &buf));

is supposed to work.
When all buffer have been unqueued, the call will eventually block.

I am trying to understand if the problem is in mplayer or pwc, and I'd like to understand how 
mplayer is using the v4l2 call.

Thanks

Andrea




More information about the MPlayer-users mailing list