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

CVideoDevice::CVideoDevice ( const QString &  node_name  ) 

Parameters:
node_name The /dev device name of the video device
The constructor will do some basic checks to see if this is a valid device. If yes, IsValid() will return TRUE, otherwise FALSE.

Definition at line 52 of file VideoDevice.cc.

{
   struct video_capability vcap;
   int i;

   Opened = 0;
   Buffers = 0;
   FrameRate = 10;
   PalRGB = 0;
   PalYUV = 0;
   Capturing = 0;
   rgb_vid_buffer = yuv_vid_buffer = vid_io_buffer = NULL;
   vid_io_buffer_size = vid_io_image_size = 0;
   NodeName = node_name;
   pImageSocket = NULL;
   pImageTimer = NULL;
   validated = FALSE;
   CurrentVideoInput = -1;
   CurrentAudioInput = -1;
   memset(&VMBuf, 0, sizeof(VMBuf));
   max_w = 0;
   max_h = 0;
   min_w = 0;
   min_h = 0;

   VideoInputs.setAutoDelete(TRUE);
   AudioInputs.setAutoDelete(TRUE);
   
   RGB.setAutoDelete(TRUE);
   Y.setAutoDelete(TRUE);
   U.setAutoDelete(TRUE);
   V.setAutoDelete(TRUE);
   
   for (i = 0; i < 256; i++)
      GrayScale[i] = qRgb(i, i, i);
   pNullImage = new QImage();
   
   // Do a small test
   CamFD = ::open((const char *)node_name, O_RDONLY);
   if (CamFD >= 0) {
     if (ioctl(CamFD, VIDIOCGCAP, &vcap) < 0) {
       qDebug("CVideoDevice::CVideoDevice() could not query capabilities; is this really a video device?");
     }
     else {
       validated = TRUE;
       max_w = vcap.maxwidth;
       max_h = vcap.maxheight;
       min_w = vcap.minwidth;
       min_h = vcap.minheight;
       vcap.name[31] = '\0';
       IntfName = vcap.name;

       /* Query video inputs... */
       VideoInputs.clear();
       if (vcap.channels > 0) {
         VideoInputs.resize(vcap.channels);
         for (i = 0; i < vcap.channels; i++)
            VideoInputs.insert(i, new CVideoDeviceInput(this, i));
       }
       /* ...and audio inputs */
       AudioInputs.clear();
       if (vcap.audios > 0) {
         AudioInputs.resize(vcap.audios);
         for (i = 0; i < vcap.audios; i++)
            AudioInputs.insert(i, new CVideoAudioInput(this, i));
       }
     }
     ::close(CamFD);
   }
   else 
     if (errno == EBUSY)
       validated = TRUE;
   CamFD = -1;
}


Generated by  Doxygen 1.6.0   Back to index