implement set videomode via json api (#457)

* implement set videomode via json api

* refactor grabbers:
- new base class
- move shared code to base class

* fix osx

* rework all cmakelist files with auto file collection. except leddevices (need further restructuring)

* store current video and grabbing mode

* add json stuff

* remove grabbingmode - we do not want to expose it
This commit is contained in:
redPanther
2017-08-04 23:08:15 +02:00
committed by GitHub
parent 3612ccda75
commit 569e59110e
54 changed files with 375 additions and 659 deletions

View File

@@ -2,21 +2,9 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/v4l2)
SET(V4L2_HEADERS
${CURRENT_HEADER_DIR}/V4L2Grabber.h
${CURRENT_HEADER_DIR}/V4L2Wrapper.h
${CURRENT_HEADER_DIR}/VideoStandard.h
)
FILE ( GLOB V4L2_SOURCES "${CURRENT_HEADER_DIR}/V4L2*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(V4L2_SOURCES
${CURRENT_SOURCE_DIR}/V4L2Grabber.cpp
${CURRENT_SOURCE_DIR}/V4L2Wrapper.cpp
)
add_library(v4l2-grabber
${V4L2_HEADERS}
${V4L2_SOURCES}
)
add_library(v4l2-grabber ${V4L2_SOURCES} )
target_link_libraries(v4l2-grabber
hyperion

View File

@@ -33,15 +33,14 @@ V4L2Grabber::V4L2Grabber(const QString & device
, int horizontalPixelDecimation
, int verticalPixelDecimation
)
: _deviceName(device)
: Grabber("V4L2:"+device, width, height)
, _deviceName(device)
, _input(input)
, _videoStandard(videoStandard)
, _ioMethod(IO_METHOD_MMAP)
, _fileDescriptor(-1)
, _buffers()
, _pixelFormat(pixelFormat)
, _width(width)
, _height(height)
, _lineLength(-1)
, _frameByteSize(-1)
, _frameDecimation(qMax(1, frameDecimation))
@@ -56,8 +55,6 @@ V4L2Grabber::V4L2Grabber(const QString & device
, _y_frac_max(0.75)
, _currentFrame(0)
, _streamNotifier(nullptr)
, _imageResampler()
, _log(Logger::getInstance("V4L2:"+device))
, _initialized(false)
, _deviceAutoDiscoverEnabled(false)
@@ -188,11 +185,6 @@ void V4L2Grabber::setCropping(int cropLeft, int cropRight, int cropTop, int crop
_imageResampler.setCropping(cropLeft, cropRight, cropTop, cropBottom);
}
void V4L2Grabber::set3D(VideoMode mode)
{
_imageResampler.set3D(mode);
}
void V4L2Grabber::setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold, int noSignalCounterThreshold)
{
_noSignalThresholdColor.red = uint8_t(255*redSignalThreshold);

View File

@@ -15,7 +15,8 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
const int priority)
const int priority,
bool useGrabbingMode)
: GrabberWrapper("V4L2:"+device, priority, hyperion::COMP_V4L)
, _timeout_ms(1000)
, _grabber(device,
@@ -42,6 +43,10 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
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)),
@@ -80,9 +85,9 @@ void V4L2Wrapper::setSignalDetectionOffset(double verticalMin, double horizontal
}
void V4L2Wrapper::set3D(VideoMode mode)
void V4L2Wrapper::setVideoMode(VideoMode mode)
{
_grabber.set3D(mode);
_grabber.setVideoMode(mode);
}
void V4L2Wrapper::newFrame(const Image<ColorRgb> &image)