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

@@ -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;
};