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

@ -1,18 +1,14 @@
#pragma once
// STL includes
#include <cstdint>
#include <utils/Logger.h>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorBgr.h>
#include <utils/VideoMode.h>
#include <hyperion/Grabber.h>
///
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
/// downsized and scaled resolution.
///
class AmlogicGrabber
class AmlogicGrabber : public Grabber
{
public:
///
@ -24,12 +20,6 @@ public:
AmlogicGrabber(const unsigned width, const unsigned height);
~AmlogicGrabber();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
///
/// Captures a single snapshot of the display and writes the data to the given image. The
/// provided image should have the same dimensions as the configured values (_width and
@ -47,14 +37,6 @@ public:
*/
bool isVideoPlaying();
private:
/// With of the captured snapshot [pixels]
const unsigned _width;
/// Height of the captured snapshot [pixels]
const unsigned _height;
/** The snapshot/capture device of the amlogic video chip */
int _amlogicCaptureDev;
Logger * _log;
};

View File

@ -42,11 +42,7 @@ public slots:
///
virtual void action();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
virtual void setVideoMode(const VideoMode mode);
private:
/// The update rate [Hz]

View File

@ -4,20 +4,15 @@
#pragma GCC system_header
#include <bcm_host.h>
// STL includes
#include <cstdint>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgba.h>
#include <utils/VideoMode.h>
#include <utils/Logger.h>
#include <hyperion/Grabber.h>
///
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
/// downsized and scaled resolution.
///
class DispmanxFrameGrabber
class DispmanxFrameGrabber : public Grabber
{
public:
///
@ -36,12 +31,6 @@ public:
///
void setFlags(const int vc_flags);
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
void setCropping(const unsigned cropLeft, const unsigned cropRight,
const unsigned cropTop, const unsigned cropBottom);
@ -68,23 +57,10 @@ private:
/// Flags (transforms) for creating snapshots
int _vc_flags;
/// With of the captured snapshot [pixels]
const unsigned _width;
/// Height of the captured snapshot [pixels]
const unsigned _height;
// the selected VideoMode
VideoMode _videoMode;
// number of pixels to crop after capturing
unsigned _cropLeft, _cropRight, _cropTop, _cropBottom;
// temp buffer when capturing with unsupported pitch size or
// when we need to crop the image
ColorRgba* _captureBuffer;
// size of the capture buffer in Pixels
unsigned _captureBufferSize;
Logger * _log;
};

View File

@ -1,16 +1,13 @@
#pragma once
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/VideoMode.h>
#include <utils/ImageResampler.h>
#include <utils/Logger.h>
#include <hyperion/Grabber.h>
///
/// The FramebufferFrameGrabber is used for creating snapshots of the display (screenshots)
///
class FramebufferFrameGrabber
class FramebufferFrameGrabber : public Grabber
{
public:
///
@ -23,12 +20,6 @@ public:
FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height);
~FramebufferFrameGrabber();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
///
/// Captures a single snapshot of the display and writes the data to the given image. The
/// provided image should have the same dimensions as the configured values (_width and
@ -48,15 +39,4 @@ private:
/// Framebuffer device e.g. /dev/fb0
const QString _fbDevice;
/// With of the captured snapshot [pixels]
const unsigned _width;
/// Height of the captured snapshot [pixels]
const unsigned _height;
/// Image resampler for downscaling the image
ImageResampler * _imgResampler;
Logger * _log;
};

View File

@ -4,16 +4,13 @@
#include <CoreGraphics/CoreGraphics.h>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/VideoMode.h>
#include <utils/ImageResampler.h>
#include <utils/Logger.h>
#include <hyperion/Grabber.h>
///
/// The OsxFrameGrabber is used for creating snapshots of the display (screenshots)
///
class OsxFrameGrabber
class OsxFrameGrabber : public Grabber
{
public:
///
@ -26,12 +23,6 @@ public:
OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height);
~OsxFrameGrabber();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
///
/// Captures a single snapshot of the display and writes the data to the given image. The
/// provided image should have the same dimensions as the configured values (_width and
@ -46,17 +37,6 @@ private:
/// display
const unsigned _screenIndex;
/// With of the captured snapshot [pixels]
const unsigned _width;
/// Height of the captured snapshot [pixels]
const unsigned _height;
/// Reference to the captured diaplay
CGDirectDisplayID _display;
/// Image resampler for downscaling the image
ImageResampler * _imgResampler;
Logger * _log;
};

View File

@ -10,12 +10,9 @@
#include <QRectF>
// util includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/PixelFormat.h>
#include <utils/VideoMode.h>
#include <utils/ImageResampler.h>
#include <utils/Logger.h>
#include <hyperion/Grabber.h>
// grabber includes
#include <grabber/VideoStandard.h>
@ -23,7 +20,7 @@
/// Capture class for V4L2 devices
///
/// @see http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html
class V4L2Grabber : public QObject
class V4L2Grabber : public Grabber
{
Q_OBJECT
@ -48,8 +45,6 @@ public slots:
int cropTop,
int cropBottom);
void set3D(VideoMode mode);
void setSignalThreshold(
double redSignalThreshold,
double greenSignalThreshold,
@ -124,18 +119,16 @@ private:
private:
QString _deviceName;
std::map<QString,QString> _v4lDevices;
int _input;
VideoStandard _videoStandard;
io_method _ioMethod;
int _fileDescriptor;
int _input;
VideoStandard _videoStandard;
io_method _ioMethod;
int _fileDescriptor;
std::vector<buffer> _buffers;
PixelFormat _pixelFormat;
int _width;
int _height;
int _lineLength;
int _frameByteSize;
int _frameDecimation;
int _lineLength;
int _frameByteSize;
int _frameDecimation;
// signal detection
int _noSignalCounterThreshold;
@ -151,11 +144,6 @@ private:
QSocketNotifier * _streamNotifier;
ImageResampler _imageResampler;
Logger * _log;
bool _initialized;
bool _deviceAutoDiscoverEnabled;
};

View File

@ -24,7 +24,8 @@ public:
double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
const int priority);
const int priority,
bool useGrabbingMode);
virtual ~V4L2Wrapper();
bool getSignalDetectionEnable();
@ -35,7 +36,7 @@ public slots:
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
void set3D(VideoMode mode);
void setVideoMode(VideoMode mode);
void setSignalDetectionEnable(bool enable);
// signals:

View File

@ -1,9 +1,11 @@
#pragma once
#include <QObject>
// Hyperion-utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/ImageResampler.h>
#include <utils/Logger.h>
#include <hyperion/Grabber.h>
// X11 includes
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
@ -11,7 +13,7 @@
#include <sys/ipc.h>
#include <sys/shm.h>
class X11Grabber
class X11Grabber : public Grabber
{
public:
@ -19,12 +21,6 @@ public:
virtual ~X11Grabber();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
bool Setup();
Image<ColorRgb> & grab();
@ -43,21 +39,9 @@ public:
/// update dimension according current screen
int updateScreenDimensions();
/// gets resulting height of image
const unsigned getImageWidth() { return _croppedWidth; };
/// gets resulting width of image
const unsigned getImageHeight() { return _croppedHeight; };
private:
ImageResampler _imageResampler;
bool _useXGetImage, _XShmAvailable, _XShmPixmapAvailable, _XRenderAvailable;
int _cropLeft;
int _cropRight;
int _cropTop;
int _cropBottom;
XImage* _xImage;
XShmSegmentInfo _shminfo;
@ -79,14 +63,9 @@ private:
unsigned _screenWidth;
unsigned _screenHeight;
unsigned _croppedWidth;
unsigned _croppedHeight;
Image<ColorRgb> _image;
void freeResources();
void setupResources();
Logger * _log;
};

