//---------- void Camera::update() { if (!this->getInputPin<Item::Camera>()->isConnected()) { return; } if (this->parameters.reopnWhenNoNewFrames.enabled) { auto timeSinceLastFrame = chrono::high_resolution_clock::now() - this->lastCaptureTime.load(); auto timeout = chrono::duration<float, ratio<1, 1>>(this->parameters.reopnWhenNoNewFrames.timeout.get()); if (timeSinceLastFrame > timeout) { //then reopen the camera auto cameraNode = this->getInput<Item::Camera>(); cameraNode->getGrabber()->reopen(); } } if (this->parameters.rebootWhenNoNewFrames.enabled) { auto timeSinceLastFrame = chrono::high_resolution_clock::now() - this->lastCaptureTime.load(); auto timeout = chrono::duration<float, ratio<1, 1>>(this->parameters.rebootWhenNoNewFrames.timeout.get()); if (timeSinceLastFrame > timeout) { #ifdef TARGET_WIN32 system("shutdown /r /t 5"); #elif TARGET_OSX system("sudo reboot"); #endif } } }
//--------------------------------------------------------------------------- const ofPixels& ofVideoGrabber::getPixelsRef() const { return getGrabber()->getPixels(); }
//--------------------------------------------------------------------------- ofPixels & ofVideoGrabber::getPixels() { return getGrabber()->getPixels(); }