mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Feature/xcb grabber (#912)
* Add Xcb grabber * update compile instruction Signed-off-by: Paulchen Panther <Paulchen-Panter@protonmail.com> * Fix problem on resolution change + Make XCB default if X11 is not avaialable * Fix decimation problem Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Co-authored-by: Paulchen Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -72,8 +72,13 @@ void X11Grabber::setupResources()
|
||||
_shminfo.readOnly = False;
|
||||
XShmAttach(_x11Display, &_shminfo);
|
||||
}
|
||||
|
||||
if (_XRenderAvailable)
|
||||
{
|
||||
_useImageResampler = false;
|
||||
_imageResampler.setHorizontalPixelDecimation(1);
|
||||
_imageResampler.setVerticalPixelDecimation(1);
|
||||
|
||||
if(_XShmPixmapAvailable)
|
||||
{
|
||||
_pixmap = XShmCreatePixmap(_x11Display, _window, _xImage->data, &_shminfo, _width, _height, _windowAttr.depth);
|
||||
@@ -86,8 +91,16 @@ void X11Grabber::setupResources()
|
||||
_dstFormat = XRenderFindVisualFormat(_x11Display, _windowAttr.visual);
|
||||
_srcPicture = XRenderCreatePicture(_x11Display, _window, _srcFormat, CPRepeat, &_pictAttr);
|
||||
_dstPicture = XRenderCreatePicture(_x11Display, _pixmap, _dstFormat, CPRepeat, &_pictAttr);
|
||||
|
||||
XRenderSetPictureFilter(_x11Display, _srcPicture, FilterBilinear, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_useImageResampler = true;
|
||||
_imageResampler.setHorizontalPixelDecimation(_pixelDecimation);
|
||||
_imageResampler.setVerticalPixelDecimation(_pixelDecimation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool X11Grabber::Setup()
|
||||
@@ -117,10 +130,6 @@ bool X11Grabber::Setup()
|
||||
XShmQueryVersion(_x11Display, &dummy, &dummy, &pixmaps_supported);
|
||||
_XShmPixmapAvailable = pixmaps_supported && XShmPixmapFormat(_x11Display) == ZPixmap;
|
||||
|
||||
// Image scaling is performed by XRender when available, otherwise by ImageResampler
|
||||
_imageResampler.setHorizontalPixelDecimation(_XRenderAvailable ? 1 : _pixelDecimation);
|
||||
_imageResampler.setVerticalPixelDecimation(_XRenderAvailable ? 1 : _pixelDecimation);
|
||||
|
||||
bool result = (updateScreenDimensions(true) >=0);
|
||||
ErrorIf(!result, _log, "X11 Grabber start failed");
|
||||
setEnabled(result);
|
||||
|
@@ -23,13 +23,17 @@ void X11Wrapper::action()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_grabber.updateScreenDimensions() < 0 )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isActive())
|
||||
{
|
||||
if (_grabber.updateScreenDimensions() >= 0 )
|
||||
{
|
||||
transferFrame(_grabber);
|
||||
}
|
||||
transferFrame(_grabber);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user