2020-08-03 12:31:39 +02:00
|
|
|
#include <grabber/XcbWrapper.h>
|
|
|
|
|
|
|
|
XcbWrapper::XcbWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz)
|
|
|
|
: GrabberWrapper("Xcb", &_grabber, 0, 0, updateRate_Hz)
|
|
|
|
, _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation)
|
|
|
|
, _init(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
XcbWrapper::~XcbWrapper()
|
|
|
|
{
|
|
|
|
if ( _init )
|
|
|
|
{
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void XcbWrapper::action()
|
|
|
|
{
|
|
|
|
if (! _init )
|
|
|
|
{
|
|
|
|
_init = true;
|
2021-04-04 12:43:29 +02:00
|
|
|
if ( ! _grabber.setupDisplay() )
|
2020-08-03 12:31:39 +02:00
|
|
|
{
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_grabber.updateScreenDimensions() < 0 )
|
|
|
|
{
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isActive())
|
|
|
|
{
|
|
|
|
transferFrame(_grabber);
|
|
|
|
}
|
|
|
|
}
|