mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
grabber api and feature unification (#462)
* move setvideomode to common place * implement more croping and 3d support * more api unification * more refactoring * osx fix * next step * add a mock for osx grabber. Now it is possible to test compile on none osx platforms. * more unifications ... * remove obsolete includes and grabbers are not dyn allocated. dispmanx needs rework an probaly not work atm * first version of dispmanx mock. it compiles, but outputs a black image * now dispmanx mock works! * activate mocks in travis linux build prepare dispmanx to rgb image out * dispmanx now with image rgb output fix deadlock with w/h -1 in grabber v4l cleanups * fix json * fix some runtime stuff * Update FramebufferWrapper.cpp fix missing code * unify grabframe * 3d and croping for amlogic * fix setimage not working * make use of templates save some codelines * save more code lines
This commit is contained in:
@@ -27,8 +27,8 @@ V4L2Grabber::V4L2Grabber(const QString & device
|
||||
, int input
|
||||
, VideoStandard videoStandard
|
||||
, PixelFormat pixelFormat
|
||||
, int width
|
||||
, int height
|
||||
, unsigned width
|
||||
, unsigned height
|
||||
, int frameDecimation
|
||||
, int horizontalPixelDecimation
|
||||
, int verticalPixelDecimation
|
||||
@@ -180,11 +180,6 @@ void V4L2Grabber::getV4Ldevices()
|
||||
}
|
||||
}
|
||||
|
||||
void V4L2Grabber::setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom)
|
||||
{
|
||||
_imageResampler.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
||||
}
|
||||
|
||||
void V4L2Grabber::setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold, int noSignalCounterThreshold)
|
||||
{
|
||||
_noSignalThresholdColor.red = uint8_t(255*redSignalThreshold);
|
||||
|
@@ -8,8 +8,8 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
|
||||
int input,
|
||||
VideoStandard videoStandard,
|
||||
PixelFormat pixelFormat,
|
||||
int width,
|
||||
int height,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
int frameDecimation,
|
||||
int pixelDecimation,
|
||||
double redSignalThreshold,
|
||||
@@ -17,8 +17,7 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
|
||||
double blueSignalThreshold,
|
||||
const int priority,
|
||||
bool useGrabbingMode)
|
||||
: GrabberWrapper("V4L2:"+device, priority, hyperion::COMP_V4L)
|
||||
, _timeout_ms(1000)
|
||||
: GrabberWrapper("V4L2:"+device, &_grabber, width, height, 8, priority, hyperion::COMP_V4L)
|
||||
, _grabber(device,
|
||||
input,
|
||||
videoStandard,
|
||||
@@ -28,10 +27,10 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
|
||||
frameDecimation,
|
||||
pixelDecimation,
|
||||
pixelDecimation)
|
||||
, _ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0})
|
||||
{
|
||||
// set the signal detection threshold of the grabber
|
||||
_grabber.setSignalThreshold( redSignalThreshold, greenSignalThreshold, blueSignalThreshold, 50);
|
||||
_ggrabber = &_grabber;
|
||||
|
||||
// register the image type
|
||||
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
|
||||
@@ -40,29 +39,15 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
|
||||
|
||||
// Handle the image in the captured thread using a direct connection
|
||||
QObject::connect(&_grabber, SIGNAL(newFrame(Image<ColorRgb>)), this, SLOT(newFrame(Image<ColorRgb>)), Qt::DirectConnection);
|
||||
|
||||
QObject::connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
||||
|
||||
if (!useGrabbingMode)
|
||||
{
|
||||
disconnect(_hyperion, SIGNAL(grabbingMode(GrabbingMode)), this, 0);
|
||||
}
|
||||
// send color data to Hyperion using a queued connection to handle the data over to the main event loop
|
||||
// QObject::connect(
|
||||
// this, SIGNAL(emitColors(int,std::vector<ColorRgb>,int)),
|
||||
// _hyperion, SLOT(setColors(int,std::vector<ColorRgb>,int)),
|
||||
// Qt::QueuedConnection);
|
||||
|
||||
|
||||
// setup the higher prio source checker
|
||||
// this will disable the v4l2 grabber when a source with higher priority is active
|
||||
_timer.setInterval(500);
|
||||
}
|
||||
|
||||
V4L2Wrapper::~V4L2Wrapper()
|
||||
{
|
||||
}
|
||||
|
||||
bool V4L2Wrapper::start()
|
||||
{
|
||||
return ( _grabber.start() && GrabberWrapper::start());
|
||||
@@ -84,12 +69,6 @@ void V4L2Wrapper::setSignalDetectionOffset(double verticalMin, double horizontal
|
||||
_grabber.setSignalDetectionOffset(verticalMin, horizontalMin, verticalMax, horizontalMax);
|
||||
}
|
||||
|
||||
|
||||
void V4L2Wrapper::setVideoMode(VideoMode mode)
|
||||
{
|
||||
_grabber.setVideoMode(mode);
|
||||
}
|
||||
|
||||
void V4L2Wrapper::newFrame(const Image<ColorRgb> &image)
|
||||
{
|
||||
emit emitImage(_priority, image, _timeout_ms);
|
||||
|
Reference in New Issue
Block a user