From 7b9b9bcdef284a415075740bd74fbe51dc136c66 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Tue, 12 Jul 2016 23:13:06 +1000 Subject: [PATCH] logging migration of blackborder and grabber (#108) * logging migration of blackborder and grabber * change to "Debug" for noise blackborder log messages --- include/hyperion/ImageProcessor.h | 6 ++++-- libsrc/grabber/v4l2/V4L2Grabber.cpp | 5 +++-- libsrc/leddevice/LedDevicePiBlaster.cpp | 1 - src/hyperion-aml/hyperion-aml.cpp | 6 ++++-- src/hyperion-dispmanx/hyperion-dispmanx.cpp | 2 +- src/hyperion-framebuffer/hyperion-framebuffer.cpp | 4 ++-- src/hyperion-osx/hyperion-osx.cpp | 4 ++-- src/hyperion-v4l2/hyperion-v4l2.cpp | 2 +- src/hyperion-x11/hyperion-x11.cpp | 2 +- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/hyperion/ImageProcessor.h b/include/hyperion/ImageProcessor.h index 338c18e7..2b84d7a2 100644 --- a/include/hyperion/ImageProcessor.h +++ b/include/hyperion/ImageProcessor.h @@ -8,6 +8,7 @@ #include #include #include +#include // Black border includes #include @@ -118,7 +119,7 @@ private: { if(_enableBlackBorderRemoval && _borderProcessor->process(image)) { - std::cout << "BORDER SWITCH REQUIRED!!" << std::endl; + Debug(Logger::getInstance("BLACKBORDER"), "BORDER SWITCH REQUIRED!!"); const hyperion::BlackBorder border = _borderProcessor->getCurrentBorder(); @@ -136,7 +137,8 @@ private: _imageToLeds = new hyperion::ImageToLedsMap(image.width(), image.height(), border.horizontalSize, border.verticalSize, _ledString.leds()); } - std::cout << "CURRENT BORDER TYPE: unknown=" << border.unknown << " hor.size=" << border.horizontalSize << " vert.size=" << border.verticalSize << std::endl; + Debug(Logger::getInstance("BLACKBORDER"), "CURRENT BORDER TYPE: unknown=%d hor.size=%d vert.size=%d", + border.unknown, border.horizontalSize, border.verticalSize ); } } diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index cadbc6e0..fe6de6ba 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -412,8 +412,9 @@ void V4L2Grabber::init_device(VideoStandard videoStandard, int input) _width = fmt.fmt.pix.width; _height = fmt.fmt.pix.height; - // print the eventually used width and height - std::cout << "V4L2GRABBER INFO: width=" << _width << " height=" << _height << std::endl; + // display the used width and height + Info(Logger::getInstance("V4l2GRABBER"), "width=%d height=%d", _width, _height ); + // check pixel format and frame size switch (fmt.fmt.pix.pixelformat) diff --git a/libsrc/leddevice/LedDevicePiBlaster.cpp b/libsrc/leddevice/LedDevicePiBlaster.cpp index b1bc4994..102d4139 100644 --- a/libsrc/leddevice/LedDevicePiBlaster.cpp +++ b/libsrc/leddevice/LedDevicePiBlaster.cpp @@ -1,6 +1,5 @@ // STL includes -#include #include #include diff --git a/src/hyperion-aml/hyperion-aml.cpp b/src/hyperion-aml/hyperion-aml.cpp index 887daad1..191b871e 100644 --- a/src/hyperion-aml/hyperion-aml.cpp +++ b/src/hyperion-aml/hyperion-aml.cpp @@ -11,6 +11,7 @@ #include "AmlogicWrapper.h" #include "HyperionConfig.h" +#include using namespace vlofgren; @@ -68,7 +69,8 @@ int main(int argc, char ** argv) int height = argHeight.getValue(); if (width < 160 || height < 160) { - std::cout << "Minimum width and height is 160" << std::endl; + Warning(Logger::getInstance("AMLOGIC"), "Minimum width and height is 160"); + width = std::max(160, width); height = std::max(160, height); } @@ -100,7 +102,7 @@ int main(int argc, char ** argv) catch (const std::runtime_error & e) { // An error occured. Display error and quit - std::cerr << e.what() << std::endl; + Error(Logger::getInstance("AMLOGIC"), "%s", e.what()); return -1; } return 0; diff --git a/src/hyperion-dispmanx/hyperion-dispmanx.cpp b/src/hyperion-dispmanx/hyperion-dispmanx.cpp index 853fe2dd..c279bb17 100644 --- a/src/hyperion-dispmanx/hyperion-dispmanx.cpp +++ b/src/hyperion-dispmanx/hyperion-dispmanx.cpp @@ -121,7 +121,7 @@ int main(int argc, char ** argv) catch (const std::runtime_error & e) { // An error occured. Display error and quit - std::cerr << e.what() << std::endl; + Error(Logger::getInstance("DISPMANXGRABBER"), "%s", e.what()); return -1; } diff --git a/src/hyperion-framebuffer/hyperion-framebuffer.cpp b/src/hyperion-framebuffer/hyperion-framebuffer.cpp index d33603a0..6740ab3a 100644 --- a/src/hyperion-framebuffer/hyperion-framebuffer.cpp +++ b/src/hyperion-framebuffer/hyperion-framebuffer.cpp @@ -62,7 +62,7 @@ int main(int argc, char ** argv) int height = argHeight.getValue(); if (width < 160 || height < 160) { - std::cout << "Minimum width and height is 160" << std::endl; + Warning(Logger::getInstance("FRAMEBUFFER"), "Minimum width and height is 160"); width = std::max(160, width); height = std::max(160, height); } @@ -94,7 +94,7 @@ int main(int argc, char ** argv) catch (const std::runtime_error & e) { // An error occured. Display error and quit - std::cerr << e.what() << std::endl; + Error(Logger::getInstance("FRAMEBUFFER"), "%s", e.what()); return -1; } return 0; diff --git a/src/hyperion-osx/hyperion-osx.cpp b/src/hyperion-osx/hyperion-osx.cpp index f1d11b74..79e0ac7c 100644 --- a/src/hyperion-osx/hyperion-osx.cpp +++ b/src/hyperion-osx/hyperion-osx.cpp @@ -62,7 +62,7 @@ int main(int argc, char ** argv) int height = argHeight.getValue(); if (width < 160 || height < 160) { - std::cout << "Minimum width and height is 160" << std::endl; + Warning(Logger::getInstance("OSXGRABBER"), "Minimum width and height is 160"); width = std::max(160, width); height = std::max(160, height); } @@ -94,7 +94,7 @@ int main(int argc, char ** argv) catch (const std::runtime_error & e) { // An error occured. Display error and quit - std::cerr << e.what() << std::endl; + Error(Logger::getInstance("OSXGRABBER"), "%s", e.what()); return -1; } return 0; diff --git a/src/hyperion-v4l2/hyperion-v4l2.cpp b/src/hyperion-v4l2/hyperion-v4l2.cpp index 31895dbc..59cf69ad 100644 --- a/src/hyperion-v4l2/hyperion-v4l2.cpp +++ b/src/hyperion-v4l2/hyperion-v4l2.cpp @@ -172,7 +172,7 @@ int main(int argc, char** argv) catch (const std::runtime_error & e) { // An error occured. Display error and quit - std::cerr << e.what() << std::endl; + Error(Logger::getInstance("V4L2GRABBER"), "%s", e.what()); return 1; } diff --git a/src/hyperion-x11/hyperion-x11.cpp b/src/hyperion-x11/hyperion-x11.cpp index 55a6701b..533df97a 100644 --- a/src/hyperion-x11/hyperion-x11.cpp +++ b/src/hyperion-x11/hyperion-x11.cpp @@ -118,7 +118,7 @@ int main(int argc, char ** argv) catch (const std::runtime_error & e) { // An error occured. Display error and quit - std::cerr << e.what() << std::endl; + Error(Logger::getInstance("X11GRABBER"), "%s", e.what()); return -1; }