mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Rework log messages
Former-commit-id: eac93c0fd78fdf353e940d08df3cabf0b962a3e2
This commit is contained in:
		@@ -1 +1 @@
 | 
			
		||||
5e8ca7ba33eb38d828b50971ec94b045025caa78
 | 
			
		||||
a628a0f8dea4332995fe4f32860a114a9b48ea4b
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
e55dbd6444d070f519115e83e4fda96b6911e5db
 | 
			
		||||
dcef2212c5d493fed074dc5b1e222ad9cb6098e8
 | 
			
		||||
@@ -21,7 +21,7 @@ uint8_t BlackBorderDetector::calculateThreshold(double threshold)
 | 
			
		||||
 | 
			
		||||
	uint8_t blackborderThreshold = uint8_t(rgbThreshold);
 | 
			
		||||
 | 
			
		||||
	std::cout << "Black border threshold set to " << threshold << " (" << int(blackborderThreshold) << ")" << std::endl;
 | 
			
		||||
	std::cout << "BLACKBORDER INFO: threshold set to " << threshold << " (" << int(blackborderThreshold) << ")" << std::endl;
 | 
			
		||||
 | 
			
		||||
	return blackborderThreshold;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ BlackBorderProcessor::BlackBorderProcessor(const Json::Value &blackborderConfig)
 | 
			
		||||
	_consistentCnt(0),
 | 
			
		||||
	_inconsistentCnt(10)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "DETECTION MODE:" << _detectionMode << std::endl;
 | 
			
		||||
	std::cout << "BLACKBORDER INFO: mode:" << _detectionMode << std::endl;
 | 
			
		||||
	// empty
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ void BoblightClientConnection::readData()
 | 
			
		||||
		// drop messages if the buffer is too full
 | 
			
		||||
		if (_receiveBuffer.size() > 100*1024)
 | 
			
		||||
		{
 | 
			
		||||
			std::cout << "Boblight server drops messages" << std::endl;
 | 
			
		||||
			std::cout << "BOBLIGHT INFO: server drops messages (buffer full)" << std::endl;
 | 
			
		||||
			_receiveBuffer.clear();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -211,7 +211,7 @@ void BoblightClientConnection::handleMessage(const QString & message)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	std::cout << "unknown boblight message: " << message.toStdString() << std::endl;
 | 
			
		||||
	std::cout << "BOBLIGHT INFO: unknown boblight message: " << message.toStdString() << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BoblightClientConnection::sendMessage(const std::string & message)
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ BoblightServer::BoblightServer(Hyperion *hyperion, const int priority,uint16_t p
 | 
			
		||||
{
 | 
			
		||||
	if (!_server.listen(QHostAddress::Any, port))
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Boblight server could not bind to port");
 | 
			
		||||
		throw std::runtime_error("BOBLIGHT ERROR: server could not bind to port");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Set trigger for incoming connections
 | 
			
		||||
@@ -39,7 +39,7 @@ void BoblightServer::newConnection()
 | 
			
		||||
 | 
			
		||||
	if (socket != nullptr)
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "New boblight connection" << std::endl;
 | 
			
		||||
		std::cout << "BOBLIGHT INFO: new connection" << std::endl;
 | 
			
		||||
		BoblightClientConnection * connection = new BoblightClientConnection(socket, _priority, _hyperion);
 | 
			
		||||
		_openConnections.insert(connection);
 | 
			
		||||
 | 
			
		||||
@@ -50,7 +50,7 @@ void BoblightServer::newConnection()
 | 
			
		||||
 | 
			
		||||
void BoblightServer::closedConnection(BoblightClientConnection *connection)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "Boblight connection closed" << std::endl;
 | 
			
		||||
	std::cout << "BOBLIGHT INFO: connection closed" << std::endl;
 | 
			
		||||
	_openConnections.remove(connection);
 | 
			
		||||
 | 
			
		||||
	// schedule to delete the connection object
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,7 @@ void Effect::run()
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Unable to open script file " << _script << std::endl;
 | 
			
		||||
		std::cerr << "EFFECTENGINE ERROR: Unable to open script file " << _script << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Clean up the thread state
 | 
			
		||||
@@ -355,7 +355,7 @@ Effect * Effect::getEffect()
 | 
			
		||||
	{
 | 
			
		||||
		// something is wrong
 | 
			
		||||
		Py_XDECREF(module);
 | 
			
		||||
		std::cerr << "Unable to retrieve the effect object from the Python runtime" << std::endl;
 | 
			
		||||
		std::cerr << "EFFECTENGINE ERROR: Unable to retrieve the effect object from the Python runtime" << std::endl;
 | 
			
		||||
		return nullptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -367,7 +367,7 @@ Effect * Effect::getEffect()
 | 
			
		||||
	{
 | 
			
		||||
		// something is wrong
 | 
			
		||||
		Py_XDECREF(effectCapsule);
 | 
			
		||||
		std::cerr << "Unable to retrieve the effect object from the Python runtime" << std::endl;
 | 
			
		||||
		std::cerr << "EFFECTENGINE ERROR: Unable to retrieve the effect object from the Python runtime" << std::endl;
 | 
			
		||||
		return nullptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ EffectEngine::EffectEngine(Hyperion * hyperion, const Json::Value & jsonEffectCo
 | 
			
		||||
		QDir directory(QString::fromStdString(path));
 | 
			
		||||
		if (!directory.exists())
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "Effect directory can not be loaded: " << path << std::endl;
 | 
			
		||||
			std::cerr << "EFFECTENGINE ERROR: Effect directory can not be loaded: " << path << std::endl;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -53,7 +53,7 @@ EffectEngine::EffectEngine(Hyperion * hyperion, const Json::Value & jsonEffectCo
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// initialize the python interpreter
 | 
			
		||||
	std::cout << "Initializing Python interpreter" << std::endl;
 | 
			
		||||
	std::cout << "EFFECTENGINE INFO: Initializing Python interpreter" << std::endl;
 | 
			
		||||
    Effect::registerHyperionExtensionModule();
 | 
			
		||||
	Py_InitializeEx(0);
 | 
			
		||||
	PyEval_InitThreads(); // Create the GIL
 | 
			
		||||
@@ -63,7 +63,7 @@ EffectEngine::EffectEngine(Hyperion * hyperion, const Json::Value & jsonEffectCo
 | 
			
		||||
EffectEngine::~EffectEngine()
 | 
			
		||||
{
 | 
			
		||||
	// clean up the Python interpreter
 | 
			
		||||
	std::cout << "Cleaning up Python interpreter" << std::endl;
 | 
			
		||||
	std::cout << "EFFECTENGINE INFO: Cleaning up Python interpreter" << std::endl;
 | 
			
		||||
	PyEval_RestoreThread(_mainThreadState);
 | 
			
		||||
	Py_Finalize();
 | 
			
		||||
}
 | 
			
		||||
@@ -84,7 +84,7 @@ bool EffectEngine::loadEffectDefinition(const std::string &path, const std::stri
 | 
			
		||||
 | 
			
		||||
	if (!file.is_open())
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Effect file '" << fileName << "' could not be loaded" << std::endl;
 | 
			
		||||
		std::cerr << "EFFECTENGINE ERROR: Effect file '" << fileName << "' could not be loaded" << std::endl;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -93,7 +93,7 @@ bool EffectEngine::loadEffectDefinition(const std::string &path, const std::stri
 | 
			
		||||
	Json::Value config;
 | 
			
		||||
	if (!jsonReader.parse(file, config, false))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Error while reading effect '" << fileName << "': " << jsonReader.getFormattedErrorMessages() << std::endl;
 | 
			
		||||
		std::cerr << "EFFECTENGINE ERROR: Error while reading effect '" << fileName << "': " << jsonReader.getFormattedErrorMessages() << std::endl;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -107,7 +107,7 @@ bool EffectEngine::loadEffectDefinition(const std::string &path, const std::stri
 | 
			
		||||
	{
 | 
			
		||||
		const std::list<std::string> & errors = schemaChecker.getMessages();
 | 
			
		||||
		foreach (const std::string & error, errors) {
 | 
			
		||||
			std::cerr << "Error while checking '" << fileName << "':" << error << std::endl;
 | 
			
		||||
			std::cerr << "EFFECTENGINE ERROR: Error while checking '" << fileName << "':" << error << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
@@ -121,8 +121,8 @@ bool EffectEngine::loadEffectDefinition(const std::string &path, const std::stri
 | 
			
		||||
#endif
 | 
			
		||||
	effectDefinition.args = config["args"];
 | 
			
		||||
 | 
			
		||||
	// return succes
 | 
			
		||||
	std::cout << "Effect loaded: " + effectDefinition.name << std::endl;
 | 
			
		||||
	// return succes //BLACKLIST OUTPUT TO LOG (Spam). This is more a effect development thing and the list gets longer and longer
 | 
			
		||||
//	std::cout << "EFFECTENGINE INFO: Effect loaded: " + effectDefinition.name << std::endl;
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -133,7 +133,7 @@ int EffectEngine::runEffect(const std::string &effectName, int priority, int tim
 | 
			
		||||
 | 
			
		||||
int EffectEngine::runEffect(const std::string &effectName, const Json::Value &args, int priority, int timeout)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "run effect " << effectName << " on channel " << priority << std::endl;
 | 
			
		||||
	std::cout << "EFFECTENGINE INFO: run effect " << effectName << " on channel " << priority << std::endl;
 | 
			
		||||
 | 
			
		||||
	const EffectDefinition * effectDefinition = nullptr;
 | 
			
		||||
	for (const EffectDefinition & e : _availableEffects)
 | 
			
		||||
@@ -147,7 +147,7 @@ int EffectEngine::runEffect(const std::string &effectName, const Json::Value &ar
 | 
			
		||||
	if (effectDefinition == nullptr)
 | 
			
		||||
	{
 | 
			
		||||
		// no such effect
 | 
			
		||||
		std::cerr << "effect " << effectName << " not found" << std::endl;
 | 
			
		||||
		std::cerr << "EFFECTENGINE ERROR: effect " << effectName << " not found" << std::endl;
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -198,7 +198,7 @@ void EffectEngine::effectFinished(Effect *effect)
 | 
			
		||||
		_hyperion->clear(effect->getPriority());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	std::cout << "effect finished" << std::endl;
 | 
			
		||||
	std::cout << "EFFECTENGINE INFO: effect finished" << std::endl;
 | 
			
		||||
	for (auto effectIt = _activeEffects.begin(); effectIt != _activeEffects.end(); ++effectIt)
 | 
			
		||||
	{
 | 
			
		||||
		if (*effectIt == effect)
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height) :
 | 
			
		||||
	_height(std::max(160u, height)),
 | 
			
		||||
	_amlogicCaptureDev(-1)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "[" << __PRETTY_FUNCTION__ << "] constructed(" << _width << "x" << _height << ")" << std::endl;
 | 
			
		||||
	std::cout << "AMLOGICGRABBER INFO: [" << __PRETTY_FUNCTION__ << "] constructed(" << _width << "x" << _height << ")" << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AmlogicGrabber::~AmlogicGrabber()
 | 
			
		||||
@@ -39,7 +39,7 @@ AmlogicGrabber::~AmlogicGrabber()
 | 
			
		||||
	{
 | 
			
		||||
		if (close(_amlogicCaptureDev) == -1)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "[" << __PRETTY_FUNCTION__ << "] Failed to close AMLOGIC device (" << errno << ")" << std::endl;
 | 
			
		||||
			std::cerr << "AMLOGICGRABBER ERROR: [" << __PRETTY_FUNCTION__ << "] Failed to close device (" << errno << ")" << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
		_amlogicCaptureDev = -1;
 | 
			
		||||
	}
 | 
			
		||||
@@ -69,7 +69,7 @@ bool AmlogicGrabber::isVideoPlaying()
 | 
			
		||||
	int video_fd = open(videoDevice.c_str(), O_RDONLY);
 | 
			
		||||
	if (video_fd < 0)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Failed to open video device(" << videoDevice << "): " << strerror(errno) << std::endl;
 | 
			
		||||
		std::cerr << "AMLOGICGRABBER ERROR: Failed to open video device(" << videoDevice << "): " << strerror(errno) << std::endl;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -77,7 +77,7 @@ bool AmlogicGrabber::isVideoPlaying()
 | 
			
		||||
	int videoDisabled;
 | 
			
		||||
	if (ioctl(video_fd, AMSTREAM_IOC_GET_VIDEO_DISABLE, &videoDisabled) == -1)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Failed to retrieve video state from device: " << strerror(errno) << std::endl;
 | 
			
		||||
		std::cerr << "AMLOGICGRABBER ERROR: Failed to retrieve video state from device: " << strerror(errno) << std::endl;
 | 
			
		||||
		close(video_fd);
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
@@ -111,7 +111,7 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
 | 
			
		||||
		// If the device is still not open, there is something wrong
 | 
			
		||||
		if (_amlogicCaptureDev == -1)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "[" << __PRETTY_FUNCTION__ << "] Failed to open the AMLOGIC device (" << errno << "): " << strerror(errno) << std::endl;
 | 
			
		||||
			std::cerr << "AMLOGICGRABBER ERROR:[" << __PRETTY_FUNCTION__ << "] Failed to open the AMLOGIC device (" << errno << "): " << strerror(errno) << std::endl;
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -121,7 +121,7 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
 | 
			
		||||
		ioctl(_amlogicCaptureDev, AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT, _height) == -1)
 | 
			
		||||
	{
 | 
			
		||||
		// Failed to configure frame width
 | 
			
		||||
		std::cerr << "[" << __PRETTY_FUNCTION__ << "] Failed to configure capture size (" << errno << "): " << strerror(errno) << std::endl;
 | 
			
		||||
		std::cerr << "AMLOGICGRABBER ERROR: [" << __PRETTY_FUNCTION__ << "] Failed to configure capture size (" << errno << "): " << strerror(errno) << std::endl;
 | 
			
		||||
		close(_amlogicCaptureDev);
 | 
			
		||||
		_amlogicCaptureDev = -1;
 | 
			
		||||
		return -1;
 | 
			
		||||
@@ -134,7 +134,7 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
 | 
			
		||||
	const ssize_t bytesRead   = pread(_amlogicCaptureDev, image_ptr, bytesToRead, 0);
 | 
			
		||||
	if (bytesRead == -1)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "[" << __PRETTY_FUNCTION__ << "] Read of device failed (erno=" << errno << "): " << strerror(errno) << std::endl;
 | 
			
		||||
		std::cerr << "AMLOGICGRABBER ERROR: [" << __PRETTY_FUNCTION__ << "] Read of device failed (erno=" << errno << "): " << strerror(errno) << std::endl;
 | 
			
		||||
		close(_amlogicCaptureDev);
 | 
			
		||||
		_amlogicCaptureDev = -1;
 | 
			
		||||
		return -1;
 | 
			
		||||
@@ -142,7 +142,7 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
 | 
			
		||||
	else if (bytesToRead != bytesRead)
 | 
			
		||||
	{
 | 
			
		||||
		// Read of snapshot failed
 | 
			
		||||
		std::cerr << "[" << __PRETTY_FUNCTION__ << "] Capture failed to grab entire image [bytesToRead(" << bytesToRead << ") != bytesRead(" << bytesRead << ")]" << std::endl;
 | 
			
		||||
		std::cerr << "AMLOGICGRABBER ERROR: [" << __PRETTY_FUNCTION__ << "] Capture failed to grab entire image [bytesToRead(" << bytesToRead << ") != bytesRead(" << bytesRead << ")]" << std::endl;
 | 
			
		||||
		close(_amlogicCaptureDev);
 | 
			
		||||
		_amlogicCaptureDev = -1;
 | 
			
		||||
		return -1;
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned
 | 
			
		||||
		// Keep compiler happy in 'release' mode
 | 
			
		||||
		(void)result;
 | 
			
		||||
		assert(result == 0);
 | 
			
		||||
		std::cout << "Display opened with resolution: " << vc_info.width << "x" << vc_info.height << std::endl;
 | 
			
		||||
		std::cout << "DISPMANXGRABBER INFO: Display opened with resolution: " << vc_info.width << "x" << vc_info.height << std::endl;
 | 
			
		||||
 | 
			
		||||
		// Close the displaye
 | 
			
		||||
		vc_dispmanx_display_close(_vc_display);
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ FramebufferFrameGrabber::FramebufferFrameGrabber(const std::string & device, con
 | 
			
		||||
	_fbfd = open(_fbDevice.c_str(), O_RDONLY);
 | 
			
		||||
	if (_fbfd == 0)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Error openning " << _fbDevice << std::endl;
 | 
			
		||||
		std::cerr << "FRAMEBUFFERGRABBER ERROR: Error openning " << _fbDevice << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
	else 
 | 
			
		||||
	{
 | 
			
		||||
@@ -35,11 +35,11 @@ FramebufferFrameGrabber::FramebufferFrameGrabber(const std::string & device, con
 | 
			
		||||
		result = ioctl (_fbfd, FBIOGET_VSCREENINFO, &vinfo);
 | 
			
		||||
		if (result != 0)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "Could not get screen information" << std::endl;
 | 
			
		||||
			std::cerr << "FRAMEBUFFERGRABBER ERROR: Could not get screen information" << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			std::cout << "Framebuffer opened with resolution: " << vinfo.xres << "x" << vinfo.yres << "@" << vinfo.bits_per_pixel << "bit" << std::endl;			
 | 
			
		||||
			std::cout << "FRAMEBUFFERGRABBER INFO: opened with resolution: " << vinfo.xres << "x" << vinfo.yres << "@" << vinfo.bits_per_pixel << "bit" << std::endl;			
 | 
			
		||||
		}
 | 
			
		||||
		close(_fbfd);
 | 
			
		||||
	}
 | 
			
		||||
@@ -84,7 +84,7 @@ void FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "Unknown pixel format: " << vinfo.bits_per_pixel << " bits per pixel" << std::endl;
 | 
			
		||||
		std::cerr << "FRAMEBUFFERGRABBER ERROR: Unknown pixel format: " << vinfo.bits_per_pixel << " bits per pixel" << std::endl;
 | 
			
		||||
		close(_fbfd);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, c
 | 
			
		||||
	CGGetActiveDisplayList(8, displays, &displayCount);
 | 
			
		||||
	if (_screenIndex + 1 > displayCount)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "OSX display with index " << _screenIndex << " is not available. Using main display" << std::endl;
 | 
			
		||||
		std::cerr << "OSXGRABBER ERROR: display with index " << _screenIndex << " is not available. Using main display" << std::endl;
 | 
			
		||||
		_display = kCGDirectMainDisplay;
 | 
			
		||||
	} else {
 | 
			
		||||
		_display = displays[_screenIndex];
 | 
			
		||||
@@ -28,7 +28,7 @@ OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, c
 | 
			
		||||
	image = CGDisplayCreateImage(_display);
 | 
			
		||||
	assert(image != NULL);
 | 
			
		||||
 | 
			
		||||
	std::cout << "OSX display opened with resolution: " << CGImageGetWidth(image) << "x" << CGImageGetHeight(image) << "@" << CGImageGetBitsPerPixel(image) << "bit" << std::endl;
 | 
			
		||||
	std::cout << "OSXGRABBER INFO: display opened with resolution: " << CGImageGetWidth(image) << "x" << CGImageGetHeight(image) << "@" << CGImageGetBitsPerPixel(image) << "bit" << std::endl;
 | 
			
		||||
 | 
			
		||||
	CGImageRelease(image);
 | 
			
		||||
}
 | 
			
		||||
@@ -59,7 +59,7 @@ void OsxFrameGrabber::grabFrame(Image<ColorRgb> & image)
 | 
			
		||||
		// no displays connected, return
 | 
			
		||||
		if (dispImage == NULL)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "OSX no display connected..." << std::endl;
 | 
			
		||||
			std::cerr << "OSXGRABBER ERROR: no display connected..." << std::endl;
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ void V4L2Grabber::setSignalThreshold(double redSignalThreshold, double greenSign
 | 
			
		||||
    _noSignalThresholdColor.blue = uint8_t(255*blueSignalThreshold);
 | 
			
		||||
    _noSignalCounterThreshold = std::max(1, noSignalCounterThreshold);
 | 
			
		||||
 | 
			
		||||
    std::cout << "V4L2 grabber signal threshold set to: " << _noSignalThresholdColor << std::endl;
 | 
			
		||||
    std::cout << "V4L2GRABBER INFO: signal threshold set to: " << _noSignalThresholdColor << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void V4L2Grabber::start()
 | 
			
		||||
@@ -85,7 +85,7 @@ void V4L2Grabber::start()
 | 
			
		||||
    {
 | 
			
		||||
        _streamNotifier->setEnabled(true);
 | 
			
		||||
        start_capturing();
 | 
			
		||||
        std::cout << "V4L2 grabber started" << std::endl;
 | 
			
		||||
        std::cout << "V4L2GRABBER INFO: started" << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -95,7 +95,7 @@ void V4L2Grabber::stop()
 | 
			
		||||
    {
 | 
			
		||||
        stop_capturing();
 | 
			
		||||
        _streamNotifier->setEnabled(false);
 | 
			
		||||
        std::cout << "V4L2 grabber stopped" << std::endl;
 | 
			
		||||
        std::cout << "V4L2GRABBER INFO: stopped" << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -106,7 +106,7 @@ void V4L2Grabber::open_device()
 | 
			
		||||
    if (-1 == stat(_deviceName.c_str(), &st))
 | 
			
		||||
    {
 | 
			
		||||
        std::ostringstream oss;
 | 
			
		||||
        oss << "Cannot identify '" << _deviceName << "'";
 | 
			
		||||
        oss << "V4L2GRABBER ERROR: Cannot identify '" << _deviceName << "'";
 | 
			
		||||
        throw_errno_exception(oss.str());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -122,7 +122,7 @@ void V4L2Grabber::open_device()
 | 
			
		||||
    if (-1 == _fileDescriptor)
 | 
			
		||||
    {
 | 
			
		||||
        std::ostringstream oss;
 | 
			
		||||
        oss << "Cannot open '" << _deviceName << "'";
 | 
			
		||||
        oss << "V4L2GRABBER ERROR: Cannot open '" << _deviceName << "'";
 | 
			
		||||
        throw_errno_exception(oss.str());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -154,7 +154,7 @@ void V4L2Grabber::init_read(unsigned int buffer_size)
 | 
			
		||||
    _buffers[0].start = malloc(buffer_size);
 | 
			
		||||
 | 
			
		||||
    if (!_buffers[0].start) {
 | 
			
		||||
        throw_exception("Out of memory");
 | 
			
		||||
        throw_exception("V4L2GRABBER ERROR: Out of memory");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -239,7 +239,7 @@ void V4L2Grabber::init_userp(unsigned int buffer_size)
 | 
			
		||||
        _buffers[n_buffers].start = malloc(buffer_size);
 | 
			
		||||
 | 
			
		||||
        if (!_buffers[n_buffers].start) {
 | 
			
		||||
            throw_exception("Out of memory");
 | 
			
		||||
            throw_exception("V4L2GRABBER ERROR: Out of memory");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -420,20 +420,20 @@ void V4L2Grabber::init_device(VideoStandard videoStandard, int input)
 | 
			
		||||
    case V4L2_PIX_FMT_UYVY:
 | 
			
		||||
        _pixelFormat = PIXELFORMAT_UYVY;
 | 
			
		||||
        _frameByteSize = _width * _height * 2;
 | 
			
		||||
        std::cout << "V4L2 pixel format=UYVY" << std::endl;
 | 
			
		||||
        std::cout << "V4L2GRABBER INFO: pixel format=UYVY" << std::endl;
 | 
			
		||||
        break;
 | 
			
		||||
    case V4L2_PIX_FMT_YUYV:
 | 
			
		||||
        _pixelFormat = PIXELFORMAT_YUYV;
 | 
			
		||||
        _frameByteSize = _width * _height * 2;
 | 
			
		||||
        std::cout << "V4L2 pixel format=YUYV" << std::endl;
 | 
			
		||||
        std::cout << "V4L2GRABBER INFO: pixel format=YUYV" << std::endl;
 | 
			
		||||
        break;
 | 
			
		||||
    case V4L2_PIX_FMT_RGB32:
 | 
			
		||||
        _pixelFormat = PIXELFORMAT_RGB32;
 | 
			
		||||
        _frameByteSize = _width * _height * 4;
 | 
			
		||||
        std::cout << "V4L2 pixel format=RGB32" << std::endl;
 | 
			
		||||
        std::cout << "V4L2GRABBER INFO: pixel format=RGB32" << std::endl;
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        throw_exception("Only pixel formats UYVY, YUYV, and RGB32 are supported");
 | 
			
		||||
        throw_exception("V4L2GRABBER ERROR: Only pixel formats UYVY, YUYV, and RGB32 are supported");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch (_ioMethod) {
 | 
			
		||||
@@ -653,7 +653,7 @@ bool V4L2Grabber::process_image(const void *p, int size)
 | 
			
		||||
 | 
			
		||||
        if (size != _frameByteSize)
 | 
			
		||||
        {
 | 
			
		||||
            std::cout << "Frame too small: " << size << " != " << _frameByteSize << std::endl;
 | 
			
		||||
            std::cout << "V4L2GRABBER ERROR: Frame too small: " << size << " != " << _frameByteSize << std::endl;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
@@ -694,7 +694,7 @@ void V4L2Grabber::process_image(const uint8_t * data)
 | 
			
		||||
    {
 | 
			
		||||
        if (_noSignalCounter >= _noSignalCounterThreshold)
 | 
			
		||||
        {
 | 
			
		||||
            std::cout << "V4L2 Grabber: " << "Signal detected" << std::endl;
 | 
			
		||||
            std::cout << "V4L2GRABBER INFO: " << "Signal detected" << std::endl;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        _noSignalCounter = 0;
 | 
			
		||||
@@ -706,7 +706,7 @@ void V4L2Grabber::process_image(const uint8_t * data)
 | 
			
		||||
    }
 | 
			
		||||
    else if (_noSignalCounter == _noSignalCounterThreshold)
 | 
			
		||||
    {
 | 
			
		||||
        std::cout << "V4L2 Grabber: " << "Signal lost" << std::endl;
 | 
			
		||||
        std::cout << "V4L2GRABBER INFO: " << "Signal lost" << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -726,13 +726,13 @@ int V4L2Grabber::xioctl(int request, void *arg)
 | 
			
		||||
void V4L2Grabber::throw_exception(const std::string & error)
 | 
			
		||||
{
 | 
			
		||||
    std::ostringstream oss;
 | 
			
		||||
    oss << error << " error";
 | 
			
		||||
    oss << error << " ERROR";
 | 
			
		||||
    throw std::runtime_error(oss.str());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void V4L2Grabber::throw_errno_exception(const std::string & error)
 | 
			
		||||
{
 | 
			
		||||
    std::ostringstream oss;
 | 
			
		||||
    oss << error << " error " << errno << ", " << strerror(errno);
 | 
			
		||||
    oss << error << " ERROR " << errno << ", " << strerror(errno);
 | 
			
		||||
    throw std::runtime_error(oss.str());
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ bool X11Grabber::Setup()
 | 
			
		||||
    _x11Display = XOpenDisplay(NULL);
 | 
			
		||||
    if (_x11Display == nullptr)
 | 
			
		||||
    {
 | 
			
		||||
      std::cerr << "Unable to open display";
 | 
			
		||||
      std::cerr << "X11GRABBER ERROR: Unable to open display";
 | 
			
		||||
      if (getenv("DISPLAY"))
 | 
			
		||||
	std::cerr <<  " " << std::string(getenv("DISPLAY")) << std::endl;
 | 
			
		||||
      else
 | 
			
		||||
@@ -82,7 +82,7 @@ Image<ColorRgb> & X11Grabber::grab()
 | 
			
		||||
    XShmGetImage(_x11Display, _window, _xImage, _cropLeft, _cropTop, 0x00FFFFFF);
 | 
			
		||||
    if (_xImage == nullptr)
 | 
			
		||||
    {
 | 
			
		||||
        std::cerr << "Grab failed" << std::endl;
 | 
			
		||||
        std::cerr << "X11GRABBER ERROR: Grab failed" << std::endl;
 | 
			
		||||
        return _image;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -96,7 +96,7 @@ int X11Grabber::updateScreenDimensions()
 | 
			
		||||
    const Status status = XGetWindowAttributes(_x11Display, _window, &_windowAttr);
 | 
			
		||||
    if (status == 0)
 | 
			
		||||
    {
 | 
			
		||||
        std::cerr << "Failed to obtain window attributes" << std::endl;
 | 
			
		||||
        std::cerr << "X11GRABBER ERROR: Failed to obtain window attributes" << std::endl;
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -106,7 +106,7 @@ int X11Grabber::updateScreenDimensions()
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    std::cout << "Update of screen resolution: [" << _screenWidth << "x" << _screenHeight <<"] => ";
 | 
			
		||||
    std::cout << "X11GRABBER INFO: Update of screen resolution: [" << _screenWidth << "x" << _screenHeight <<"] => ";
 | 
			
		||||
 | 
			
		||||
    if (_screenWidth || _screenHeight)
 | 
			
		||||
      freeResources();
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ ColorOrder Hyperion::createColorOrder(const Json::Value &deviceConfig)
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "Unknown color order defined (" << order << "). Using RGB." << std::endl;
 | 
			
		||||
		std::cout << "HYPERION ERROR: Unknown color order defined (" << order << "). Using RGB." << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ORDER_RGB;
 | 
			
		||||
@@ -151,17 +151,17 @@ MultiColorTransform * Hyperion::createLedColorsTransform(const unsigned ledCnt,
 | 
			
		||||
			{
 | 
			
		||||
				// Special case for indices '*' => all leds
 | 
			
		||||
				transform->setTransformForLed(colorTransform->_id, 0, ledCnt-1);
 | 
			
		||||
				std::cout << "ColorTransform '" << colorTransform->_id << "' => [0; "<< ledCnt-1 << "]" << std::endl;
 | 
			
		||||
				std::cout << "HYPERION INFO: ColorTransform '" << colorTransform->_id << "' => [0; "<< ledCnt-1 << "]" << std::endl;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (!overallExp.exactMatch(ledIndicesStr))
 | 
			
		||||
			{
 | 
			
		||||
				std::cerr << "Given led indices " << i << " not correct format: " << ledIndicesStr.toStdString() << std::endl;
 | 
			
		||||
				std::cerr << "HYPERION ERROR: Given led indices " << i << " not correct format: " << ledIndicesStr.toStdString() << std::endl;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			std::cout << "ColorTransform '" << colorTransform->_id << "' => [";
 | 
			
		||||
			std::cout << "HYPERION INFO: ColorTransform '" << colorTransform->_id << "' => [";
 | 
			
		||||
 | 
			
		||||
			const QStringList ledIndexList = ledIndicesStr.split(",");
 | 
			
		||||
			for (int i=0; i<ledIndexList.size(); ++i) {
 | 
			
		||||
@@ -225,17 +225,17 @@ MultiColorCorrection * Hyperion::createLedColorsCorrection(const unsigned ledCnt
 | 
			
		||||
			{
 | 
			
		||||
				// Special case for indices '*' => all leds
 | 
			
		||||
				correction->setCorrectionForLed(colorCorrection->_id, 0, ledCnt-1);
 | 
			
		||||
				std::cout << "ColorCorrection '" << colorCorrection->_id << "' => [0; "<< ledCnt-1 << "]" << std::endl;
 | 
			
		||||
				std::cout << "HYPERION INFO: ColorCorrection '" << colorCorrection->_id << "' => [0; "<< ledCnt-1 << "]" << std::endl;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (!overallExp.exactMatch(ledIndicesStr))
 | 
			
		||||
			{
 | 
			
		||||
				std::cerr << "Given led indices " << i << " not correct format: " << ledIndicesStr.toStdString() << std::endl;
 | 
			
		||||
				std::cerr << "HYPERION ERROR: Given led indices " << i << " not correct format: " << ledIndicesStr.toStdString() << std::endl;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			std::cout << "ColorCorrection '" << colorCorrection->_id << "' => [";
 | 
			
		||||
			std::cout << "HYPERION INFO: ColorCorrection '" << colorCorrection->_id << "' => [";
 | 
			
		||||
 | 
			
		||||
			const QStringList ledIndexList = ledIndicesStr.split(",");
 | 
			
		||||
			for (int i=0; i<ledIndexList.size(); ++i) {
 | 
			
		||||
@@ -299,17 +299,17 @@ MultiColorCorrection * Hyperion::createLedColorsTemperature(const unsigned ledCn
 | 
			
		||||
			{
 | 
			
		||||
				// Special case for indices '*' => all leds
 | 
			
		||||
				correction->setCorrectionForLed(colorCorrection->_id, 0, ledCnt-1);
 | 
			
		||||
				std::cout << "ColorCorrection '" << colorCorrection->_id << "' => [0; "<< ledCnt-1 << "]" << std::endl;
 | 
			
		||||
				std::cout << "HYPERION INFO: ColorCorrection '" << colorCorrection->_id << "' => [0; "<< ledCnt-1 << "]" << std::endl;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (!overallExp.exactMatch(ledIndicesStr))
 | 
			
		||||
			{
 | 
			
		||||
				std::cerr << "Given led indices " << i << " not correct format: " << ledIndicesStr.toStdString() << std::endl;
 | 
			
		||||
				std::cerr << "HYPERION ERROR: Given led indices " << i << " not correct format: " << ledIndicesStr.toStdString() << std::endl;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			std::cout << "ColorCorrection '" << colorCorrection->_id << "' => [";
 | 
			
		||||
			std::cout << "HYPERION INFO: ColorCorrection '" << colorCorrection->_id << "' => [";
 | 
			
		||||
 | 
			
		||||
			const QStringList ledIndexList = ledIndicesStr.split(",");
 | 
			
		||||
			for (int i=0; i<ledIndexList.size(); ++i) {
 | 
			
		||||
@@ -423,23 +423,23 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig,
 | 
			
		||||
 | 
			
		||||
	if (type == "none")
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "Not creating any smoothing" << std::endl;
 | 
			
		||||
		std::cout << "HYPERION INDO: Not creating any smoothing" << std::endl;
 | 
			
		||||
		return ledDevice;
 | 
			
		||||
	}
 | 
			
		||||
	else if (type == "linear")
 | 
			
		||||
	{
 | 
			
		||||
		if (!smoothingConfig.isMember("time_ms"))
 | 
			
		||||
		{
 | 
			
		||||
			std::cout << "Unable to create smoothing of type linear because of missing parameter 'time_ms'" << std::endl;
 | 
			
		||||
			std::cout << "HYPERION ERROR: Unable to create smoothing of type linear because of missing parameter 'time_ms'" << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
		else if (!smoothingConfig.isMember("updateFrequency"))
 | 
			
		||||
		{
 | 
			
		||||
			std::cout << "Unable to create smoothing of type linear because of missing parameter 'updateFrequency'" << std::endl;
 | 
			
		||||
			std::cout << "HYPERION ERROR: Unable to create smoothing of type linear because of missing parameter 'updateFrequency'" << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			const unsigned updateDelay = smoothingConfig.get("updateDelay", Json::Value(0u)).asUInt();
 | 
			
		||||
			std::cout << "Creating linear smoothing" << std::endl;
 | 
			
		||||
			std::cout << "HYPERION INFO: Creating linear smoothing" << std::endl;
 | 
			
		||||
			return new LinearColorSmoothing(
 | 
			
		||||
					ledDevice,
 | 
			
		||||
					smoothingConfig["updateFrequency"].asDouble(),
 | 
			
		||||
@@ -449,7 +449,7 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig,
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "Unable to create smoothing of type " << type << std::endl;
 | 
			
		||||
		std::cout << "HYPERION ERROR: Unable to create smoothing of type " << type << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ledDevice;
 | 
			
		||||
@@ -464,7 +464,7 @@ MessageForwarder * Hyperion::createMessageForwarder(const Json::Value & forwarde
 | 
			
		||||
			{
 | 
			
		||||
				for (const Json::Value& addr : forwarderConfig["json"])
 | 
			
		||||
				{
 | 
			
		||||
					std::cout << "Json forward to " << addr.asString() << std::endl;
 | 
			
		||||
					std::cout << "HYPERION INFO: Json forward to " << addr.asString() << std::endl;
 | 
			
		||||
					forwarder->addJsonSlave(addr.asString());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -473,7 +473,7 @@ MessageForwarder * Hyperion::createMessageForwarder(const Json::Value & forwarde
 | 
			
		||||
			{
 | 
			
		||||
				for (const Json::Value& addr : forwarderConfig["proto"])
 | 
			
		||||
				{
 | 
			
		||||
					std::cout << "Proto forward to " << addr.asString() << std::endl;
 | 
			
		||||
					std::cout << "HYPERION INFO: Proto forward to " << addr.asString() << std::endl;
 | 
			
		||||
					forwarder->addProtoSlave(addr.asString());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -500,15 +500,15 @@ Hyperion::Hyperion(const Json::Value &jsonConfig) :
 | 
			
		||||
{
 | 
			
		||||
	if (!_raw2ledCorrection->verifyCorrections())
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Color correction incorrectly set");
 | 
			
		||||
		throw std::runtime_error("HYPERION ERROR: Color correction incorrectly set");
 | 
			
		||||
	}
 | 
			
		||||
	if (!_raw2ledTemperature->verifyCorrections())
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Color temperature incorrectly set");
 | 
			
		||||
		throw std::runtime_error("HYPERION ERROR: Color temperature incorrectly set");
 | 
			
		||||
	}
 | 
			
		||||
	if (!_raw2ledTransform->verifyTransforms())
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Color transformation incorrectly set");
 | 
			
		||||
		throw std::runtime_error("HYPERION ERROR: Color transformation incorrectly set");
 | 
			
		||||
	}
 | 
			
		||||
	// initialize the image processor factory
 | 
			
		||||
	ImageProcessorFactory::getInstance().init(
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ LinearColorSmoothing::LinearColorSmoothing(
 | 
			
		||||
 | 
			
		||||
	connect(&_timer, SIGNAL(timeout()), this, SLOT(updateLeds()));
 | 
			
		||||
 | 
			
		||||
	std::cout << "Created linear-smoothing(interval_ms=" << _updateInterval << ";settlingTime_ms=" << settlingTime_ms << ";updateDelay=" << _outputDelay << std::endl;
 | 
			
		||||
	std::cout << "HYPERION (CS) INFO: Created linear-smoothing(interval_ms=" << _updateInterval << ";settlingTime_ms=" << settlingTime_ms << ";updateDelay=" << _outputDelay << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
LinearColorSmoothing::~LinearColorSmoothing()
 | 
			
		||||
 
 | 
			
		||||
@@ -17,12 +17,12 @@ void MessageForwarder::addJsonSlave(std::string slave)
 | 
			
		||||
{
 | 
			
		||||
	QStringList parts = QString(slave.c_str()).split(":");
 | 
			
		||||
	if (parts.size() != 2)
 | 
			
		||||
		throw std::runtime_error(QString("Wrong address: unable to parse address (%1)").arg(slave.c_str()).toStdString());
 | 
			
		||||
		throw std::runtime_error(QString("HYPERION (forwarder) ERROR: Wrong address: unable to parse address (%1)").arg(slave.c_str()).toStdString());
 | 
			
		||||
 | 
			
		||||
	bool ok;
 | 
			
		||||
	quint16 port = parts[1].toUShort(&ok);
 | 
			
		||||
	if (!ok)
 | 
			
		||||
		throw std::runtime_error(QString("Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString());
 | 
			
		||||
		throw std::runtime_error(QString("HYPERION (forwarder) ERROR: Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString());
 | 
			
		||||
 | 
			
		||||
	JsonSlaveAddress c;
 | 
			
		||||
	c.addr = QHostAddress(parts[0]);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ bool MultiColorCorrection::verifyCorrections() const
 | 
			
		||||
	{
 | 
			
		||||
		if (_ledCorrections[iLed] == nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "No correction set for " << iLed << std::endl;
 | 
			
		||||
			std::cerr << "HYPERION (C.correction) ERROR: No correction set for " << iLed << std::endl;
 | 
			
		||||
			allLedsSet = false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ bool MultiColorTransform::verifyTransforms() const
 | 
			
		||||
	{
 | 
			
		||||
		if (_ledTransforms[iLed] == nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "No transform set for " << iLed << std::endl;
 | 
			
		||||
			std::cerr << "HYPERION (C.transform) ERROR: No transform set for " << iLed << std::endl;
 | 
			
		||||
			allLedsSet = false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ const PriorityMuxer::InputInfo& PriorityMuxer::getInputInfo(const int priority)
 | 
			
		||||
	auto elemIt = _activeInputs.find(priority);
 | 
			
		||||
	if (elemIt == _activeInputs.end())
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("no such priority");
 | 
			
		||||
		throw std::runtime_error("HYPERION (prioritymux) ERROR: no such priority");
 | 
			
		||||
	}
 | 
			
		||||
	return elemIt.value();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -164,7 +164,7 @@ void JsonClientConnection::handleWebSocketFrame()
 | 
			
		||||
		}
 | 
			
		||||
	} else
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "Someone is sending very big messages over several frames... it's not supported yet" << std::endl;
 | 
			
		||||
		std::cout << "JSONCLIENT INFO: Someone is sending very big messages over several frames... it's not supported yet" << std::endl;
 | 
			
		||||
		quint8 close[] = {0x88, 0};				
 | 
			
		||||
		_socket->write((const char*)close, 2);
 | 
			
		||||
		_socket->flush();
 | 
			
		||||
@@ -400,7 +400,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
 | 
			
		||||
		const ColorCorrection * colorCorrection = _hyperion->getCorrection(correctionId);
 | 
			
		||||
		if (colorCorrection == nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "Incorrect color correction id: " << correctionId << std::endl;
 | 
			
		||||
			std::cerr << "JSONCLIENT ERROR: Incorrect color correction id: " << correctionId << std::endl;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -420,7 +420,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
 | 
			
		||||
		const ColorCorrection * colorTemp = _hyperion->getTemperature(tempId);
 | 
			
		||||
		if (colorTemp == nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "Incorrect color temperature correction id: " << tempId << std::endl;
 | 
			
		||||
			std::cerr << "JSONCLIENT ERROR: Incorrect color temperature correction id: " << tempId << std::endl;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -441,7 +441,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
 | 
			
		||||
		const ColorTransform * colorTransform = _hyperion->getTransform(transformId);
 | 
			
		||||
		if (colorTransform == nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			std::cerr << "Incorrect color transform id: " << transformId << std::endl;
 | 
			
		||||
			std::cerr << "JSONCLIENT ERROR: Incorrect color transform id: " << transformId << std::endl;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -743,7 +743,7 @@ bool JsonClientConnection::checkJson(const Json::Value & message, const QString
 | 
			
		||||
	Json::Value schemaJson;
 | 
			
		||||
	if (!jsonReader.parse(reinterpret_cast<const char *>(schemaData.data()), reinterpret_cast<const char *>(schemaData.data()) + schemaData.size(), schemaJson, false))
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Schema error: " + jsonReader.getFormattedErrorMessages())	;
 | 
			
		||||
		throw std::runtime_error("JSONCLIENT ERROR: Schema error: " + jsonReader.getFormattedErrorMessages())	;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// create schema checker
 | 
			
		||||
 
 | 
			
		||||
@@ -13,14 +13,14 @@ JsonServer::JsonServer(Hyperion *hyperion, uint16_t port) :
 | 
			
		||||
{
 | 
			
		||||
	if (!_server.listen(QHostAddress::Any, port))
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Json server could not bind to port");
 | 
			
		||||
		throw std::runtime_error("JSONSERVER ERROR: could not bind to port");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		QList<MessageForwarder::JsonSlaveAddress> list = _hyperion->getForwarder()->getJsonSlaves();
 | 
			
		||||
		for ( int i=0; i<list.size(); i++ )
 | 
			
		||||
		{
 | 
			
		||||
			if ( list.at(i).addr == QHostAddress::LocalHost && list.at(i).port == port ) {
 | 
			
		||||
				throw std::runtime_error("Loop between proto server and forwarder detected. Fix your config!");
 | 
			
		||||
				throw std::runtime_error("JSONSERVER ERROR: Loop between proto server and forwarder detected. Fix your config!");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -49,7 +49,7 @@ void JsonServer::newConnection()
 | 
			
		||||
 | 
			
		||||
	if (socket != nullptr)
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "New json connection" << std::endl;
 | 
			
		||||
		std::cout << "JSONSERVER INFO: New connection" << std::endl;
 | 
			
		||||
		JsonClientConnection * connection = new JsonClientConnection(socket, _hyperion);
 | 
			
		||||
		_openConnections.insert(connection);
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +60,7 @@ void JsonServer::newConnection()
 | 
			
		||||
 | 
			
		||||
void JsonServer::closedConnection(JsonClientConnection *connection)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "Json connection closed" << std::endl;
 | 
			
		||||
	std::cout << "JSONSERVER INFO: Connection closed" << std::endl;
 | 
			
		||||
	_openConnections.remove(connection);
 | 
			
		||||
 | 
			
		||||
	// schedule to delete the connection object
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@
 | 
			
		||||
 | 
			
		||||
LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "Device configuration: " << deviceConfig << std::endl;
 | 
			
		||||
	std::cout << "LEDDEVICE INFO: configuration: " << deviceConfig << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::string type = deviceConfig.get("type", "UNSPECIFIED").asString();
 | 
			
		||||
	std::transform(type.begin(), type.end(), type.begin(), ::tolower);
 | 
			
		||||
@@ -336,7 +336,7 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
 | 
			
		||||
#endif
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "Error: Unknown/Unimplemented device " << type << std::endl;
 | 
			
		||||
		std::cout << "LEDDEVICE ERROR: Unknown/Unimplemented device " << type << std::endl;
 | 
			
		||||
		// Unknown / Unimplemented device
 | 
			
		||||
	}
 | 
			
		||||
	return device;
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ ProtoConnection::ProtoConnection(const std::string & a) :
 | 
			
		||||
    QStringList parts = address.split(":");
 | 
			
		||||
    if (parts.size() != 2)
 | 
			
		||||
    {
 | 
			
		||||
        throw std::runtime_error(QString("Wrong address: unable to parse address (%1)").arg(address).toStdString());
 | 
			
		||||
        throw std::runtime_error(QString("PROTOCONNECTION ERROR: Wrong address: Unable to parse address (%1)").arg(address).toStdString());
 | 
			
		||||
    }
 | 
			
		||||
    _host = parts[0];
 | 
			
		||||
 | 
			
		||||
@@ -24,11 +24,11 @@ ProtoConnection::ProtoConnection(const std::string & a) :
 | 
			
		||||
    _port = parts[1].toUShort(&ok);
 | 
			
		||||
    if (!ok)
 | 
			
		||||
    {
 | 
			
		||||
        throw std::runtime_error(QString("Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString());
 | 
			
		||||
        throw std::runtime_error(QString("PROTOCONNECTION ERROR: Wrong port: Unable to parse the port number (%1)").arg(parts[1]).toStdString());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // try to connect to host
 | 
			
		||||
    std::cout << "Connecting to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
 | 
			
		||||
    std::cout << "PROTOCONNECTION INFO: Connecting to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
 | 
			
		||||
    connectToHost();
 | 
			
		||||
 | 
			
		||||
    // start the connection timer
 | 
			
		||||
@@ -116,11 +116,11 @@ void ProtoConnection::sendMessage(const proto::HyperionRequest &message)
 | 
			
		||||
      switch (_socket.state() )
 | 
			
		||||
      {
 | 
			
		||||
        case QAbstractSocket::UnconnectedState:
 | 
			
		||||
          std::cout << "No connection to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
 | 
			
		||||
          std::cout << "PROTOCONNECTION INFO: No connection to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
        case QAbstractSocket::ConnectedState:
 | 
			
		||||
          std::cout << "Connected to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
 | 
			
		||||
          std::cout << "PROTOCONNECTION INFO: Connected to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
        default:
 | 
			
		||||
@@ -154,7 +154,7 @@ void ProtoConnection::sendMessage(const proto::HyperionRequest &message)
 | 
			
		||||
    count += _socket.write(reinterpret_cast<const char *>(serializedMessage.data()), length);
 | 
			
		||||
    if (!_socket.waitForBytesWritten())
 | 
			
		||||
    {
 | 
			
		||||
        std::cerr << "Error while writing data to host" << std::endl;
 | 
			
		||||
        std::cerr << "PROTOCONNECTION ERROR: Error while writing data to host" << std::endl;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -168,7 +168,7 @@ void ProtoConnection::sendMessage(const proto::HyperionRequest &message)
 | 
			
		||||
            // receive reply
 | 
			
		||||
            if (!_socket.waitForReadyRead())
 | 
			
		||||
            {
 | 
			
		||||
                std::cerr << "Error while reading data from host" << std::endl;
 | 
			
		||||
                std::cerr << "PROTOCONNECTION ERROR: Error while reading data from host" << std::endl;
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -202,11 +202,11 @@ bool ProtoConnection::parseReply(const proto::HyperionReply &reply)
 | 
			
		||||
    {
 | 
			
		||||
        if (reply.has_error())
 | 
			
		||||
        {
 | 
			
		||||
            throw std::runtime_error("Error: " + reply.error());
 | 
			
		||||
            throw std::runtime_error("PROTOCONNECTION ERROR: " + reply.error());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            throw std::runtime_error("Error: No error info");
 | 
			
		||||
            throw std::runtime_error("PROTOCONNECTION ERROR: No error info");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port) :
 | 
			
		||||
 | 
			
		||||
	for (int i = 0; i < slaves.size(); ++i) {
 | 
			
		||||
		if ( QString("127.0.0.1:%1").arg(port) == slaves.at(i) ) {
 | 
			
		||||
			throw std::runtime_error("Loop between proto server and forwarder detected. Fix your config!");
 | 
			
		||||
			throw std::runtime_error("PROTOSERVER ERROR: Loop between proto server and forwarder detected. Fix your config!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ProtoConnection* p = new ProtoConnection(slaves.at(i).toLocal8Bit().constData());
 | 
			
		||||
@@ -29,7 +29,7 @@ ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port) :
 | 
			
		||||
 | 
			
		||||
	if (!_server.listen(QHostAddress::Any, port))
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Proto server could not bind to port");
 | 
			
		||||
		throw std::runtime_error("PROTOSERVER ERROR: Could not bind to port");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Set trigger for incoming connections
 | 
			
		||||
@@ -57,7 +57,7 @@ void ProtoServer::newConnection()
 | 
			
		||||
 | 
			
		||||
	if (socket != nullptr)
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "New proto connection" << std::endl;
 | 
			
		||||
		std::cout << "PROTOSERVER INFO: New connection" << std::endl;
 | 
			
		||||
		ProtoClientConnection * connection = new ProtoClientConnection(socket, _hyperion);
 | 
			
		||||
		_openConnections.insert(connection);
 | 
			
		||||
 | 
			
		||||
@@ -82,7 +82,7 @@ void ProtoServer::sendImageToProtoSlaves(int priority, const Image<ColorRgb> & i
 | 
			
		||||
 | 
			
		||||
void ProtoServer::closedConnection(ProtoClientConnection *connection)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "Proto connection closed" << std::endl;
 | 
			
		||||
	std::cout << "PROTOSERVER INFO: Connection closed" << std::endl;
 | 
			
		||||
	_openConnections.remove(connection);
 | 
			
		||||
 | 
			
		||||
	// schedule to delete the connection object
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ void XBMCVideoChecker::receiveReply()
 | 
			
		||||
	// expect that the reply is received as a single message. Probably oke considering the size of the expected reply
 | 
			
		||||
	QString reply(_socket.readAll());
 | 
			
		||||
 | 
			
		||||
	std::cout << "Message from XBMC: " << reply.toStdString() << std::endl;
 | 
			
		||||
	std::cout << "KODICHECK INFO: Kodi Message: " << reply.toStdString() << std::endl;
 | 
			
		||||
 | 
			
		||||
	if (reply.contains("\"method\":\"Player.OnPlay\""))
 | 
			
		||||
	{
 | 
			
		||||
@@ -197,7 +197,7 @@ void XBMCVideoChecker::receiveReply()
 | 
			
		||||
 | 
			
		||||
void XBMCVideoChecker::connected()
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "XBMC Connected" << std::endl;
 | 
			
		||||
	std::cout << "KODICHECK INFO: Kodi Connected" << std::endl;
 | 
			
		||||
 | 
			
		||||
	// send a request for the current player state
 | 
			
		||||
	_socket.write(_activePlayerRequest.toUtf8());
 | 
			
		||||
@@ -206,7 +206,7 @@ void XBMCVideoChecker::connected()
 | 
			
		||||
 | 
			
		||||
void XBMCVideoChecker::disconnected()
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "XBMC Disconnected" << std::endl;
 | 
			
		||||
	std::cout << "KODICHECK INFO: Kodi Disconnected" << std::endl;
 | 
			
		||||
	reconnect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -239,7 +239,7 @@ void XBMCVideoChecker::reconnect()
 | 
			
		||||
 | 
			
		||||
void XBMCVideoChecker::connectionError(QAbstractSocket::SocketError error)
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "XBMC Connection error (" << error << ")" << std::endl;
 | 
			
		||||
	std::cout << "KODICHECK ERROR: Kodi Connection error (" << error << ")" << std::endl;
 | 
			
		||||
 | 
			
		||||
	// close the socket
 | 
			
		||||
	_socket.close();
 | 
			
		||||
@@ -256,22 +256,22 @@ void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
 | 
			
		||||
	switch (newGrabbingMode)
 | 
			
		||||
	{
 | 
			
		||||
	case GRABBINGMODE_VIDEO:
 | 
			
		||||
		std::cout << "XBMC checker: switching to VIDEO mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to VIDEO mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case GRABBINGMODE_PHOTO:
 | 
			
		||||
		std::cout << "XBMC checker: switching to PHOTO mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to PHOTO mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case GRABBINGMODE_AUDIO:
 | 
			
		||||
		std::cout << "XBMC checker: switching to AUDIO mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to AUDIO mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case GRABBINGMODE_MENU:
 | 
			
		||||
		std::cout << "XBMC checker: switching to MENU mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to MENU mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case GRABBINGMODE_OFF:
 | 
			
		||||
		std::cout << "XBMC checker: switching to OFF mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to OFF mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case GRABBINGMODE_INVALID:
 | 
			
		||||
		std::cout << "XBMC checker: switching to INVALID mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to INVALID mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -306,13 +306,13 @@ void XBMCVideoChecker::setVideoMode(VideoMode newVideoMode)
 | 
			
		||||
	switch (newVideoMode)
 | 
			
		||||
	{
 | 
			
		||||
	case VIDEO_2D:
 | 
			
		||||
		std::cout << "XBMC checker: switching to 2D mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to 2D mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case VIDEO_3DSBS:
 | 
			
		||||
		std::cout << "XBMC checker: switching to 3D SBS mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to 3D SBS mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	case VIDEO_3DTAB:
 | 
			
		||||
		std::cout << "XBMC checker: switching to 3D TAB mode" << std::endl;
 | 
			
		||||
		std::cout << "KODICHECK INFO: switching to 3D TAB mode" << std::endl;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ Json::Value loadConfig(const std::string & configFile)
 | 
			
		||||
	Json::Value schemaJson;
 | 
			
		||||
	if (!jsonReader.parse(reinterpret_cast<const char *>(schemaData.data()), reinterpret_cast<const char *>(schemaData.data()) + schemaData.size(), schemaJson, false))
 | 
			
		||||
	{
 | 
			
		||||
		throw std::runtime_error("Schema error: " + jsonReader.getFormattedErrorMessages())	;
 | 
			
		||||
		throw std::runtime_error("ERROR: Json schema wrong: " + jsonReader.getFormattedErrorMessages())	;
 | 
			
		||||
	}
 | 
			
		||||
	JsonSchemaChecker schemaChecker;
 | 
			
		||||
	schemaChecker.setSchema(schemaJson);
 | 
			
		||||
@@ -93,9 +93,9 @@ Json::Value loadConfig(const std::string & configFile)
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
	std::cout
 | 
			
		||||
		<< "Hyperiond:" << std::endl
 | 
			
		||||
		<< "\tversion   : " << HYPERION_VERSION_ID << std::endl
 | 
			
		||||
		<< "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl;
 | 
			
		||||
		<< "Hyperion Ambilight Deamon:" << std::endl
 | 
			
		||||
		<< "\tVersion   : " << HYPERION_VERSION_ID << std::endl
 | 
			
		||||
		<< "\tBuild Time: " << __DATE__ << " " << __TIME__ << std::endl;
 | 
			
		||||
 | 
			
		||||
	// Initialising QCoreApplication
 | 
			
		||||
	QCoreApplication app(argc, argv);
 | 
			
		||||
@@ -109,17 +109,17 @@ int main(int argc, char** argv)
 | 
			
		||||
 | 
			
		||||
	if (argc < 2)
 | 
			
		||||
	{
 | 
			
		||||
		std::cout << "Missing required configuration file. Usage:" << std::endl;
 | 
			
		||||
		std::cout << "ERROR: Missing required configuration file. Usage:" << std::endl;
 | 
			
		||||
		std::cout << "hyperiond [config.file]" << std::endl;
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const std::string configFile = argv[1];
 | 
			
		||||
	std::cout << "Selected configuration file: " << configFile.c_str() << std::endl;
 | 
			
		||||
	std::cout << "INFO: Selected configuration file: " << configFile.c_str() << std::endl;
 | 
			
		||||
	const Json::Value config = loadConfig(configFile);
 | 
			
		||||
 | 
			
		||||
	Hyperion hyperion(config);
 | 
			
		||||
	std::cout << "Hyperion created and initialised" << std::endl;
 | 
			
		||||
	std::cout << "INFO: Hyperion started and initialised" << std::endl;
 | 
			
		||||
 | 
			
		||||
	// create boot sequence if the configuration is present
 | 
			
		||||
	if (config.isMember("bootsequence"))
 | 
			
		||||
@@ -140,7 +140,7 @@ int main(int argc, char** argv)
 | 
			
		||||
		if ( ! effectName.empty() )
 | 
			
		||||
		{
 | 
			
		||||
			int result;
 | 
			
		||||
			std::cout << "Boot sequence '" << effectName << "' ";
 | 
			
		||||
			std::cout << "INFO: Boot sequence '" << effectName << "' ";
 | 
			
		||||
			if (effectConfig.isMember("args"))
 | 
			
		||||
			{
 | 
			
		||||
				std::cout << " (with user defined arguments) ";
 | 
			
		||||
@@ -183,7 +183,7 @@ int main(int argc, char** argv)
 | 
			
		||||
			videoCheckerConfig.get("enable3DDetection", true).asBool());
 | 
			
		||||
 | 
			
		||||
		xbmcVideoChecker->start();
 | 
			
		||||
		std::cout << "XBMC video checker created and started" << std::endl;
 | 
			
		||||
		std::cout << "INFO: Kodi checker created and started" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
// ---- network services -----
 | 
			
		||||
@@ -194,7 +194,7 @@ int main(int argc, char** argv)
 | 
			
		||||
	{
 | 
			
		||||
		const Json::Value & jsonServerConfig = config["jsonServer"];
 | 
			
		||||
		jsonServer = new JsonServer(&hyperion, jsonServerConfig["port"].asUInt());
 | 
			
		||||
		std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl;
 | 
			
		||||
		std::cout << "INFO: Json server created and started on port " << jsonServer->getPort() << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifdef ENABLE_PROTOBUF
 | 
			
		||||
@@ -204,7 +204,7 @@ int main(int argc, char** argv)
 | 
			
		||||
	{
 | 
			
		||||
		const Json::Value & protoServerConfig = config["protoServer"];
 | 
			
		||||
		protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt() );
 | 
			
		||||
		std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl;
 | 
			
		||||
		std::cout << "INFO: Proto server created and started on port " << protoServer->getPort() << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -214,7 +214,7 @@ int main(int argc, char** argv)
 | 
			
		||||
	{
 | 
			
		||||
		const Json::Value & boblightServerConfig = config["boblightServer"];
 | 
			
		||||
		boblightServer = new BoblightServer(&hyperion, boblightServerConfig.get("priority",900).asInt(), boblightServerConfig["port"].asUInt());
 | 
			
		||||
		std::cout << "Boblight server created and started on port " << boblightServer->getPort() << std::endl;
 | 
			
		||||
		std::cout << "INFO: Boblight server created and started on port " << boblightServer->getPort() << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
// ---- grabber -----
 | 
			
		||||
@@ -243,13 +243,13 @@ int main(int argc, char** argv)
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		dispmanx->start();
 | 
			
		||||
		std::cout << "Frame grabber created and started" << std::endl;
 | 
			
		||||
		std::cout << "INFO: Frame grabber created and started" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
#if !defined(ENABLE_OSX) && !defined(ENABLE_FB)
 | 
			
		||||
	if (config.isMember("framegrabber"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The dispmanx framegrabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERRROR: The dispmanx framegrabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
@@ -286,12 +286,12 @@ int main(int argc, char** argv)
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		v4l2Grabber->start();
 | 
			
		||||
		std::cout << "V4l2 grabber created and started" << std::endl;
 | 
			
		||||
		std::cout << "INFO: V4L2 grabber created and started" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
	if (config.isMember("grabber-v4l2"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The v4l2 grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERROR: The v4l2 grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -320,12 +320,12 @@ int main(int argc, char** argv)
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		amlGrabber->start();
 | 
			
		||||
		std::cout << "AMLOGIC grabber created and started" << std::endl;
 | 
			
		||||
		std::cout << "INFO: AMLOGIC grabber created and started" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
	if (config.isMember("amlgrabber"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The AMLOGIC grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERROR: The AMLOGIC grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -354,17 +354,17 @@ int main(int argc, char** argv)
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		fbGrabber->start();
 | 
			
		||||
		std::cout << "Framebuffer grabber created and started" << std::endl;
 | 
			
		||||
		std::cout << "INFO: Framebuffer grabber created and started" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
	if (config.isMember("framebuffergrabber"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The framebuffer grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERROR: The framebuffer grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#if !defined(ENABLE_DISPMANX) && !defined(ENABLE_OSX)
 | 
			
		||||
	else if (config.isMember("framegrabber"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The framebuffer grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERROR: The framebuffer grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
@@ -394,17 +394,17 @@ int main(int argc, char** argv)
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		osxGrabber->start();
 | 
			
		||||
		std::cout << "OSX grabber created and started" << std::endl;
 | 
			
		||||
		std::cout << "INFO: OSX grabber created and started" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
	if (config.isMember("osxgrabber"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The osx grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERROR: The osx grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#if !defined(ENABLE_DISPMANX) && !defined(ENABLE_FB)
 | 
			
		||||
	else if (config.isMember("framegrabber"))
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "The osx grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
		std::cerr << "ERROR: The osx grabber can not be instantiated, because it has been left out from the build" << std::endl;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
@@ -412,7 +412,7 @@ int main(int argc, char** argv)
 | 
			
		||||
 | 
			
		||||
	// run the application
 | 
			
		||||
	int rc = app.exec();
 | 
			
		||||
	std::cout << "Application closed with code " << rc << std::endl;
 | 
			
		||||
	std::cout << "INFO: Application closed with code " << rc << std::endl;
 | 
			
		||||
 | 
			
		||||
	// Delete all component
 | 
			
		||||
#ifdef ENABLE_DISPMANX
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user