Example #1
0
QCamVesta::QCamVesta(const char * devpath):
   QCamV4L2(devpath,(ioNoBlock|ioUseSelect|haveBrightness|haveContrast|haveColor)) {
   SCmodCtrl_=NULL;
   exposureTimeLeft_=NULL;
   whiteBalanceMode_=-1;

   {
      /* sanity check */
      bool IsPhilips = false;
      struct pwc_probe probe;
      if (sscanf((char*)v4l2_cap_.card, "Philips %d webcam", &type_) == 1) {
         /* original phillips */
         IsPhilips = true;
      } else if (ioctl(device_, VIDIOCPWCPROBE, &probe) == 0) {
         /* an OEM clone ? */
         if (!strcmp((char*)v4l2_cap_.card,probe.name)) {
           IsPhilips = true;
           type_=probe.type;
         }
      }
      if (!IsPhilips) {
      QMessageBox::information(0,"Qastrocam-g2","QCamVesta::QCamVesta() called on a non Philips Webcam.\ndid you use QCamV4L::openBestDevice() to open your device?");
         cout << "QCamVesta::QCamVesta() called on a non Philips Webcam.\n"
              << "did you use QCamV4L::openBestDevice() to open your device?"
              << endl;
         exit(1);
      }
   }

   //initRemoteControl(remoteCTRL_);
   multiplicateur_=1;
   if (exposureTimeLeft_) exposureTimeLeft_->hide();
   skippedFrame_=0;
   liveWhiteBalance_=false /* set to true to show dynamicaly white balance
                              setting (slow) */;
   refreshGui_=true;
   haveLeds_= (type_ >= 730);
   setLed(0,255);
   setWhiteBalanceMode(PWC_WB_AUTO);
   getWhiteBalance();
   lastGain_=getGain();

   // read the window_ values
   // generic V4L don't do it anymore
   if(ioctl(device_,VIDIOCGWIN, &window_))
      perror("ioctl (VIDIOCGWIN)");
}
void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::ProcessingParameter parameter,
        const QVariant &value)
{
    switch (parameter) {
    case ContrastAdjustment:
        setColorBalanceValue("contrast", value.toReal());
        break;
    case BrightnessAdjustment:
        setColorBalanceValue("brightness", value.toReal());
        break;
    case SaturationAdjustment:
        setColorBalanceValue("saturation", value.toReal());
        break;
    case WhiteBalancePreset:
        setWhiteBalanceMode(value.value<QCameraImageProcessing::WhiteBalanceMode>());
        break;
    case QCameraImageProcessingControl::ColorFilter:
#ifdef HAVE_GST_PHOTOGRAPHY
        if (GstPhotography *photography = m_session->photography()) {
#if GST_CHECK_VERSION(1, 0, 0)
            gst_photography_set_color_tone_mode(photography, m_filterMap.value(
                        value.value<QCameraImageProcessing::ColorFilter>(),
                        GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL));
#else
            gst_photography_set_colour_tone_mode(photography, m_filterMap.value(
                        value.value<QCameraImageProcessing::ColorFilter>(),
                        GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL));
#endif
        }
#endif
        break;
    default:
        break;
    }

    updateColorBalanceValues();
}