2016-02-24 16:03:21 +01:00
|
|
|
|
|
|
|
// Hyperion-AmLogic includes
|
|
|
|
#include "AmlogicWrapper.h"
|
|
|
|
|
2019-03-27 09:07:20 +01:00
|
|
|
// Linux includes
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight) :
|
|
|
|
_thread(this),
|
2019-03-27 08:07:45 +01:00
|
|
|
_grabber(grabWidth, grabHeight)
|
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
|
2019-03-27 09:07:20 +01:00
|
|
|
connect(&_thread, SIGNAL (started()), this, SLOT(capture()));
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
|
|
|
{
|
|
|
|
capture();
|
2017-08-12 07:55:32 +02:00
|
|
|
return _screenshot;
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmlogicWrapper::start()
|
|
|
|
{
|
2019-03-27 09:07:20 +01:00
|
|
|
_thread.start();
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmlogicWrapper::stop()
|
|
|
|
{
|
2019-03-27 09:07:20 +01:00
|
|
|
_thread.quit();
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmlogicWrapper::capture()
|
|
|
|
{
|
2019-03-27 09:07:20 +01:00
|
|
|
while (_thread.isRunning())
|
|
|
|
{
|
|
|
|
_grabber.grabFrame(_screenshot);
|
|
|
|
emit sig_screenshot(_screenshot);
|
|
|
|
usleep(1 * 1000);
|
|
|
|
}
|
2016-02-24 16:03:21 +01:00
|
|
|
}
|