mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Standalone grabber: Add --debug switch
This commit is contained in:
		@@ -26,6 +26,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("AMLOGIC");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
 | 
			
		||||
	std::cout
 | 
			
		||||
		<< "hyperion-aml:" << std::endl
 | 
			
		||||
		<< "\tVersion   : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl
 | 
			
		||||
@@ -46,11 +49,18 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option        & argAddress    = parser.add<Option>       ('a', "address",    "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption     & argPriority   = parser.add<IntOption>    ('p', "priority",   "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption & argSkipReply  = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption & argDebug      = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption & argHelp       = parser.add<BooleanOption>('h', "help",       "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		// parse all options
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}		
 | 
			
		||||
 | 
			
		||||
		// check if we need to display the usage. exit if we do.
 | 
			
		||||
		if (parser.isSet(argHelp))
 | 
			
		||||
		{
 | 
			
		||||
@@ -94,8 +104,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
		Error(Logger::getInstance("AMLOGIC"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("DISPMANX");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
	
 | 
			
		||||
	std::cout
 | 
			
		||||
		<< "hyperion-dispmanx:" << std::endl
 | 
			
		||||
		<< "\tVersion   : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl
 | 
			
		||||
@@ -48,7 +51,6 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option         & argAddress    = parser.add<Option>       ('a', "address",     "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption      & argPriority   = parser.add<IntOption>    ('p', "priority",    "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption  & argSkipReply  = parser.add<BooleanOption>(0x0, "skip-reply",  "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption  & argHelp       = parser.add<BooleanOption>('h', "help",        "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		IntOption      & argCropLeft   = parser.add<IntOption>    (0x0, "crop-left",   "pixels to remove on left after grabbing");
 | 
			
		||||
		IntOption      & argCropRight  = parser.add<IntOption>    (0x0, "crop-right",  "pixels to remove on right after grabbing");
 | 
			
		||||
@@ -58,9 +60,18 @@ int main(int argc, char ** argv)
 | 
			
		||||
		BooleanOption  & arg3DSBS      = parser.add<BooleanOption>(0x0, "3DSBS",       "Interpret the incoming video stream as 3D side-by-side");
 | 
			
		||||
		BooleanOption  & arg3DTAB      = parser.add<BooleanOption>(0x0, "3DTAB",       "Interpret the incoming video stream as 3D top-and-bottom");
 | 
			
		||||
 | 
			
		||||
		BooleanOption & argDebug       = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption  & argHelp       = parser.add<BooleanOption>('h', "help",        "Show this help message and exit");		
 | 
			
		||||
 | 
			
		||||
		// parse all options
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		VideoMode videoMode = VideoMode::VIDEO_2D;
 | 
			
		||||
 | 
			
		||||
		if (parser.isSet(arg3DSBS))
 | 
			
		||||
@@ -123,8 +134,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
                Error(Logger::getInstance("DISPMANXGRABBER"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("FRAMEBUFFER");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
 | 
			
		||||
	DefaultSignalHandler::install();
 | 
			
		||||
 | 
			
		||||
	QCoreApplication app(argc, argv);
 | 
			
		||||
@@ -40,6 +43,7 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option        & argAddress    = parser.add<Option>       ('a', "address",    "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption     & argPriority   = parser.add<IntOption>    ('p', "priority",   "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption & argSkipReply  = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption & argDebug      = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption & argHelp       = parser.add<BooleanOption>('h', "help",        "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		// parse all options
 | 
			
		||||
@@ -51,6 +55,12 @@ int main(int argc, char ** argv)
 | 
			
		||||
			parser.showHelp(0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		FramebufferWrapper fbWrapper(argDevice.value(parser), argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
 | 
			
		||||
 | 
			
		||||
		if (parser.isSet(argScreenshot))
 | 
			
		||||
@@ -88,8 +98,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
                Error(Logger::getInstance("FRAMEBUFFER"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("OSXGRABBER");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
	
 | 
			
		||||
	DefaultSignalHandler::install();
 | 
			
		||||
 | 
			
		||||
	QCoreApplication app(argc, argv);
 | 
			
		||||
@@ -42,11 +45,18 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option        & argAddress    = parser.add<Option>       ('a', "address",    "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption     & argPriority   = parser.add<IntOption>    ('p', "priority",   "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption & argSkipReply  = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption & argDebug      = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption & argHelp       = parser.add<BooleanOption>('h', "help",        "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		// parse all arguments
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}		
 | 
			
		||||
 | 
			
		||||
		// check if we need to display the usage. exit if we do.
 | 
			
		||||
		if (parser.isSet(argHelp))
 | 
			
		||||
		{
 | 
			
		||||
@@ -91,8 +101,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
		Error(Logger::getInstance("OSXGRABBER"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("QTGRABBER");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
 | 
			
		||||
	//QCoreApplication app(argc, argv);
 | 
			
		||||
	QGuiApplication app(argc, argv);
 | 
			
		||||
 | 
			
		||||
@@ -45,11 +48,18 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option        & argAddress         = parser.add<Option>       ('a', "address",    "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption     & argPriority        = parser.add<IntOption>    ('p', "priority",   "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption & argSkipReply       = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption & argDebug           = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption & argHelp            = parser.add<BooleanOption>('h', "help",        "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		// parse all arguments
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// check if we need to display the usage. exit if we do.
 | 
			
		||||
		if (parser.isSet(argHelp))
 | 
			
		||||
		{
 | 
			
		||||
@@ -103,8 +113,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
		Error(Logger::getInstance("QTGRABBER"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ using namespace commandline;
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("V4L2GRABBER");
 | 
			
		||||
	Logger::setLogLevel(Logger::WARNING);
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
 | 
			
		||||
	std::cout
 | 
			
		||||
		<< "hyperion-v4l2:" << std::endl
 | 
			
		||||
@@ -85,6 +85,7 @@ int main(int argc, char** argv)
 | 
			
		||||
		Option             & argAddress             = parser.add<Option>       ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption          & argPriority            = parser.add<IntOption>    ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption      & argSkipReply           = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption      & argDebug               = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption      & argHelp                = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		argVideoStandard.addSwitch("pal", VideoStandard::PAL);
 | 
			
		||||
@@ -108,6 +109,12 @@ int main(int argc, char** argv)
 | 
			
		||||
		// parse all options
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// check if we need to display the usage. exit if we do.
 | 
			
		||||
		if (parser.isSet(argHelp))
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("X11GRABBER");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
 | 
			
		||||
	 std::cout
 | 
			
		||||
		<< "hyperion-x11:" << std::endl
 | 
			
		||||
		<< "\tVersion   : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl
 | 
			
		||||
@@ -49,11 +52,18 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option              & argAddress         = parser.add<Option>       ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption           & argPriority        = parser.add<IntOption>    ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption       & argSkipReply       = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption       & argDebug           = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption       & argHelp            = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		// parse all options
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// check if we need to display the usage. exit if we do.
 | 
			
		||||
		if (parser.isSet(argHelp))
 | 
			
		||||
		{
 | 
			
		||||
@@ -106,8 +116,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
		Error(Logger::getInstance("X11GRABBER"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char ** argv)
 | 
			
		||||
{
 | 
			
		||||
	Logger *log = Logger::getInstance("XCBGRABBER");
 | 
			
		||||
	Logger::setLogLevel(Logger::INFO);
 | 
			
		||||
 | 
			
		||||
	 std::cout
 | 
			
		||||
		<< "hyperion-xcb:" << std::endl
 | 
			
		||||
		<< "\tVersion   : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl
 | 
			
		||||
@@ -49,11 +52,18 @@ int main(int argc, char ** argv)
 | 
			
		||||
		Option              & argAddress         = parser.add<Option>       ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
 | 
			
		||||
		IntOption           & argPriority        = parser.add<IntOption>    ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
 | 
			
		||||
		BooleanOption       & argSkipReply       = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
 | 
			
		||||
		BooleanOption       & argDebug           = parser.add<BooleanOption>(0x0, "debug", "Enable debug logging");
 | 
			
		||||
		BooleanOption       & argHelp            = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
 | 
			
		||||
 | 
			
		||||
		// parse all options
 | 
			
		||||
		parser.process(app);
 | 
			
		||||
 | 
			
		||||
		// check if debug logging is required
 | 
			
		||||
		if (parser.isSet(argDebug))
 | 
			
		||||
		{
 | 
			
		||||
			Logger::setLogLevel(Logger::DEBUG);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// check if we need to display the usage. exit if we do.
 | 
			
		||||
		if (parser.isSet(argHelp))
 | 
			
		||||
		{
 | 
			
		||||
@@ -106,8 +116,8 @@ int main(int argc, char ** argv)
 | 
			
		||||
	}
 | 
			
		||||
	catch (const std::runtime_error & e)
 | 
			
		||||
	{
 | 
			
		||||
		// An error occured. Display error and quit
 | 
			
		||||
		Error(Logger::getInstance("XCBGRABBER"), "%s", e.what());
 | 
			
		||||
		// An error occurred. Display error and quit
 | 
			
		||||
		Error(log, "%s", e.what());
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user