Standalone grabber: Add --debug switch

This commit is contained in:
LordGrey 2021-05-11 21:06:03 +02:00
parent 2035a3cfab
commit 3b843c0d23
8 changed files with 94 additions and 16 deletions

View File

@ -26,6 +26,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("AMLOGIC");
Logger::setLogLevel(Logger::INFO);
std::cout std::cout
<< "hyperion-aml:" << std::endl << "hyperion-aml:" << std::endl
<< "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << 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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
parser.process(app); 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. // check if we need to display the usage. exit if we do.
if (parser.isSet(argHelp)) if (parser.isSet(argHelp))
{ {
@ -94,8 +104,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("AMLOGIC"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }
return 0; return 0;

View File

@ -26,6 +26,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("DISPMANX");
Logger::setLogLevel(Logger::INFO);
std::cout std::cout
<< "hyperion-dispmanx:" << std::endl << "hyperion-dispmanx:" << std::endl
<< "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << 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"); 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"); 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 & 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 & 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"); 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 & 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 & 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 // parse all options
parser.process(app); parser.process(app);
// check if debug logging is required
if (parser.isSet(argDebug))
{
Logger::setLogLevel(Logger::DEBUG);
}
VideoMode videoMode = VideoMode::VIDEO_2D; VideoMode videoMode = VideoMode::VIDEO_2D;
if (parser.isSet(arg3DSBS)) if (parser.isSet(arg3DSBS))
@ -123,8 +134,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("DISPMANXGRABBER"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }

View File

@ -23,6 +23,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("FRAMEBUFFER");
Logger::setLogLevel(Logger::INFO);
DefaultSignalHandler::install(); DefaultSignalHandler::install();
QCoreApplication app(argc, argv); 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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
@ -51,6 +55,12 @@ int main(int argc, char ** argv)
parser.showHelp(0); 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)); FramebufferWrapper fbWrapper(argDevice.value(parser), argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
if (parser.isSet(argScreenshot)) if (parser.isSet(argScreenshot))
@ -88,8 +98,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("FRAMEBUFFER"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }
return 0; return 0;

View File

@ -25,6 +25,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("OSXGRABBER");
Logger::setLogLevel(Logger::INFO);
DefaultSignalHandler::install(); DefaultSignalHandler::install();
QCoreApplication app(argc, argv); 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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all arguments // parse all arguments
parser.process(app); 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. // check if we need to display the usage. exit if we do.
if (parser.isSet(argHelp)) if (parser.isSet(argHelp))
{ {
@ -91,8 +101,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("OSXGRABBER"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }
return 0; return 0;

View File

@ -26,6 +26,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("QTGRABBER");
Logger::setLogLevel(Logger::INFO);
//QCoreApplication app(argc, argv); //QCoreApplication app(argc, argv);
QGuiApplication 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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all arguments // parse all arguments
parser.process(app); 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. // check if we need to display the usage. exit if we do.
if (parser.isSet(argHelp)) if (parser.isSet(argHelp))
{ {
@ -103,8 +113,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("QTGRABBER"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }
return 0; return 0;

View File

@ -31,7 +31,7 @@ using namespace commandline;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
Logger *log = Logger::getInstance("V4L2GRABBER"); Logger *log = Logger::getInstance("V4L2GRABBER");
Logger::setLogLevel(Logger::WARNING); Logger::setLogLevel(Logger::INFO);
std::cout std::cout
<< "hyperion-v4l2:" << std::endl << "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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
argVideoStandard.addSwitch("pal", VideoStandard::PAL); argVideoStandard.addSwitch("pal", VideoStandard::PAL);
@ -108,6 +109,12 @@ int main(int argc, char** argv)
// parse all options // parse all options
parser.process(app); 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. // check if we need to display the usage. exit if we do.
if (parser.isSet(argHelp)) if (parser.isSet(argHelp))
{ {

View File

@ -24,6 +24,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("X11GRABBER");
Logger::setLogLevel(Logger::INFO);
std::cout std::cout
<< "hyperion-x11:" << std::endl << "hyperion-x11:" << std::endl
<< "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << 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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
parser.process(app); 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. // check if we need to display the usage. exit if we do.
if (parser.isSet(argHelp)) if (parser.isSet(argHelp))
{ {
@ -106,8 +116,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("X11GRABBER"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }

View File

@ -24,6 +24,9 @@ void saveScreenshot(QString filename, const Image<ColorRgb> & image)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
Logger *log = Logger::getInstance("XCBGRABBER");
Logger::setLogLevel(Logger::INFO);
std::cout std::cout
<< "hyperion-xcb:" << std::endl << "hyperion-xcb:" << std::endl
<< "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << 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"); 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"); 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 & 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"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
parser.process(app); 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. // check if we need to display the usage. exit if we do.
if (parser.isSet(argHelp)) if (parser.isSet(argHelp))
{ {
@ -106,8 +116,8 @@ int main(int argc, char ** argv)
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)
{ {
// An error occured. Display error and quit // An error occurred. Display error and quit
Error(Logger::getInstance("XCBGRABBER"), "%s", e.what()); Error(log, "%s", e.what());
return -1; return -1;
} }