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

@@ -3,46 +3,11 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/hyperion)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/hyperion)
SET(Hyperion_HEADERS
${CURRENT_HEADER_DIR}/ImageProcessorFactory.h
${CURRENT_HEADER_DIR}/ImageToLedsMap.h
${CURRENT_HEADER_DIR}/LedString.h
FILE ( GLOB Hyperion_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
${CURRENT_SOURCE_DIR}/MultiColorAdjustment.h
${CURRENT_HEADER_DIR}/MessageForwarder.h
${CURRENT_HEADER_DIR}/Hyperion.h
${CURRENT_HEADER_DIR}/ImageProcessor.h
${CURRENT_SOURCE_DIR}/LinearColorSmoothing.h
${CURRENT_HEADER_DIR}/GrabberWrapper.h
${CURRENT_HEADER_DIR}/ComponentRegister.h
${CURRENT_HEADER_DIR}/PriorityMuxer.h
)
SET(Hyperion_SOURCES
${CURRENT_SOURCE_DIR}/Hyperion.cpp
${CURRENT_SOURCE_DIR}/ImageProcessor.cpp
${CURRENT_SOURCE_DIR}/ImageProcessorFactory.cpp
${CURRENT_SOURCE_DIR}/LedString.cpp
${CURRENT_SOURCE_DIR}/PriorityMuxer.cpp
${CURRENT_SOURCE_DIR}/ImageToLedsMap.cpp
${CURRENT_SOURCE_DIR}/MultiColorAdjustment.cpp
${CURRENT_SOURCE_DIR}/LinearColorSmoothing.cpp
${CURRENT_SOURCE_DIR}/MessageForwarder.cpp
${CURRENT_SOURCE_DIR}/GrabberWrapper.cpp
${CURRENT_SOURCE_DIR}/ComponentRegister.cpp
)
SET(Hyperion_RESOURCES
${CURRENT_SOURCE_DIR}/resource.qrc
)
QT5_ADD_RESOURCES(Hyperion_RESOURCES_RCC ${Hyperion_RESOURCES} OPTIONS "-no-compress")
QT5_ADD_RESOURCES(Hyperion_RESOURCES_RCC ${CURRENT_SOURCE_DIR}/resource.qrc OPTIONS "-no-compress")
add_library(hyperion
${Hyperion_HEADERS}
${Hyperion_SOURCES}
${Hyperion_RESOURCES_RCC}
)

View File

@@ -0,0 +1,27 @@
#include <hyperion/Grabber.h>
Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
: _imageResampler()
, _videoMode(VIDEO_2D)
, _width(width)
, _height(height)
, _cropLeft(cropLeft)
, _cropRight(cropRight)
, _cropTop(cropTop)
, _cropBottom(cropBottom)
, _log(Logger::getInstance(grabberName))
{
}
Grabber::~Grabber()
{
}
void Grabber::setVideoMode(VideoMode mode)
{
_videoMode = mode;
_imageResampler.set3D(_videoMode);
}

View File

@@ -22,6 +22,9 @@ GrabberWrapper::GrabberWrapper(QString grabberName, const int priority, hyperion
connect(_hyperion, SIGNAL(imageToLedsMappingChanged(int)), _processor, SLOT(setLedMappingType(int)));
connect(_hyperion, SIGNAL(componentStateChanged(hyperion::Components,bool)), this, SLOT(componentStateChanged(hyperion::Components,bool)));
connect(_hyperion, SIGNAL(grabbingMode(GrabbingMode)), this, SLOT(setGrabbingMode(GrabbingMode)));
connect(_hyperion, SIGNAL(videoMode(VideoMode)), this, SLOT(setVideoMode(VideoMode)));
connect(this, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
}

View File

@@ -400,6 +400,8 @@ Hyperion::Hyperion(const QJsonObject &qjsonConfig, const QString configFile)
, _prevCompId(hyperion::COMP_INVALID)
, _bonjourBrowser(this)
, _bonjourResolver(this)
, _videoMode(VIDEO_2D)
, _grabbingMode(GRABBINGMODE_INVALID)
{
if (!_raw2ledAdjustment->verifyAdjustments())
@@ -802,6 +804,19 @@ void Hyperion::setLedMappingType(int mappingType)
emit imageToLedsMappingChanged(mappingType);
}
void Hyperion::setVideoMode(VideoMode mode)
{
_videoMode = mode;
emit videoMode(mode);
}
void Hyperion::setGrabbingMode(GrabbingMode mode)
{
_grabbingMode = mode;
emit grabbingMode(mode);
}
void Hyperion::hyperionStateChanged()
{
if(_fsi_blockTimer.isActive())