Merge branch 'master' into refactor/led_device

This commit is contained in:
Murat Seker
2020-08-23 21:02:25 +02:00
committed by GitHub
272 changed files with 1711 additions and 1738 deletions

View File

@@ -20,7 +20,7 @@
#define VIDEO_DEVICE "/dev/amvideo"
#define CAPTURE_DEVICE "/dev/amvideocap0"
AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height)
AmlogicGrabber::AmlogicGrabber(unsigned width, unsigned height)
: Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160
, _captureDev(-1)
, _videoDev(-1)

View File

@@ -1,6 +1,6 @@
#include <grabber/AmlogicWrapper.h>
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight)
AmlogicWrapper::AmlogicWrapper(unsigned grabWidth, unsigned grabHeight)
: GrabberWrapper("AmLogic", &_grabber, grabWidth, grabHeight)
, _grabber(grabWidth, grabHeight)
{}

View File

@@ -65,8 +65,6 @@ public:
return physicalAddress;
}
IonBuffer(size_t bufferSize)
: bufferSize(bufferSize)
{

View File

@@ -6,7 +6,7 @@
// Local includes
#include "grabber/DispmanxFrameGrabber.h"
DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height)
DispmanxFrameGrabber::DispmanxFrameGrabber(unsigned width, unsigned height)
: Grabber("DISPMANXGRABBER", 0, 0)
, _vc_display(0)
, _vc_resource(0)
@@ -84,7 +84,7 @@ bool DispmanxFrameGrabber::setWidthHeight(int width, int height)
return false;
}
void DispmanxFrameGrabber::setFlags(const int vc_flags)
void DispmanxFrameGrabber::setFlags(int vc_flags)
{
_vc_flags = vc_flags;
}

View File

@@ -30,7 +30,7 @@ int vc_dispmanx_display_get_info(int, DISPMANX_MODEINFO_T *vc_info)
return 0;
}
DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int,int width,int height, uint32_t *)
DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int, int width, int height, uint32_t *)
{
return new DISPMANX_RESOURCE(width,height);
}
@@ -61,12 +61,12 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags)
{
__bcm_frame_counter = 0;
}
ColorRgba color[4] = {ColorRgba::RED, ColorRgba::BLUE, ColorRgba::GREEN, ColorRgba::WHITE};
if (__bcm_frame_counter < 25)
{
color[0] = ColorRgba::WHITE;
color[1] = ColorRgba::RED;
0 color[1] = ColorRgba::RED;
color[2] = ColorRgba::BLUE;
color[3] = ColorRgba::GREEN;
}
@@ -95,7 +95,7 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags)
if (x < w/2 && y < h/2) id = 1;
if (x < w/2 && y >= h/2) id = 2;
if (x >= w/2 && y < h/2) id = 3;
resource->memptr()[y*w + x] = color[id];
}
}

View File

@@ -1,6 +1,6 @@
#include <grabber/DispmanxWrapper.h>
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz)
DispmanxWrapper::DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz)
: GrabberWrapper("Dispmanx", &_grabber, grabWidth, grabHeight, updateRate_Hz)
, _grabber(grabWidth, grabHeight)
{

View File

@@ -13,7 +13,7 @@
// Local includes
#include <grabber/FramebufferFrameGrabber.h>
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height)
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, unsigned width, unsigned height)
: Grabber("FRAMEBUFFERGRABBER", width, height)
, _fbDevice()
{

View File

@@ -1,6 +1,6 @@
#include <grabber/FramebufferWrapper.h>
FramebufferWrapper::FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz)
FramebufferWrapper::FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz)
: GrabberWrapper("FrameBuffer", &_grabber, grabWidth, grabHeight, updateRate_Hz)
, _grabber(device, grabWidth, grabHeight)
{}

View File

@@ -5,7 +5,7 @@
// Local includes
#include <grabber/OsxFrameGrabber.h>
OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height)
OsxFrameGrabber::OsxFrameGrabber(unsigned display, unsigned width, unsigned height)
: Grabber("OSXGRABBER", width, height)
, _screenIndex(100)
{

View File

@@ -30,7 +30,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image)
{
__osx_frame_counter = 0;
}
ColorRgb color[4] = {ColorRgb::RED, ColorRgb::BLUE, ColorRgb::GREEN, ColorRgb::WHITE};
if (__osx_frame_counter < 25)
{
@@ -55,7 +55,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image)
}
unsigned w = image->width();
unsigned h = image->height();
for (unsigned y=0; y<h; y++)
{
for (unsigned x=0; x<w; x++)
@@ -64,11 +64,11 @@ CGImageRef CGImageGetDataProvider(CGImageRef image)
if (x < w/2 && y < h/2) id = 1;
if (x < w/2 && y >= h/2) id = 2;
if (x >= w/2 && y < h/2) id = 3;
image->memptr()[y*w + x] = color[id];
}
}
return image;
}

