2016-03-09 07:03:17 +01:00
|
|
|
|
|
|
|
// Hyperion-AmLogic includes
|
|
|
|
#include "FramebufferWrapper.h"
|
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
FramebufferWrapper::FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) :
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer(this),
|
|
|
|
_grabber(device,grabWidth, grabHeight)
|
2016-03-09 07:03:17 +01:00
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.setSingleShot(false);
|
|
|
|
_timer.setInterval(updateRate_Hz);
|
2016-03-09 07:03:17 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
// Connect capturing to the timeout signal of the timer
|
|
|
|
connect(&_timer, SIGNAL(timeout()), this, SLOT(capture()));
|
2016-03-09 07:03:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Image<ColorRgb> & FramebufferWrapper::getScreenshot()
|
|
|
|
{
|
|
|
|
capture();
|
|
|
|
return _screenshot;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FramebufferWrapper::start()
|
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.start();
|
2016-03-09 07:03:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void FramebufferWrapper::stop()
|
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.stop();
|
2016-03-09 07:03:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void FramebufferWrapper::capture()
|
|
|
|
{
|
|
|
|
_grabber.grabFrame(_screenshot);
|
|
|
|
|
|
|
|
emit sig_screenshot(_screenshot);
|
|
|
|
}
|