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"
|
|
|
|
|
2016-05-18 11:26:25 +02:00
|
|
|
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight,
|
|
|
|
const VideoMode& videoMode,
|
|
|
|
const unsigned cropLeft, const unsigned cropRight,
|
|
|
|
const unsigned cropTop, const unsigned cropBottom,
|
|
|
|
const 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();
|
|
|
|
return _screenshot_rgb;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
_screenshot.toRgb(_screenshot_rgb);
|
|
|
|
|
|
|
|
emit sig_screenshot(_screenshot_rgb);
|
|
|
|
}
|