2016-02-24 14:34:19 +01:00
|
|
|
|
2016-02-24 16:03:21 +01:00
|
|
|
// Hyperion-Dispmanx includes
|
2016-02-24 14:34:19 +01:00
|
|
|
#include "DispmanxWrapper.h"
|
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
DispmanxWrapper::DispmanxWrapper(unsigned grabWidth, unsigned grabHeight,
|
|
|
|
VideoMode videoMode,
|
|
|
|
unsigned cropLeft, unsigned cropRight,
|
|
|
|
unsigned cropTop, unsigned cropBottom,
|
|
|
|
unsigned updateRate_Hz) :
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer(this),
|
|
|
|
_grabber(grabWidth, grabHeight)
|
2016-02-24 14:34:19 +01:00
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_grabber.setVideoMode(videoMode);
|
|
|
|
_grabber.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
|
|
|
_timer.setSingleShot(false);
|
|
|
|
_timer.setInterval(updateRate_Hz);
|
2016-02-24 14:34:19 +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 14:34:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Image<ColorRgb> & DispmanxWrapper::getScreenshot()
|
|
|
|
{
|
|
|
|
capture();
|
2017-08-12 07:55:32 +02:00
|
|
|
return _screenshot;
|
2016-02-24 14:34:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DispmanxWrapper::start()
|
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.start();
|
2016-02-24 14:34:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DispmanxWrapper::stop()
|
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.stop();
|
2016-02-24 14:34:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DispmanxWrapper::capture()
|
|
|
|
{
|
|
|
|
_grabber.grabFrame(_screenshot);
|
2017-08-12 07:55:32 +02:00
|
|
|
emit sig_screenshot(_screenshot);
|
2016-02-24 14:34:19 +01:00
|
|
|
}
|