View File

@ -17,7 +17,6 @@ class ImageProcessor;
///
class X11Wrapper: public GrabberWrapper
{
Q_OBJECT
public:
///
/// Constructs the framebuffer frame grabber with a specified grab size and update rate.

View File

@ -0,0 +1,53 @@
#pragma once
#include <QObject>
#include <cstdint>
#include <utils/Image.h>
#include <utils/VideoMode.h>
#include <utils/GrabbingMode.h>
#include <utils/ImageResampler.h>
#include <utils/Logger.h>
class Grabber : public QObject
{
Q_OBJECT
public:
Grabber(QString grabberName, int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0);
~Grabber();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(VideoMode mode);
/// gets resulting height of image
const int getImageWidth() { return _width; };
/// gets resulting width of image
const int getImageHeight() { return _height; };
protected:
ImageResampler _imageResampler;
/// the selected VideoMode
VideoMode _videoMode;
/// With of the captured snapshot [pixels]
int _width;
/// Height of the captured snapshot [pixels]
int _height;
// number of pixels to crop after capturing
int _cropLeft, _cropRight, _cropTop, _cropBottom;
/// logger instance
Logger * _log;
};

View File

@ -46,6 +46,13 @@ public slots:
///
void setGrabbingMode(const GrabbingMode mode);
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
virtual void setVideoMode(const VideoMode videoMode) = 0;
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);

View File

@ -21,6 +21,8 @@
#include <utils/ColorRgb.h>
#include <utils/Logger.h>
#include <utils/Components.h>
#include <utils/VideoMode.h>
#include <utils/GrabbingMode.h>
// Hyperion includes
#include <hyperion/LedString.h>
@ -192,6 +194,9 @@ public:
/// forward smoothing config
unsigned addSmoothingConfig(int settlingTime_ms, double ledUpdateFrequency_hz=25.0, unsigned updateDelay=0);
VideoMode getCurrentVideoMode() { return _videoMode; };
GrabbingMode getCurrentGrabbingMode() { return _grabbingMode; };
public slots:
///
/// Writes a single color to all the leds for the given time and priority
@ -280,6 +285,19 @@ public slots:
/// Slot which is called, when state of hyperion has been changed
void hyperionStateChanged();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(VideoMode mode);
///
/// Set the grabbing mode
/// @param[in] mode The new grabbing mode
///
void setGrabbingMode(const GrabbingMode mode);
public:
static Hyperion *_hyperion;
@ -324,6 +342,11 @@ signals:
/// Signal which is emitted, after the hyperionStateChanged has been processed with a emit count blocker (250ms interval)
void sendServerInfo();
/// Signal emitted when a 3D movie is detected
void videoMode(VideoMode mode);
void grabbingMode(GrabbingMode mode);
private slots:
///
/// Updates the priority muxer with the current time and (re)writes the led color with applied
@ -432,4 +455,7 @@ private:
/// timers to handle severinfo blocking
QTimer _fsi_timer;
QTimer _fsi_blockTimer;
VideoMode _videoMode;
GrabbingMode _grabbingMode;
};

View File

@ -1,5 +1,7 @@
#pragma once
#include <QString>
/**
* Enumeration of the possible modes in which frame-grabbing is performed.
*/
@ -16,3 +18,18 @@ enum GrabbingMode
GRABBINGMODE_SCREENSAVER,
GRABBINGMODE_INVALID
};
inline QString grabbingMode2String(GrabbingMode mode)
{
switch(mode)
{
case GRABBINGMODE_OFF: return "OFF";
case GRABBINGMODE_VIDEO: return "VIDEO";
case GRABBINGMODE_PAUSE: return "PAUSE";
case GRABBINGMODE_PHOTO: return "PHOTO";
case GRABBINGMODE_AUDIO: return "AUDIO";
case GRABBINGMODE_MENU: return "MENU";
case GRABBINGMODE_SCREENSAVER: return "SCREENSAVER";
default: return "INVALID";
}
}

View File

@ -244,6 +244,12 @@ private:
///
void handleProcessingCommand(const QJsonObject & message, const QString &command, const int tan);
/// Handle an incoming JSON VideoMode message
///
/// @param message the incoming message
///
void handleVideoModeCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON message of unknown type
///

View File

@ -14,8 +14,8 @@ enum VideoMode
inline VideoMode parse3DMode(QString videoMode)
{
// convert to lower case
videoMode = videoMode.toLower();
// convert to upper case
videoMode = videoMode.toUpper();
if (videoMode == "3DTAB")
{
@ -29,3 +29,14 @@ inline VideoMode parse3DMode(QString videoMode)
// return the default 2D
return VIDEO_2D;
}
inline QString videoMode2String(VideoMode mode)
{
switch(mode)
{
case VIDEO_3DTAB: return "3DTAB";
case VIDEO_3DSBS: return "3DSBS";
case VIDEO_2D: return "2D";
default: return "INVALID";
}
}

View File

@ -3,21 +3,8 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/blackborder)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/blackborder)
SET(Blackborder_HEADERS
${CURRENT_HEADER_DIR}/BlackBorderDetector.h
${CURRENT_HEADER_DIR}/BlackBorderProcessor.h
)
FILE ( GLOB Blackborder_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(Blackborder_SOURCES
${CURRENT_SOURCE_DIR}/BlackBorderDetector.cpp
${CURRENT_SOURCE_DIR}/BlackBorderProcessor.cpp
)
add_library(blackborder ${Blackborder_SOURCES} )
add_library(blackborder
${Blackborder_HEADERS}
${Blackborder_SOURCES}
)
target_link_libraries(blackborder
hyperion-utils
)
target_link_libraries(blackborder hyperion-utils )

View File

@ -3,22 +3,12 @@
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/boblightserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/boblightserver)
set(BoblightServer_HEADERS
${CURRENT_HEADER_DIR}/BoblightServer.h
${CURRENT_SOURCE_DIR}/BoblightClientConnection.h
)
FILE ( GLOB BoblightServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(BoblightServer_SOURCES
${CURRENT_SOURCE_DIR}/BoblightServer.cpp
${CURRENT_SOURCE_DIR}/BoblightClientConnection.cpp
)
add_library(boblightserver
${BoblightServer_HEADERS}
${BoblightServer_SOURCES}
)
add_library(boblightserver ${BoblightServer_SOURCES} )
target_link_libraries(boblightserver
hyperion
hyperion-utils
${QT_LIBRARIES})
${QT_LIBRARIES}
)

View File

