2016-02-24 16:03:21 +01:00
|
|
|
|
|
|
|
// Hyperion-AmLogic includes
|
|
|
|
#include "AmlogicWrapper.h"
|
|
|
|
|
|
|
|
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) :
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer(this),
|
|
|
|
_grabber(grabWidth, grabHeight)
|
2016-02-24 16:03:21 +01:00
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.setSingleShot(false);
|
|
|
|
_timer.setInterval(updateRate_Hz);
|
2016-02-24 16:03:21 +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-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
|
|
|
{
|
|
|
|
capture();
|
|
|
|
return _screenshot_rgb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AmlogicWrapper::start()
|
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.start();
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmlogicWrapper::stop()
|
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.stop();
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmlogicWrapper::capture()
|
|
|
|
{
|
|
|
|
_grabber.grabFrame(_screenshot);
|
|
|
|
_screenshot.toRgb(_screenshot_rgb);
|
|
|
|
|
|
|
|
emit sig_screenshot(_screenshot_rgb);
|
|
|
|
}
|