mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Stop Framebuffer grabber on failure
This commit is contained in:
parent
d72a59e981
commit
545b29ed27
@ -24,24 +24,30 @@ int FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
|
|||||||
{
|
{
|
||||||
if (!_enabled) return 0;
|
if (!_enabled) return 0;
|
||||||
|
|
||||||
struct fb_var_screeninfo vinfo;
|
|
||||||
unsigned capSize, bytesPerPixel;
|
|
||||||
PixelFormat pixelFormat;
|
|
||||||
|
|
||||||
/* Open the framebuffer device */
|
/* Open the framebuffer device */
|
||||||
int fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY);
|
int fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY);
|
||||||
if (fbfd == -1)
|
if (fbfd == -1)
|
||||||
{
|
{
|
||||||
Error(_log, "Error opening %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno));
|
Error(_log, "Error opening %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno));
|
||||||
|
setEnabled(false);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get variable screen information */
|
/* get variable screen information */
|
||||||
ioctl (fbfd, FBIOGET_VSCREENINFO, &vinfo);
|
struct fb_var_screeninfo vinfo;
|
||||||
|
int result = ioctl (fbfd, FBIOGET_VSCREENINFO, &vinfo);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
Error(_log, "Could not get screen information, %s", std::strerror(errno));
|
||||||
|
close(fbfd);
|
||||||
|
setEnabled(false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bytesPerPixel = vinfo.bits_per_pixel / 8;
|
unsigned bytesPerPixel = vinfo.bits_per_pixel / 8;
|
||||||
capSize = vinfo.xres * vinfo.yres * bytesPerPixel;
|
unsigned capSize = vinfo.xres * vinfo.yres * bytesPerPixel;
|
||||||
|
|
||||||
|
PixelFormat pixelFormat;
|
||||||
switch (vinfo.bits_per_pixel)
|
switch (vinfo.bits_per_pixel)
|
||||||
{
|
{
|
||||||
case 16: pixelFormat = PixelFormat::BGR16; break;
|
case 16: pixelFormat = PixelFormat::BGR16; break;
|
||||||
@ -84,22 +90,23 @@ void FramebufferFrameGrabber::setDevicePath(const QString& path)
|
|||||||
if(_fbDevice != path)
|
if(_fbDevice != path)
|
||||||
{
|
{
|
||||||
_fbDevice = path;
|
_fbDevice = path;
|
||||||
int result;
|
|
||||||
struct fb_var_screeninfo vinfo;
|
|
||||||
|
|
||||||
// Check if the framebuffer device can be opened and display the current resolution
|
// Check if the framebuffer device can be opened and display the current resolution
|
||||||
int fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY);
|
int fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY);
|
||||||
if (fbfd == -1)
|
if (fbfd == -1)
|
||||||
{
|
{
|
||||||
Error(_log, "Error opening %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno));
|
Error(_log, "Error opening %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno));
|
||||||
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get variable screen information
|
// get variable screen information
|
||||||
result = ioctl (fbfd, FBIOGET_VSCREENINFO, &vinfo);
|
struct fb_var_screeninfo vinfo;
|
||||||
|
int result = ioctl (fbfd, FBIOGET_VSCREENINFO, &vinfo);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
Error(_log, "Could not get screen information, %s", std::strerror(errno));
|
Error(_log, "Could not get screen information, %s", std::strerror(errno));
|
||||||
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -49,8 +49,9 @@ bool GrabberWrapper::start()
|
|||||||
// Start the timer with the pre configured interval
|
// Start the timer with the pre configured interval
|
||||||
Debug(_log,"Grabber start()");
|
Debug(_log,"Grabber start()");
|
||||||
_timer->start();
|
_timer->start();
|
||||||
return _timer->isActive();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return _timer->isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrabberWrapper::stop()
|
void GrabberWrapper::stop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user