checking if buffer filled and dequeuing, blocking forever with only 1 queued
git-svn-id: svn://anubis/misc/WebcamTracker@123 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
5fa97bb196
commit
5a72b568b9
@ -110,6 +110,42 @@ WebcamTracker::WebcamTracker(const char * device)
|
||||
cerr << " (EINVAL)";
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
struct v4l2_buffer querybuf;
|
||||
querybuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
querybuf.index = 0;
|
||||
ret = ioctl(m_fd, VIDIOC_QUERYBUF, &querybuf);
|
||||
if (ret != 0)
|
||||
{
|
||||
cerr << "VIDIOC_QUERYBUF ioctl failed: returned " << ret
|
||||
<< ", errno: " << errno;
|
||||
if (errno == EINVAL)
|
||||
cerr << " (EINVAL)";
|
||||
cerr << endl;
|
||||
}
|
||||
if (querybuf.flags & V4L2_BUF_FLAG_DONE)
|
||||
{
|
||||
cout << "buf done" << endl;
|
||||
}
|
||||
|
||||
v4l2_buffer dqbuf;
|
||||
dqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
dqbuf.memory = V4L2_MEMORY_MMAP;
|
||||
ret = ioctl(m_fd, VIDIOC_DQBUF, &dqbuf);
|
||||
if (ret != 0)
|
||||
{
|
||||
cerr << "VIDIOC_DQBUF failed! errno = " << errno;
|
||||
if (errno == EAGAIN)
|
||||
cerr << " (EAGAIN)";
|
||||
if (errno == EINVAL)
|
||||
cerr << " (EINVAL)";
|
||||
if (errno == ENOMEM)
|
||||
cerr << " (ENOMEM)";
|
||||
if (errno == EIO)
|
||||
cerr << " (EIO)";
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user