mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
* BCM dynamic loading * cleanup * better handle start of dispmanx * set GrabberWrapper pointer to null on exit * Update DispmanxFrameGrabber.cpp
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
|
|
#include "DispmanxWrapper.h"
|
|
|
|
DispmanxWrapper::DispmanxWrapper( int updateRate_Hz,
|
|
int pixelDecimation,
|
|
int cropLeft, int cropRight,
|
|
int cropTop, int cropBottom
|
|
) :
|
|
_timer(this),
|
|
_grabber()
|
|
{
|
|
_grabber.setFramerate(updateRate_Hz);
|
|
_grabber.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
|
_grabber.setPixelDecimation(pixelDecimation);
|
|
|
|
_timer.setTimerType(Qt::PreciseTimer);
|
|
_timer.setSingleShot(false);
|
|
_timer.setInterval(_grabber.getUpdateInterval());
|
|
|
|
// Connect capturing to the timeout signal of the timer
|
|
connect(&_timer, SIGNAL(timeout()), this, SLOT(capture()));
|
|
}
|
|
|
|
const Image<ColorRgb> & DispmanxWrapper::getScreenshot()
|
|
{
|
|
capture();
|
|
return _screenshot;
|
|
}
|
|
|
|
bool DispmanxWrapper::open()
|
|
{
|
|
return _grabber.open();
|
|
}
|
|
|
|
void DispmanxWrapper::start()
|
|
{
|
|
_timer.start();
|
|
}
|
|
|
|
void DispmanxWrapper::stop()
|
|
{
|
|
_timer.stop();
|
|
}
|
|
|
|
bool DispmanxWrapper::screenInit()
|
|
{
|
|
return (open() && _grabber.setupScreen());
|
|
}
|
|
|
|
void DispmanxWrapper::capture()
|
|
{
|
|
if ( open() )
|
|
{
|
|
_grabber.grabFrame(_screenshot);
|
|
emit sig_screenshot(_screenshot);
|
|
}
|
|
}
|
|
|
|
void DispmanxWrapper::setVideoMode(VideoMode mode)
|
|
{
|
|
_grabber.setVideoMode(mode);
|
|
}
|
|
|