std::string pcl::io::depth_sense::DepthSenseDeviceManager::captureDevice (DepthSenseGrabberImpl* grabber, size_t index) { boost::mutex::scoped_lock lock (mutex_); if (index >= context_.getDevices ().size ()) THROW_IO_EXCEPTION ("device with index %i is not connected", index + 1); if (isCaptured (context_.getDevices ().at (index).getSerialNumber ())) THROW_IO_EXCEPTION ("device with index %i is captured by another grabber", index); return (captureDevice (grabber, context_.getDevices ().at (index))); }
CapturePlugin::CaptureDeviceVector CapturePluginBlackMagic::enumerateDevices() { CaptureDeviceVector devices; //if(deckLinkIterator!=NULL) //{ CaptureDevice captureDevice(mCaptureType, "input0", "description_for_input0"); devices.push_back(captureDevice); //} return devices; }
std::string pcl::io::depth_sense::DepthSenseDeviceManager::captureDevice (DepthSenseGrabberImpl* grabber) { boost::mutex::scoped_lock lock (mutex_); std::vector<DepthSense::Device> devices = context_.getDevices (); if (devices.size () == 0) THROW_IO_EXCEPTION ("no connected devices"); for (size_t i = 0; i < devices.size (); ++i) if (!isCaptured (devices[i].getSerialNumber ())) return (captureDevice (grabber, devices[i])); THROW_IO_EXCEPTION ("all connected devices are captured by other grabbers"); return (""); // never reached, needed just to silence -Wreturn-type warning }
void V4LConfigurationEngine::configurationQuery(struct v4l2_format config) { if (_deviceName.isEmpty()) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qDebug() << "[V4L_CONFIGURATION_ENGINE] - configurationQuery() - Launching Settings Panel"; #endif //_DEBUG_CONFIGURATION_OBJECTS _settingsDialog->show(); return; } QFile captureDevice(_deviceName); if (!captureDevice.exists()) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - configurationQuery() - Invalid device " << captureDevice.fileName(); #endif //_DEBUG_CONFIGURATION_OBJECTS _deviceName.clear(); _settingsDialog->show(); return; } if (!captureDevice.open(QIODevice::ReadWrite)) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - configurationQuery() - Unable to open device " << captureDevice.fileName(); #endif //_DEBUG_CONFIGURATION_OBJECTS _deviceName.clear(); _settingsDialog->show(); return; } if (V4LSettings::qioctl(captureDevice.handle(), VIDIOC_TRY_FMT, &config, "V4LConfigurationEngine::configurationQuery()") != 0) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - configurationQuery() - Invalid Configuration "; #endif //_DEBUG_CONFIGURATION_OBJECTS _settingsDialog->show(); captureDevice.close(); return; } if (V4LSettings::qioctl(captureDevice.handle(), VIDIOC_S_FMT, &config, "V4LConfigurationEngine::configurationQuery();") != 0) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - configurationQuery() - Unable to set selected framesize" \ << config.fmt.pix.width << "x" << config.fmt.pix.height; #endif //_DEBUG_CONFIGURATION_OBJECTS } if (V4LSettings::qioctl(captureDevice.handle(), VIDIOC_G_FMT, &_stored_configuration, "V4LConfigurationEngine::configurationQuery();") != 0) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning("[V4L_CONFIGURATION_ENGINE] - configurationQuery() - Unable to get current Configuration"); #endif //_DEBUG_CONFIGURATION_OBJECTS } captureDevice.close(); emit availableConfiguration(); }
std::string pcl::io::depth_sense::DepthSenseDeviceManager::captureDevice (DepthSenseGrabberImpl* grabber, const std::string& sn) { boost::mutex::scoped_lock lock (mutex_); std::vector<DepthSense::Device> devices = context_.getDevices (); for (size_t i = 0; i < devices.size (); ++i) { if (devices[i].getSerialNumber () == sn) { if (isCaptured (sn)) THROW_IO_EXCEPTION ("device with serial number %s is captured by another grabber", sn.c_str ()); return (captureDevice (grabber, devices[i])); } } THROW_IO_EXCEPTION ("device with serial number %s is not connected", sn.c_str ()); return (""); // never reached, needed just to silence -Wreturn-type warning }
struct v4l2_format V4LConfigurationEngine::encodeConfigurationStringList(QStringList sConfig, v4l2_format old_config) { QRegExp resRegExp("\\d+x\\d+"); struct v4l2_format config, tmpConfig; CLEAR(config); if (sConfig.count() < 2){ #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - encodeConfigurationStringList() - Too few arguments"; #endif //_DEBUG_CONFIGURATION_OBJECTS return old_config; } QFile captureDevice(sConfig.at(0)); if (!captureDevice.exists()) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - encodeConfigurationStringList() - Invalid device " << captureDevice.fileName(); #endif //_DEBUG_CONFIGURATION_OBJECTS return old_config; } if (!captureDevice.open(QIODevice::ReadWrite)) { #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - encodeConfigurationStringList() - Unable to open device" << captureDevice.fileName(); #endif //_DEBUG_CONFIGURATION_OBJECTS return old_config; } config = old_config; for (quint8 i = 1; i < sConfig.count(); i++) { if (resRegExp.exactMatch(sConfig.at(i))) { tmpConfig = config; tmpConfig.fmt.pix.width = sConfig.at(i).toLower().split(QChar('x')).at(0).toUInt(); tmpConfig.fmt.pix.height = sConfig.at(i).toLower().split(QChar('x')).at(1).toUInt(); if (V4LSettings::qioctl(captureDevice.handle(), VIDIOC_TRY_FMT, &tmpConfig, "V4LConfigurationEngine::encodeConfigurationStringList()") != 0){ #ifdef _DEBUG_CONFIGURATION_OBJECTS qWarning() << "[V4L_CONFIGURATION_ENGINE] - encodeConfigurationStringList() - Invalid or unsupported frame Size"; #endif //_DEBUG_CONFIGURATION_OBJECTS } else config = tmpConfig; } } captureDevice.close(); return config; }