Re: [libdc] DC1394_CAPTURE_POLICY_WAIT and removed camera
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: David M. <dcm@MIT.EDU> - 2008-10-11 18:54:54
|
On Fri, 2008-10-10 at 09:50 +0200, Philippe De Muyter wrote: > Hello list, > > I use dc1394_capture_dequeue(c, DC1394_CAPTURE_POLICY_WAIT, f) to grab > a video stream from an IIDC camera. When the camera is disconnected, > I would like dc1394_capture_dequeue to return immediately with an error > but it seems to remain blocked forever. > > Is there some way to force the desired behaviour, or is this a bug known > to have been fixed recently, or this a pending bug ? > We've talked about implementing detection of an unplugged camera, but right now libdc1394 has no provision for that. However, you can workaround this by using the select() statement. Get the capture file descriptor with dc1394_capture_get_fileno(). Then use select() with a timeout instead of dc1394_capture_dequeue(). Only call dc1394_capture_dequeue() after select() returns positively. If the timeout expires, you can be reasonably confident that the camera is unplugged (or something else has gone wrong). -David |