public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* A question about VIDIOC_DQBUF
@ 2008-07-08 20:18 Andrea
  2008-07-08 22:14 ` Andrea
       [not found] ` <c8b4dbe10807090704t4e98b8cu253fab39a9dd81d@mail.gmail.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Andrea @ 2008-07-08 20:18 UTC (permalink / raw)
  To: video4linux-list

Hi,

I would like to understand better the way VIDIOC_DQBUF works.

I've read the documentation at
http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec/r8849.htm

and some tutorial at
http://lwn.net/Articles/240667/

I'm trying to check the implementation of pwc of the 2 ioctl VIDIOC_DQBUF and VIDIOC_QBUF.

Is the following correct?

- First, an application queues a buffer, then it dequeues the buffer.
- Then again, a buffer is queued and then dequeued.
- Dequeuing a buffer blocks is the buffer is not ready (unless device opened with O_NONBLOCK).
- Trying to dequeue a buffer without queuing it first is an error, and the ioctl VIDIOC_DQBUF should 
return -EINVAL.

<- end of question ->

Now, about pwc: (if the above is correct).

1) VIDIOC_DQBUF blocks always until a buffer is ready, regardless of O_NONBLOCK.
2) VIDIOC_DQBUF does not check if a buffer has been previously queued. Moreover VIDIOC_QBUF is 
almost a no-op. It has no way to check if a buffer has been queued before VIDIOC_DQBUF.

If I have understood correctly (very unlikely), this is the reason why mplayer hangs while stopping 
the stream with pwc:

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

This code should eventually return -EINVAL, while pwc just blocks waiting for the next buffer (which 
never arrives because VIDIOC_STREAMOFF has been called).

I've read that video-buf should simplify the handling of buffers. Should I try it?

Andrea

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-07-11 20:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 20:18 A question about VIDIOC_DQBUF Andrea
2008-07-08 22:14 ` Andrea
2008-07-10 21:02   ` Andrea
2008-07-11  7:31     ` Jean-Francois Moine
2008-07-11 20:03       ` Andrea
     [not found] ` <c8b4dbe10807090704t4e98b8cu253fab39a9dd81d@mail.gmail.com>
2008-07-11 19:17   ` Andrea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox