hyperion.ng/src/hyperion-aml/AmlogicWrapper.cpp

43 lines
752 B
C++
Raw Normal View History

// Hyperion-AmLogic includes
#include "AmlogicWrapper.h"
// Linux includes
#include <unistd.h>
2020-08-08 13:09:15 +02:00
AmlogicWrapper::AmlogicWrapper(unsigned grabWidth, unsigned grabHeight) :
_thread(this),
2019-03-27 08:07:45 +01:00
_grabber(grabWidth, grabHeight)
{
_thread.setObjectName("AmlogicWrapperThread");
// Connect capturing to the timeout signal of the timer
connect(&_thread, SIGNAL (started()), this, SLOT(capture()));
}
const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
{
capture();
return _screenshot;
}
void AmlogicWrapper::start()
{
_thread.start();
}
void AmlogicWrapper::stop()
{
_thread.quit();
}
void AmlogicWrapper::capture()
{
while (_thread.isRunning())
{
_grabber.grabFrame(_screenshot);
emit sig_screenshot(_screenshot);
usleep(1 * 1000);
}
}