View File

@@ -1,6 +1,6 @@
#include <grabber/OsxWrapper.h>
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz)
OsxWrapper::OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz)
: GrabberWrapper("OSX FrameGrabber", &_grabber, grabWidth, grabHeight, updateRate_Hz)
, _grabber(display, grabWidth, grabHeight)
{}

View File

@@ -116,7 +116,7 @@ int QtGrabber::grabFrame(Image<ColorRgb> & image)
return 0;
}
int QtGrabber::updateScreenDimensions(const bool& force)
int QtGrabber::updateScreenDimensions(bool force)
{
if(!_screen)
return -1;

View File

@@ -1,6 +1,6 @@
#include <grabber/QtWrapper.h>
QtWrapper::QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz)
QtWrapper::QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, unsigned updateRate_Hz)
: GrabberWrapper("Qt", &_grabber, 0, 0, updateRate_Hz)
, _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation, display)
{}

View File

@@ -31,10 +31,10 @@
#endif
V4L2Grabber::V4L2Grabber(const QString & device
, const unsigned width
, const unsigned height
, const unsigned fps
, const unsigned input
, unsigned width
, unsigned height
, unsigned fps
, unsigned input
, VideoStandard videoStandard
, PixelFormat pixelFormat
, int pixelDecimation
@@ -1368,7 +1368,7 @@ bool V4L2Grabber::setFramerate(int fps)
return false;
}
QStringList V4L2Grabber::getV4L2devices()
QStringList V4L2Grabber::getV4L2devices() const
{
QStringList result = QStringList();
for (auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it)
@@ -1378,22 +1378,22 @@ QStringList V4L2Grabber::getV4L2devices()
return result;
}
QString V4L2Grabber::getV4L2deviceName(QString devicePath)
QString V4L2Grabber::getV4L2deviceName(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).name;
}
QMultiMap<QString, int> V4L2Grabber::getV4L2deviceInputs(QString devicePath)
QMultiMap<QString, int> V4L2Grabber::getV4L2deviceInputs(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).inputs;
}
QStringList V4L2Grabber::getResolutions(QString devicePath)
QStringList V4L2Grabber::getResolutions(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).resolutions;
}
QStringList V4L2Grabber::getFramerates(QString devicePath)
QStringList V4L2Grabber::getFramerates(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).framerates;
}

View File

@@ -6,10 +6,10 @@
#include <QTimer>
V4L2Wrapper::V4L2Wrapper(const QString &device,
const unsigned grabWidth,
const unsigned grabHeight,
const unsigned fps,
const unsigned input,
unsigned grabWidth,
unsigned grabHeight,
unsigned fps,
unsigned input,
VideoStandard videoStandard,
PixelFormat pixelFormat,
int pixelDecimation )
@@ -85,7 +85,7 @@ void V4L2Wrapper::setSignalDetectionEnable(bool enable)
_grabber.setSignalDetectionEnable(enable);
}
bool V4L2Wrapper::getSignalDetectionEnable()
bool V4L2Wrapper::getSignalDetectionEnable() const
{
return _grabber.getSignalDetectionEnabled();
}
@@ -95,12 +95,12 @@ void V4L2Wrapper::setCecDetectionEnable(bool enable)
_grabber.setCecDetectionEnable(enable);
}
bool V4L2Wrapper::getCecDetectionEnable()
bool V4L2Wrapper::getCecDetectionEnable() const
{
return _grabber.getCecDetectionEnabled();
}
void V4L2Wrapper::setDeviceVideoStandard(QString device, VideoStandard videoStandard)
void V4L2Wrapper::setDeviceVideoStandard(const QString& device, VideoStandard videoStandard)
{
_grabber.setDeviceVideoStandard(device, videoStandard);
}
@@ -110,7 +110,7 @@ void V4L2Wrapper::handleCecEvent(CECEvent event)
_grabber.handleCecEvent(event);
}
void V4L2Wrapper::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
void V4L2Wrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
{
if(type == settings::V4L2 && _grabberName.startsWith("V4L"))
{

View File

@@ -1,6 +1,6 @@
#include <grabber/X11Wrapper.h>
X11Wrapper::X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz)
X11Wrapper::X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, unsigned updateRate_Hz)
: GrabberWrapper("X11", &_grabber, 0, 0, updateRate_Hz)
, _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation)
, _init(false)

View File

@@ -86,7 +86,7 @@ void XcbGrabber::setupResources()
if(_XcbShmAvailable)
{
_shminfo = xcb_generate_id(_connection);
int id = shmget(IPC_PRIVATE, _width * _height * 4, IPC_CREAT | 0777);
int id = shmget(IPC_PRIVATE, size_t(_width) * size_t(_height) * 4, IPC_CREAT | 0777);
_shmData = static_cast<uint8_t*>(shmat(id, nullptr, 0));
xcb_shm_attach(_connection, _shminfo, id, 0);
}