@ -3,29 +3,9 @@
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/bonjour)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/bonjour)
set(Bonjour_HEADERS
${CURRENT_HEADER_DIR}/bonjourserviceregister.h
${CURRENT_HEADER_DIR}/bonjourservicebrowser.h
${CURRENT_HEADER_DIR}/bonjourserviceresolver.h
)
FILE ( GLOB Bonjour_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(Bonjour_SOURCES
${CURRENT_SOURCE_DIR}/bonjourserviceregister.cpp
${CURRENT_SOURCE_DIR}/bonjourservicebrowser.cpp
${CURRENT_SOURCE_DIR}/bonjourserviceresolver.cpp
)
#set(Bonjour_RESOURCES
#)
#qt5_add_resources(Bonjour_RESOURCES_RCC ${Bonjour_RESOURCES} OPTIONS "-no-compress")
add_library(bonjour
${Bonjour_HEADERS}
${Bonjour_SOURCES}
${Bonjour_RESOURCES}
${Bonjour_RESOURCES_RCC}
)
add_library(bonjour ${Bonjour_SOURCES} )
target_link_libraries(bonjour
hyperion

View File

@ -2,40 +2,11 @@
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/commandline)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/commandline)
set(Parser_HEADERS
${CURRENT_HEADER_DIR}/ColorOption.h
${CURRENT_HEADER_DIR}/ColorsOption.h
${CURRENT_HEADER_DIR}/DoubleOption.h
${CURRENT_HEADER_DIR}/ImageOption.h
${CURRENT_HEADER_DIR}/IntOption.h
${CURRENT_HEADER_DIR}/Option.h
${CURRENT_HEADER_DIR}/Parser.h
${CURRENT_HEADER_DIR}/RegularExpressionOption.h
${CURRENT_HEADER_DIR}/SwitchOption.h
${CURRENT_HEADER_DIR}/ValidatorOption.h
${CURRENT_HEADER_DIR}/BooleanOption.h
)
FILE ( GLOB Parser_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(Parser_SOURCES
${CURRENT_SOURCE_DIR}/ColorOption.cpp
${CURRENT_SOURCE_DIR}/ColorsOption.cpp
${CURRENT_SOURCE_DIR}/DoubleOption.cpp
${CURRENT_SOURCE_DIR}/ImageOption.cpp
${CURRENT_SOURCE_DIR}/IntOption.cpp
${CURRENT_SOURCE_DIR}/Option.cpp
${CURRENT_SOURCE_DIR}/Parser.cpp
${CURRENT_SOURCE_DIR}/RegularExpressionOption.cpp
${CURRENT_SOURCE_DIR}/SwitchOption.cpp
${CURRENT_SOURCE_DIR}/ValidatorOption.cpp
${CURRENT_SOURCE_DIR}/BooleanOption.cpp
)
add_library(commandline
${Parser_HEADERS}
${Parser_SOURCES}
)
add_library(commandline ${Parser_SOURCES} )
target_link_libraries(commandline
hyperion
Qt5::Gui
hyperion
Qt5::Gui
)

View File

@ -9,19 +9,9 @@ include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/effectengine)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/effectengine)
SET(EffectEngineHEADERS
${CURRENT_HEADER_DIR}/EffectDefinition.h
${CURRENT_HEADER_DIR}/EffectEngine.h
${CURRENT_SOURCE_DIR}/Effect.h
)
SET(EffectEngineSOURCES
${CURRENT_SOURCE_DIR}/EffectEngine.cpp
${CURRENT_SOURCE_DIR}/Effect.cpp
)
FILE ( GLOB EffectEngineSOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
FILE ( GLOB effectFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/effects/* )
SET ( HYPERION_EFFECTS_RES "")
FOREACH( f ${effectFiles} )
GET_FILENAME_COMPONENT(fname ${f} NAME)
@ -34,7 +24,6 @@ SET(EffectEngine_RESOURCES ${CMAKE_BINARY_DIR}/EffectEngine.qrc)
qt5_add_resources(EffectEngine_RESOURCES_RCC ${EffectEngine_RESOURCES} ) # OPTIONS "-no-compress"
add_library(effectengine
${EffectEngineHEADERS}
${EffectEngine_RESOURCES_RCC}
${EffectEngineSOURCES}
)
@ -43,4 +32,5 @@ target_link_libraries(effectengine
hyperion
Qt5::Core
Qt5::Gui
${PYTHON_LIBRARIES})
${PYTHON_LIBRARIES}
)

View File

@ -31,10 +31,8 @@
#endif
AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height)
: _width(qMax(160u, width)) // Minimum required width or height is 160
, _height(qMax(160u, height))
: Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160
, _amlogicCaptureDev(-1)
, _log(Logger::getInstance("AMLOGICGRABBER"))
{
Debug(_log, "constructed(%d x %d)",_width,_height);
}
@ -51,24 +49,13 @@ AmlogicGrabber::~AmlogicGrabber()
}
}
void AmlogicGrabber::setVideoMode(const VideoMode videoMode)
{
switch (videoMode) {
case VIDEO_3DSBS:
//vc_dispmanx_rect_set(&_rectangle, 0, 0, _width/2, _height);
break;
case VIDEO_3DTAB:
//vc_dispmanx_rect_set(&_rectangle, 0, 0, _width, _height/2);
break;
case VIDEO_2D:
default:
//vc_dispmanx_rect_set(&_rectangle, 0, 0, _width, _height);
break;
}
}
bool AmlogicGrabber::isVideoPlaying()
{
// TODO crop resulting image accroding member _videoMode
// TODO add croping
const QString videoDevice = "/dev/amvideo";
// Open the video device
@ -97,7 +84,7 @@ bool AmlogicGrabber::isVideoPlaying()
int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
{
// resize the given image if needed
if (image.width() != _width || image.height() != _height)
if (image.width() != (unsigned)_width || image.height() != (unsigned)_height)
{
image.resize(_width, _height);
}

View File

@ -4,26 +4,14 @@ INCLUDE (CheckIncludeFiles)
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic)
SET(AmlogicHEADERS
${CURRENT_HEADER_DIR}/AmlogicGrabber.h
${CURRENT_HEADER_DIR}/AmlogicWrapper.h
)
SET(AmlogicSOURCES
${CURRENT_SOURCE_DIR}/AmlogicWrapper.cpp
${CURRENT_SOURCE_DIR}/AmlogicGrabber.cpp
)
FILE ( GLOB AmlogicSOURCES "${CURRENT_HEADER_DIR}/Amlogic*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
CHECK_INCLUDE_FILES ("amcodec/amports/amstream.h" HAVE_AML_HEADER)
IF (${HAVE_AML_HEADER})
ADD_DEFINITIONS( -DHAVE_AML_HEADER )
ENDIF()
add_library(amlogic-grabber
${AmlogicHEADERS}
${AmlogicSOURCES}
)
add_library(amlogic-grabber ${AmlogicSOURCES} )
target_link_libraries(amlogic-grabber
hyperion

View File

@ -1,4 +1,3 @@
# Find the BCM-package (VC control)
find_package(BCM REQUIRED)
include_directories(${BCM_INCLUDE_DIRS})
@ -7,20 +6,9 @@ include_directories(${BCM_INCLUDE_DIRS})
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx)
SET(DispmanxGrabberHEADERS
${CURRENT_HEADER_DIR}/DispmanxWrapper.h
${CURRENT_HEADER_DIR}/DispmanxFrameGrabber.h
)
FILE ( GLOB DispmanxGrabberSOURCES "${CURRENT_HEADER_DIR}/Dispmanx*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(DispmanxGrabberSOURCES
${CURRENT_SOURCE_DIR}/DispmanxWrapper.cpp
${CURRENT_SOURCE_DIR}/DispmanxFrameGrabber.cpp
)
add_library(dispmanx-grabber
${DispmanxGrabberHEADERS}
${DispmanxGrabberSOURCES}
)
add_library(dispmanx-grabber ${DispmanxGrabberSOURCES} )
target_link_libraries(dispmanx-grabber
hyperion

View File

@ -6,20 +6,13 @@
// Local includes
#include "grabber/DispmanxFrameGrabber.h"
DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height) :
_vc_display(0),
_vc_resource(0),
_vc_flags(0),
_width(width),
_height(height),
_videoMode(VIDEO_2D),
_cropLeft(0),
_cropRight(0),
_cropTop(0),
_cropBottom(0),
_captureBuffer(new ColorRgba[0]),
_captureBufferSize(0),
_log(Logger::getInstance("DISPMANXGRABBER"))
DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height)
: Grabber("DISPMANXGRABBER", width, height)
, _vc_display(0)
, _vc_resource(0)
, _vc_flags(0)
, _captureBuffer(new ColorRgba[0])
, _captureBufferSize(0)
{
// Initiase BCM
bcm_host_init();
@ -71,14 +64,9 @@ void DispmanxFrameGrabber::setFlags(const int vc_flags)
_vc_flags = vc_flags;
}
void DispmanxFrameGrabber::setVideoMode(const VideoMode videoMode)
{
_videoMode = videoMode;
}
void DispmanxFrameGrabber::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom)
{
if (cropLeft + cropRight >= _width || cropTop + cropBottom >= _height)
if (cropLeft + cropRight >= (unsigned)_width || cropTop + cropBottom >= (unsigned)_height)
{
Error(_log, "Rejecting invalid crop values: left: %d, right: %d, top: %d, bottom: %d", cropLeft, cropRight, cropTop, cropBottom);
return;

View File

@ -1,26 +1,10 @@
# Find the BCM-package (VC control)
# find_package(BCM REQUIRED)
# include_directories(${BCM_INCLUDE_DIRS})
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer)
SET(FramebufferGrabberHEADERS
${CURRENT_HEADER_DIR}/FramebufferFrameGrabber.h
${CURRENT_HEADER_DIR}/FramebufferWrapper.h
)
FILE ( GLOB FramebufferGrabberSOURCES "${CURRENT_HEADER_DIR}/Framebuffer*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(FramebufferGrabberSOURCES
${CURRENT_SOURCE_DIR}/FramebufferWrapper.cpp
${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.cpp
)
add_library(framebuffer-grabber
${FramebufferGrabberHEADERS}
${FramebufferGrabberSOURCES}
)
add_library(framebuffer-grabber ${FramebufferGrabberSOURCES} )
target_link_libraries(framebuffer-grabber
hyperion

View File

@ -12,14 +12,11 @@
// Local includes
#include <grabber/FramebufferFrameGrabber.h>
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height) :
_fbfd(0),
_fbp(0),
_fbDevice(device),
_width(width),
_height(height),
_imgResampler(new ImageResampler()),
_log(Logger::getInstance("FRAMEBUFFERGRABBER"))
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height)
: Grabber("FRAMEBUFFERGRABBER", width, height)
, _fbfd(0)
, _fbp(0)
, _fbDevice(device)
{
int result;
struct fb_var_screeninfo vinfo;
@ -48,12 +45,6 @@ FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const u
FramebufferFrameGrabber::~FramebufferFrameGrabber()
{
delete _imgResampler;
}
void FramebufferFrameGrabber::setVideoMode(const VideoMode videoMode)
{
_imgResampler->set3D(videoMode);
}
void FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
@ -93,9 +84,9 @@ void FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
/* map the device to memory */
_fbp = (unsigned char*)mmap(0, capSize, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, _fbfd, 0);
_imgResampler->setHorizontalPixelDecimation(vinfo.xres/_width);
_imgResampler->setVerticalPixelDecimation(vinfo.yres/_height);
_imgResampler->processImage(_fbp,
_imageResampler.setHorizontalPixelDecimation(vinfo.xres/_width);
_imageResampler.setVerticalPixelDecimation(vinfo.yres/_height);
_imageResampler.processImage(_fbp,
vinfo.xres,
vinfo.yres,
vinfo.xres * bytesPerPixel,

View File

@ -2,20 +2,9 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx)
SET(OsxGrabberHEADERS
${CURRENT_HEADER_DIR}/OsxWrapper.h
${CURRENT_HEADER_DIR}/OsxFrameGrabber.h
)
FILE ( GLOB OsxGrabberSOURCES "${CURRENT_HEADER_DIR}/Osx*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(OsxGrabberSOURCES
${CURRENT_SOURCE_DIR}/OsxWrapper.cpp
${CURRENT_SOURCE_DIR}/OsxFrameGrabber.cpp
)
add_library(osx-grabber
${OsxGrabberHEADERS}
${OsxGrabberSOURCES}
)
add_library(osx-grabber ${OsxGrabberSOURCES} )
target_link_libraries(osx-grabber
hyperion

View File

@ -5,12 +5,9 @@
// Local includes
#include <grabber/OsxFrameGrabber.h>
OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height) :
_screenIndex(display),
_width(width),
_height(height),
_imgResampler(new ImageResampler()),
_log(Logger::getInstance("OSXGRABBER"))
OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height)
: Grabber("OSXGRABBER", width, height)
, _screenIndex(display)
{
CGImageRef image;
CGDisplayCount displayCount;
@ -36,12 +33,6 @@ OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, c
OsxFrameGrabber::~OsxFrameGrabber()
{
delete _imgResampler;
}
void OsxFrameGrabber::setVideoMode(const VideoMode videoMode)
{
_imgResampler->set3D(videoMode);
}
void OsxFrameGrabber::grabFrame(Image<ColorRgb> & image)
@ -53,7 +44,7 @@ void OsxFrameGrabber::grabFrame(Image<ColorRgb> & image)
dispImage = CGDisplayCreateImage(_display);
// dsiplay lost, use main
// display lost, use main
if (dispImage == NULL && _display)
{
dispImage = CGDisplayCreateImage(kCGDirectMainDisplay);
@ -69,9 +60,9 @@ void OsxFrameGrabber::grabFrame(Image<ColorRgb> & image)
dspWidth = CGImageGetWidth(dispImage);
dspHeight = CGImageGetHeight(dispImage);
_imgResampler->setHorizontalPixelDecimation(dspWidth/_width);
_imgResampler->setVerticalPixelDecimation(dspHeight/_height);
_imgResampler->processImage( pImgData,
_imageResampler.setHorizontalPixelDecimation(dspWidth/_width);
_imageResampler.setVerticalPixelDecimation(dspHeight/_height);
_imageResampler.processImage( pImgData,
dspWidth,
dspHeight,
CGImageGetBytesPerRow(dispImage),

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)

View File

@ -5,27 +5,14 @@ SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/x11)
# Find X11
find_package(X11 REQUIRED)
include_directories(
${X11_INCLUDES}
)
include_directories( ${X11_INCLUDES} )
SET(X11_HEADERS
${CURRENT_HEADER_DIR}/X11Wrapper.h
${CURRENT_HEADER_DIR}/X11Grabber.h
)
FILE ( GLOB X11_SOURCES "${CURRENT_HEADER_DIR}/X11*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(X11_SOURCES
${CURRENT_SOURCE_DIR}/X11Grabber.cpp
${CURRENT_SOURCE_DIR}/X11Wrapper.cpp
)
add_library(x11-grabber
${X11_HEADERS}
${X11_SOURCES}
)
add_library(x11-grabber ${X11_SOURCES} )
target_link_libraries(x11-grabber
hyperion
${X11_LIBRARIES}
${X11_Xrender_LIB}
${X11_LIBRARIES}
${X11_Xrender_LIB}
)

View File

@ -2,12 +2,8 @@
#include <grabber/X11Grabber.h>
X11Grabber::X11Grabber(bool useXGetImage, int cropLeft, int cropRight, int cropTop, int cropBottom, int horizontalPixelDecimation, int verticalPixelDecimation)
: _imageResampler()
: Grabber("X11GRABBER", 0, 0, cropLeft, cropRight, cropTop, cropBottom)
, _useXGetImage(useXGetImage)
, _cropLeft(cropLeft)
, _cropRight(cropRight)
, _cropTop(cropTop)
, _cropBottom(cropBottom)
, _x11Display(nullptr)
, _pixmap(None)
, _srcFormat(nullptr)
@ -18,10 +14,7 @@ X11Grabber::X11Grabber(bool useXGetImage, int cropLeft, int cropRight, int cropT
, _verticalDecimation(verticalPixelDecimation)
, _screenWidth(0)
, _screenHeight(0)
, _croppedWidth(0)
, _croppedHeight(0)
, _image(0,0)
, _log(Logger::getInstance("X11GRABBER"))
{
_imageResampler.setCropping(0, 0, 0, 0); // cropping is performed by XRender, XShmGetImage or XGetImage
memset(&_pictAttr, 0, sizeof(_pictAttr));
@ -37,11 +30,6 @@ X11Grabber::~X11Grabber()
}
}
void X11Grabber::setVideoMode(const VideoMode videoMode)
{
_imageResampler.set3D(videoMode);
}
void X11Grabber::freeResources()
{
// Cleanup allocated resources of the X11 grab
@ -66,7 +54,7 @@ void X11Grabber::setupResources()
{
_xImage = XShmCreateImage(_x11Display, _windowAttr.visual,
_windowAttr.depth, ZPixmap, NULL, &_shminfo,
_croppedWidth, _croppedHeight);
_width, _height);
_shminfo.shmid = shmget(IPC_PRIVATE, _xImage->bytes_per_line * _xImage->height, IPC_CREAT|0777);
_xImage->data = (char*)shmat(_shminfo.shmid,0,0);
_shminfo.shmaddr = _xImage->data;
@ -77,11 +65,11 @@ void X11Grabber::setupResources()
{
if(_XShmPixmapAvailable)
{
_pixmap = XShmCreatePixmap(_x11Display, _window, _xImage->data, &_shminfo, _croppedWidth, _croppedHeight, _windowAttr.depth);
_pixmap = XShmCreatePixmap(_x11Display, _window, _xImage->data, &_shminfo, _width, _height, _windowAttr.depth);
}
else
{
_pixmap = XCreatePixmap(_x11Display, _window, _croppedWidth, _croppedHeight, _windowAttr.depth);
_pixmap = XCreatePixmap(_x11Display, _window, _width, _height, _windowAttr.depth);
}
_srcFormat = XRenderFindVisualFormat(_x11Display, _windowAttr.visual);
_dstFormat = XRenderFindVisualFormat(_x11Display, _windowAttr.visual);
@ -168,8 +156,8 @@ Image<ColorRgb> & X11Grabber::grab()
0, // mask_y
0, // dst_x
0, // dst_y
_croppedWidth, // width
_croppedHeight); // height
_width, // width
_height); // height
XSync(_x11Display, False);
@ -179,7 +167,7 @@ Image<ColorRgb> & X11Grabber::grab()
}
else
{
_xImage = XGetImage(_x11Display, _pixmap, 0, 0, _croppedWidth, _croppedHeight, AllPlanes, ZPixmap);
_xImage = XGetImage(_x11Display, _pixmap, 0, 0, _width, _height, AllPlanes, ZPixmap);
}
}
else
@ -189,7 +177,7 @@ Image<ColorRgb> & X11Grabber::grab()
}
else
{
_xImage = XGetImage(_x11Display, _window, _cropLeft, _cropTop, _croppedWidth, _croppedHeight, AllPlanes, ZPixmap);
_xImage = XGetImage(_x11Display, _window, _cropLeft, _cropTop, _width, _height, AllPlanes, ZPixmap);
}
}
@ -246,8 +234,8 @@ int X11Grabber::grabFrame(Image<ColorRgb> & image)
0, // mask_y
0, // dst_x
0, // dst_y
_croppedWidth, // width
_croppedHeight); // height
_width, // width
_height); // height
XSync(_x11Display, False);
@ -257,7 +245,7 @@ int X11Grabber::grabFrame(Image<ColorRgb> & image)
}
else
{
_xImage = XGetImage(_x11Display, _pixmap, 0, 0, _croppedWidth, _croppedHeight, AllPlanes, ZPixmap);
_xImage = XGetImage(_x11Display, _pixmap, 0, 0, _width, _height, AllPlanes, ZPixmap);
}
}
else
@ -267,7 +255,7 @@ int X11Grabber::grabFrame(Image<ColorRgb> & image)
}
else
{
_xImage = XGetImage(_x11Display, _window, _cropLeft, _cropTop, _croppedWidth, _croppedHeight, AllPlanes, ZPixmap);
_xImage = XGetImage(_x11Display, _window, _cropLeft, _cropTop, _width, _height, AllPlanes, ZPixmap);
}
}
@ -309,11 +297,11 @@ int X11Grabber::updateScreenDimensions()
// Image scaling is performed by XRender when available, otherwise by ImageResampler
if (_XRenderAvailable && !_useXGetImage)
{
_croppedWidth = (_screenWidth > unsigned(_cropLeft + _cropRight))
_width = (_screenWidth > unsigned(_cropLeft + _cropRight))
? ((_screenWidth - _cropLeft - _cropRight) / _horizontalDecimation)
: _screenWidth / _horizontalDecimation;
_croppedHeight = (_screenHeight > unsigned(_cropTop + _cropBottom))
_height = (_screenHeight > unsigned(_cropTop + _cropBottom))
? ((_screenHeight - _cropTop - _cropBottom) / _verticalDecimation)
: _screenHeight / _verticalDecimation;
@ -321,18 +309,18 @@ int X11Grabber::updateScreenDimensions()
}
else
{
_croppedWidth = (_screenWidth > unsigned(_cropLeft + _cropRight))
_width = (_screenWidth > unsigned(_cropLeft + _cropRight))
? (_screenWidth - _cropLeft - _cropRight)
: _screenWidth;
_croppedHeight = (_screenHeight > unsigned(_cropTop + _cropBottom))
_height = (_screenHeight > unsigned(_cropTop + _cropBottom))
? (_screenHeight - _cropTop - _cropBottom)
: _screenHeight;
Info(_log, "Using XGetImage for grabbing");
}
_image.resize(_croppedWidth, _croppedHeight);
_image.resize(_width, _height);
setupResources();
return 1;

