Logo Search packages:      
Sourcecode: camstream version File versions  Download package

int CVideoDevice::Open ( int  bufs = 1  ) 

Open the device, even multiple times.

bufs Number of image buffers; -1 use device maximum
0 upon success, otherwise -errno .
This function increments the usage counter of the device; the first time this function is called the device is really opened and initialized; all subsequent calls will return 0. You will need as many calls to Close() as you placed to Open() to get the device really closed.

Open() will also start the automatic loading of images. In case the device supports select() a QSocketNotifier is installed, otherwise a timer is used.

For double buffering purposes, use a buf value > 1. The buf parameter can only be set at the first Open(); subsequent calls will have no effect on the number of buffers. When bufs < 0, the device will be queried for the maximum number of buffers and that amount will be used.

Definition at line 570 of file VideoDevice.cc.

References Init().

   if (Opened++) {
     qDebug("CVideoDevice::Open() again (count = %d).", Opened);
     return 0;
   if (CamFD >= 0) {
     qWarning("Warning: VideoDevice already opened ?!?!");
     return 0;
   CamFD = ::open(NodeName, O_RDONLY);
   if (CamFD < 0) {
     Opened = 0;
     return -errno;

   Buffers = bufs;

   /* Determine if we can use select() on this cam; still only the 
      Philips cams seem to have this.
   UseSelect = FALSE;
   if (IntfName.find("Philips") == 0) {
     qDebug("Using select() call.");
     UseSelect = TRUE;
   return 0;

Generated by  Doxygen 1.6.0   Back to index