Rework log messages

Former-commit-id: eac93c0fd78fdf353e940d08df3cabf0b962a3e2
This commit is contained in:
brindosch
2016-03-23 17:40:34 +01:00
parent dcd518b6cc
commit fa66c3b2b5
27 changed files with 147 additions and 147 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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());
}

View File

@@ -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();