View File

@ -1,3 +1,4 @@
// Hyperion includes
#include <hyperion/Hyperion.h>
#include <hyperion/ImageProcessorFactory.h>

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())

View File

@ -3,22 +3,12 @@
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/jsonserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/jsonserver)
set(JsonServer_HEADERS
${CURRENT_HEADER_DIR}/JsonServer.h
${CURRENT_SOURCE_DIR}/JsonClientConnection.h
)
FILE ( GLOB JsonServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(JsonServer_SOURCES
${CURRENT_SOURCE_DIR}/JsonServer.cpp
${CURRENT_SOURCE_DIR}/JsonClientConnection.cpp
)
add_library(jsonserver
${JsonServer_HEADERS}
${JsonServer_SOURCES}
)
add_library(jsonserver ${JsonServer_SOURCES} )
target_link_libraries(jsonserver
hyperion
Qt5::Network
Qt5::Gui)
Qt5::Gui
)

View File

@ -3,19 +3,9 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/kodivideochecker)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/kodivideochecker)
SET(KODIVideoChecker_HEADERS
${CURRENT_HEADER_DIR}/KODIVideoChecker.h
)
FILE ( GLOB KODIVideoChecker_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(KODIVideoChecker_SOURCES
${CURRENT_SOURCE_DIR}/KODIVideoChecker.cpp
)
add_library(kodivideochecker
${KODIVideoChecker_HEADERS}
${KODIVideoChecker_SOURCES}
)
add_library(kodivideochecker ${KODIVideoChecker_SOURCES} )
target_link_libraries(kodivideochecker
hyperion

View File

@ -18,6 +18,10 @@ include_directories(
SET(Leddevice_HEADERS
${CURRENT_HEADER_DIR}/LedDeviceFactory.h
${CURRENT_SOURCE_DIR}/ProviderRs232.h
${CURRENT_SOURCE_DIR}/ProviderHID.h
${CURRENT_SOURCE_DIR}/ProviderUdp.h
${CURRENT_SOURCE_DIR}/LedDeviceLightpack.h
${CURRENT_SOURCE_DIR}/LedDeviceMultiLightpack.h
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.h
@ -29,17 +33,14 @@ SET(Leddevice_HEADERS
${CURRENT_SOURCE_DIR}/LedDeviceUdpH801.h
${CURRENT_SOURCE_DIR}/LedDeviceUdpE131.h
${CURRENT_SOURCE_DIR}/LedDeviceUdpArtNet.h
${CURRENT_SOURCE_DIR}/ProviderUdp.h
${CURRENT_SOURCE_DIR}/LedDeviceHyperionUsbasp.h
${CURRENT_SOURCE_DIR}/LedDeviceTpm2.h
${CURRENT_SOURCE_DIR}/LedDeviceTpm2net.h
${CURRENT_SOURCE_DIR}/LedDeviceAtmo.h
${CURRENT_HEADER_DIR}/LedDevice.h
${CURRENT_SOURCE_DIR}/ProviderRs232.h
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.h
${CURRENT_SOURCE_DIR}/LedDeviceAtmoOrb.h
${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.h
${CURRENT_SOURCE_DIR}/ProviderHID.h
${CURRENT_SOURCE_DIR}/LedDeviceRawHID.h
${CURRENT_SOURCE_DIR}/LedDeviceFadeCandy.h
)
@ -50,6 +51,7 @@ SET(Leddevice_SOURCES
${CURRENT_SOURCE_DIR}/ProviderRs232.cpp
${CURRENT_SOURCE_DIR}/ProviderHID.cpp
${CURRENT_SOURCE_DIR}/ProviderUdp.cpp
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.cpp
${CURRENT_SOURCE_DIR}/LedDeviceAtmoOrb.cpp
@ -66,7 +68,6 @@ SET(Leddevice_SOURCES
${CURRENT_SOURCE_DIR}/LedDeviceUdpH801.cpp
${CURRENT_SOURCE_DIR}/LedDeviceUdpE131.cpp
${CURRENT_SOURCE_DIR}/LedDeviceUdpArtNet.cpp
${CURRENT_SOURCE_DIR}/ProviderUdp.cpp
${CURRENT_SOURCE_DIR}/LedDeviceHyperionUsbasp.cpp
${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.cpp
${CURRENT_SOURCE_DIR}/LedDeviceTpm2.cpp

View File

@ -7,31 +7,13 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${PROTOBUF_INCLUDE_DIRS}
)
FILE ( GLOB ProtoServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(ProtoServer_HEADERS
${CURRENT_HEADER_DIR}/ProtoServer.h
${CURRENT_HEADER_DIR}/ProtoConnection.h
${CURRENT_SOURCE_DIR}/ProtoClientConnection.h
${CURRENT_HEADER_DIR}/ProtoConnectionWrapper.h
)
set(ProtoServer_PROTOS ${CURRENT_SOURCE_DIR}/message.proto )
set(ProtoServer_SOURCES
${CURRENT_SOURCE_DIR}/ProtoServer.cpp
${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp
${CURRENT_SOURCE_DIR}/ProtoConnection.cpp
${CURRENT_SOURCE_DIR}/ProtoConnectionWrapper.cpp
)
set(ProtoServer_PROTOS
${CURRENT_SOURCE_DIR}/message.proto
)
protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS
${ProtoServer_PROTOS}
)
protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS ${ProtoServer_PROTOS} )
add_library(protoserver
${ProtoServer_HEADERS}
${ProtoServer_SOURCES}
${ProtoServer_PROTOS}
${ProtoServer_PROTO_SRCS}

View File

@ -3,20 +3,12 @@
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/udplistener)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/udplistener)
set(UDPListener_HEADERS
${CURRENT_HEADER_DIR}/UDPListener.h
)
FILE ( GLOB UDPListener_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(UDPListener_SOURCES
${CURRENT_SOURCE_DIR}/UDPListener.cpp
)
add_library(udplistener
${UDPListener_HEADERS}
${UDPListener_SOURCES}
)
add_library(udplistener ${UDPListener_SOURCES} )
target_link_libraries(udplistener
hyperion
hyperion-utils
${QT_LIBRARIES})
${QT_LIBRARIES}
)

View File

@ -3,67 +3,19 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/utils)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/utils)
SET(Utils_HEADERS
${CURRENT_HEADER_DIR}/ColorBgr.h
${CURRENT_HEADER_DIR}/ColorRgb.h
${CURRENT_HEADER_DIR}/ColorRgba.h
${CURRENT_HEADER_DIR}/ColorRgbw.h
${CURRENT_HEADER_DIR}/Image.h
${CURRENT_HEADER_DIR}/Sleep.h
${CURRENT_HEADER_DIR}/FileUtils.h
${CURRENT_HEADER_DIR}/Process.h
${CURRENT_HEADER_DIR}/PixelFormat.h
${CURRENT_HEADER_DIR}/VideoMode.h
${CURRENT_HEADER_DIR}/ImageResampler.h
${CURRENT_HEADER_DIR}/RgbTransform.h
${CURRENT_HEADER_DIR}/ColorSys.h
${CURRENT_HEADER_DIR}/RgbChannelAdjustment.h
${CURRENT_HEADER_DIR}/RgbToRgbw.h
${CURRENT_HEADER_DIR}/jsonschema/QJsonFactory.h
${CURRENT_HEADER_DIR}/jsonschema/QJsonSchemaChecker.h
${CURRENT_HEADER_DIR}/jsonschema/QJsonUtils.h
${CURRENT_HEADER_DIR}/global_defines.h
${CURRENT_HEADER_DIR}/SysInfo.h
${CURRENT_HEADER_DIR}/Logger.h
${CURRENT_HEADER_DIR}/Stats.h
${CURRENT_HEADER_DIR}/JsonProcessor.h
)
FILE ( GLOB_RECURSE Utils_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(Utils_SOURCES
${CURRENT_SOURCE_DIR}/ColorArgb.cpp
${CURRENT_SOURCE_DIR}/ColorBgr.cpp
${CURRENT_SOURCE_DIR}/ColorRgb.cpp
${CURRENT_SOURCE_DIR}/ColorRgba.cpp
${CURRENT_SOURCE_DIR}/ColorRgbw.cpp
${CURRENT_SOURCE_DIR}/FileUtils.cpp
${CURRENT_SOURCE_DIR}/Process.cpp
${CURRENT_SOURCE_DIR}/Logger.cpp
${CURRENT_SOURCE_DIR}/ImageResampler.cpp
${CURRENT_SOURCE_DIR}/ColorSys.cpp
${CURRENT_SOURCE_DIR}/RgbChannelAdjustment.cpp
${CURRENT_SOURCE_DIR}/RgbTransform.cpp
${CURRENT_SOURCE_DIR}/RgbToRgbw.cpp
${CURRENT_SOURCE_DIR}/SysInfo.cpp
${CURRENT_SOURCE_DIR}/Stats.cpp
${CURRENT_SOURCE_DIR}/JsonProcessor.cpp
${CURRENT_SOURCE_DIR}/jsonschema/QJsonSchemaChecker.cpp
)
if ( ENABLE_PROFILER )
SET ( PROFILER_SOURCE ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp )
if ( NOT ENABLE_PROFILER )
LIST ( REMOVE_ITEM Utils_SOURCES ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp )
endif()
set(Utils_RESOURCES
${CURRENT_SOURCE_DIR}/JSONRPC_schemas.qrc
)
set(Utils_RESOURCES ${CURRENT_SOURCE_DIR}/JSONRPC_schemas.qrc )
qt5_add_resources(Utils_RESOURCES_RCC ${Utils_RESOURCES} OPTIONS "-no-compress")
add_library(hyperion-utils
${Utils_HEADERS}
${Utils_SOURCES}
${PROFILER_SOURCE}
${Utils_RESOURCES}
${Utils_RESOURCES_RCC}
)

View File

@ -0,0 +1,19 @@
{
"type":"object",
"required":true,
"properties":{
"command": {
"type" : "string",
"required" : true,
"enum" : ["videomode"]
},
"tan" : {
"type" : "integer"
},
"mappingType": {
"type" : "string",
"enum" : ["2D", "3DSBS", "3DTAB"]
}
},
"additionalProperties": false
}

View File

@ -5,7 +5,7 @@
"command": {
"type" : "string",
"required" : true,
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo"]
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode"]
}
}
}

View File

@ -17,5 +17,6 @@
<file alias="schema-ledcolors">JSONRPC_schema/schema-ledcolors.json</file>
<file alias="schema-logging">JSONRPC_schema/schema-logging.json</file>
<file alias="schema-processing">JSONRPC_schema/schema-processing.json</file>
<file alias="schema-videomode">JSONRPC_schema/schema-videomode.json</file>
</qresource>
</RCC>

View File

@ -136,6 +136,7 @@ void JsonProcessor::handleMessage(const QString& messageString, const QString pe
else if (command == "ledcolors") handleLedColorsCommand (message, command, tan);
else if (command == "logging") handleLoggingCommand (message, command, tan);
else if (command == "processing") handleProcessingCommand (message, command, tan);
else if (command == "videomode") handleVideoModeCommand (message, command, tan);
else handleNotImplemented ();
}
catch (std::exception& e)
@ -583,7 +584,7 @@ void JsonProcessor::handleServerInfoCommand(const QJsonObject&, const QString& c
// get available led devices
QJsonObject ledDevices;
ledDevices["active"] =LedDevice::activeDevice();
ledDevices["active"] = LedDevice::activeDevice();
QJsonArray availableLedDevices;
for (auto dev: LedDevice::getDeviceMap())
{
@ -593,21 +594,19 @@ void JsonProcessor::handleServerInfoCommand(const QJsonObject&, const QString& c
ledDevices["available"] = availableLedDevices;
info["ledDevices"] = ledDevices;
QJsonObject grabbers;
QJsonArray availableGrabbers;
#if defined(ENABLE_DISPMANX) || defined(ENABLE_V4L2) || defined(ENABLE_FB) || defined(ENABLE_AMLOGIC) || defined(ENABLE_OSX) || defined(ENABLE_X11)
// get available grabbers
QJsonObject grabbers;
//grabbers["active"] = ????;
QJsonArray availableGrabbers;
for (auto grabber: GrabberWrapper::availableGrabbers())
{
availableGrabbers.append(grabber);
}
grabbers["available"] = availableGrabbers;
info["grabbers"] = grabbers;
#else
info["grabbers"] = QString("none");
#endif
grabbers["available"] = availableGrabbers;
grabbers["videomode"] = QString(videoMode2String(_hyperion->getCurrentVideoMode()));
info["grabbers"] = grabbers;
// get available components
QJsonArray component;
@ -1036,6 +1035,13 @@ void JsonProcessor::handleProcessingCommand(const QJsonObject& message, const QS
sendSuccessReply(command, tan);
}
void JsonProcessor::handleVideoModeCommand(const QJsonObject& message, const QString &command, const int tan)
{
_hyperion->setVideoMode(parse3DMode(message["videoMode"].toString("2D")));
sendSuccessReply(command, tan);
}
void JsonProcessor::handleNotImplemented()
{
sendErrorReply("Command not implemented");

View File

@ -3,27 +3,9 @@
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/webconfig)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/webconfig)
set(WebConfig_HEADERS
${CURRENT_SOURCE_DIR}/QtHttpClientWrapper.h
${CURRENT_SOURCE_DIR}/QtHttpReply.h
${CURRENT_SOURCE_DIR}/QtHttpRequest.h
${CURRENT_SOURCE_DIR}/QtHttpServer.h
${CURRENT_SOURCE_DIR}/CgiHandler.h
${CURRENT_SOURCE_DIR}/StaticFileServing.h
${CURRENT_HEADER_DIR}/WebConfig.h
)
set(WebConfig_SOURCES
${CURRENT_SOURCE_DIR}/QtHttpClientWrapper.cpp
${CURRENT_SOURCE_DIR}/QtHttpHeader.cpp
${CURRENT_SOURCE_DIR}/QtHttpReply.cpp
${CURRENT_SOURCE_DIR}/QtHttpRequest.cpp
${CURRENT_SOURCE_DIR}/QtHttpServer.cpp
${CURRENT_SOURCE_DIR}/CgiHandler.cpp
${CURRENT_SOURCE_DIR}/StaticFileServing.cpp
${CURRENT_SOURCE_DIR}/WebConfig.cpp
)
FILE ( GLOB WebConfig_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
FILE ( GLOB_RECURSE webFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig/* )
FOREACH( f ${webFiles} )
STRING ( REPLACE "../assets/webconfig/" "" fname ${f})
SET(HYPERION_WEBCONFIG_RES "${HYPERION_WEBCONFIG_RES}\n\t\t<file alias=\"/webconfig/${fname}\">${f}</file>")
@ -34,7 +16,6 @@ SET(WebConfig_RESOURCES ${CMAKE_BINARY_DIR}/WebConfig.qrc)
qt5_add_resources(WebConfig_RESOURCES_RCC ${WebConfig_RESOURCES} ) #OPTIONS "-no-compress"
add_library(webconfig
${WebConfig_HEADERS}
${WebConfig_SOURCES}
${WebConfig_RESOURCES_RCC}
)

View File

@ -576,6 +576,16 @@ void JsonConnection::setLedMapping(QString mappingType)
parseReply(reply);
}
void JsonConnection::setVideoMode(QString videoMode)
{
QJsonObject command;
command["command"] = QString("videomode");
command["videoMode"] = videoMode.toUpper();
QJsonObject reply = sendMessage(command);
parseReply(reply);
}
QJsonObject JsonConnection::sendMessage(const QJsonObject & message)
{
// serialize message

View File

@ -165,6 +165,10 @@ public:
/// @param mappingType led mapping type
void setLedMapping(QString mappingType);
// sets video mode 3D/2D
void setVideoMode(QString videoMode);
private:
///
/// Send a json command message and receive its reply

View File

@ -92,6 +92,7 @@ int main(int argc, char * argv[])
ColorOption & argWAdjust = parser.add<ColorOption> ('W', "whiteAdjustment", "Set the adjustment of the white color (requires colors in hex format as RRGGBB)");
ColorOption & argbAdjust = parser.add<ColorOption> ('b', "blackAdjustment", "Set the adjustment of the black color (requires colors in hex format as RRGGBB)");
Option & argMapping = parser.add<Option> ('m', "ledMapping" , "Set the methode for image to led mapping valid values: multicolor_mean, unicolor_mean");
Option & argVideoMode = parser.add<Option> ('V', "videoMode" , "Set the video mode valid values: 3D, 3DSBS, 3DTAB");
IntOption & argSource = parser.add<IntOption> (0x0, "sourceSelect" , "Set current active priority channel and deactivate auto source switching");
BooleanOption & argSourceAuto = parser.add<BooleanOption>(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source");
BooleanOption & argOff = parser.add<BooleanOption>(0x0, "off", "deactivates hyperion");
@ -118,7 +119,7 @@ int main(int argc, char * argv[])
int commandCount = count({ parser.isSet(argColor), parser.isSet(argImage), parser.isSet(argEffect), parser.isSet(argCreateEffect), parser.isSet(argDeleteEffect),
parser.isSet(argServerInfo), parser.isSet(argSysInfo),parser.isSet(argClear), parser.isSet(argClearAll), parser.isSet(argEnableComponent), parser.isSet(argDisableComponent), colorAdjust,
parser.isSet(argSource), parser.isSet(argSourceAuto), parser.isSet(argOff), parser.isSet(argOn), parser.isSet(argConfigGet), parser.isSet(argSchemaGet), parser.isSet(argConfigSet),
parser.isSet(argMapping) });
parser.isSet(argMapping),parser.isSet(argVideoMode) });
if (commandCount != 1)
{
qWarning() << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:";
@ -235,6 +236,10 @@ int main(int argc, char * argv[])
{
connection.setLedMapping(argMapping.value(parser));
}
else if (parser.isSet(argVideoMode))
{
connection.setVideoMode(argVideoMode.value(parser));
}
else if (colorAdjust)
{
connection.setAdjustment(

View File

@ -176,11 +176,11 @@ int main(int argc, char** argv)
// set 3D mode if applicable
if (parser.isSet(arg3DSBS))
{
grabber.set3D(VIDEO_3DSBS);
grabber.setVideoMode(VIDEO_3DSBS);
}
else if (parser.isSet(arg3DTAB))
{
grabber.set3D(VIDEO_3DTAB);
grabber.setVideoMode(VIDEO_3DTAB);
}
// run the grabber

View File

@ -278,7 +278,9 @@ void HyperionDaemon::createKODIVideoChecker()
_kodiVideoChecker->start();
}
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_KODICHECKER, _kodiVideoChecker->componentState());
connect( Hyperion::getInstance(), SIGNAL(componentStateChanged(hyperion::Components,bool)), _kodiVideoChecker, SLOT(componentStateChanged(hyperion::Components,bool)));
QObject::connect( _hyperion, SIGNAL(componentStateChanged(hyperion::Components,bool)), _kodiVideoChecker, SLOT(componentStateChanged(hyperion::Components,bool)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _hyperion, SLOT(setVideoMode(VideoMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _hyperion, SLOT(setGrabbingMode(GrabbingMode)));
}
void HyperionDaemon::startNetworkServices()
@ -461,7 +463,7 @@ void HyperionDaemon::createGrabberDispmanx()
_dispmanx->setCropping(_grabber_cropLeft, _grabber_cropRight, _grabber_cropTop, _grabber_cropBottom);
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
QObject::connect(_hyperion, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
@ -479,10 +481,7 @@ void HyperionDaemon::createGrabberAmlogic()
#ifdef ENABLE_AMLOGIC
_amlGrabber = new AmlogicWrapper(_grabber_width, _grabber_height, _grabber_frequency, _grabber_priority-1);
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
_amlGrabber->start();
Info(_log, "AMLOGIC grabber created and started");
@ -501,10 +500,7 @@ void HyperionDaemon::createGrabberX11(const QJsonObject & grabberConfig)
grabberConfig["verticalPixelDecimation"].toInt(8),
_grabber_frequency, _grabber_priority );
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _x11Grabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _x11Grabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_x11Grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_x11Grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
_x11Grabber->start();
Info(_log, "X11 grabber created and started");
@ -522,10 +518,7 @@ void HyperionDaemon::createGrabberFramebuffer(const QJsonObject & grabberConfig)
grabberConfig["device"].toString("/dev/fb0"),
_grabber_width, _grabber_height, _grabber_frequency, _grabber_priority);
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
_fbGrabber->start();
Info(_log, "Framebuffer grabber created and started");
@ -543,10 +536,7 @@ void HyperionDaemon::createGrabberOsx(const QJsonObject & grabberConfig)
grabberConfig["display"].toInt(0),
_grabber_width, _grabber_height, _grabber_frequency, _grabber_priority);
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)) );
_osxGrabber->start();
Info(_log, "OSX grabber created and started");
@ -587,8 +577,9 @@ void HyperionDaemon::createGrabberV4L2()
grabberConfig["redSignalThreshold"].toDouble(0.0)/100.0,
grabberConfig["greenSignalThreshold"].toDouble(0.0)/100.0,
grabberConfig["blueSignalThreshold"].toDouble(0.0)/100.0,
grabberConfig["priority"].toInt(890));
grabber->set3D(parse3DMode(grabberConfig["mode"].toString("2D")));
grabberConfig["priority"].toInt(890),
grabberConfig["useKodiChecker"].toBool(false));
grabber->setVideoMode(parse3DMode(grabberConfig["mode"].toString("2D")));
grabber->setCropping(
grabberConfig["cropLeft"].toInt(0),
grabberConfig["cropRight"].toInt(0),
@ -603,11 +594,7 @@ void HyperionDaemon::createGrabberV4L2()
Debug(_log, "V4L2 grabber created");
QObject::connect(grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)));
QObject::connect(grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _hyperion, SLOT(setImage(int, const Image<ColorRgb>&, const int)));
if (grabberConfig["useKodiChecker"].toBool(false))
{
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), grabber, SLOT(setGrabbingMode(GrabbingMode)));
}
if (enableV4l && grabber->start())
{
v4lStarted = true;