Merge remote-tracking branch 'origin/master' into config

This commit is contained in:
LordGrey
2024-08-01 23:08:14 +02:00
58 changed files with 1964 additions and 232 deletions

View File

@@ -27,6 +27,10 @@
#include <grabber/directx/directXGrabber.h>
#endif
#ifdef ENABLE_DDA
#include <grabber/dda/DDAGrabber.h>
#endif
#if defined(ENABLE_X11)
#include <grabber/x11/X11Grabber.h>
#endif
@@ -35,10 +39,6 @@
#include <grabber/xcb/XcbGrabber.h>
#endif
#if defined(ENABLE_DX)
#include <grabber/directx/DirectXGrabber.h>
#endif
#if defined(ENABLE_FB)
#include <grabber/framebuffer/FramebufferFrameGrabber.h>
#endif

View File

@@ -0,0 +1,75 @@
#pragma once
#include <QObject>
#include <QJsonObject>
#include <hyperion/Grabber.h>
#include <utils/ColorRgb.h>
class DDAGrabberImpl;
class DDAGrabber : public Grabber
{
public:
DDAGrabber(int display = 0, int cropLeft = 0, int cropRight = 0, int cropTop = 0, int cropBottom = 0);
virtual ~DDAGrabber();
///
/// 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 _height)
///
/// @param[out] image The snapped screenshot
///
int grabFrame(Image<ColorRgb> &image);
///
/// @brief Set a new video mode
///
void setVideoMode(VideoMode mode) override;
///
/// @brief Apply new width/height values, overwrite Grabber.h implementation
///
bool setWidthHeight(int /* width */, int /*height*/) override
{
return true;
}
///
/// @brief Apply new pixelDecimation
///
bool setPixelDecimation(int pixelDecimation) override;
///
/// Set the crop values
/// @param cropLeft Left pixel crop
/// @param cropRight Right pixel crop
/// @param cropTop Top pixel crop
/// @param cropBottom Bottom pixel crop
///
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
///
/// @brief Apply display index
///
bool setDisplayIndex(int index) override;
/// @brief Discover QT screens available (for configuration).
///
/// @param[in] params Parameters used to overwrite discovery default behaviour
///
/// @return A JSON structure holding a list of devices found
///
QJsonObject discover(const QJsonObject &params);
private:
///
/// @brief Setup a new capture display, will free the previous one
/// @return True on success, false if no display is found
///
bool restartCapture();
private:
std::unique_ptr<DDAGrabberImpl> d;
};

View File

@@ -0,0 +1,24 @@
#pragma once
#include <grabber/dda/DDAGrabber.h>
#include <hyperion/GrabberWrapper.h>
class DDAWrapper : public GrabberWrapper
{
public:
static constexpr const char *GRABBERTYPE = "DDA";
DDAWrapper(int updateRate_Hz = GrabberWrapper::DEFAULT_RATE_HZ, int display = 0,
int pixelDecimation = GrabberWrapper::DEFAULT_PIXELDECIMATION, int cropLeft = 0, int cropRight = 0,
int cropTop = 0, int cropBottom = 0);
DDAWrapper(const QJsonDocument &grabberConfig = QJsonDocument());
virtual ~DDAWrapper(){};
public slots:
virtual void action();
private:
DDAGrabber _grabber;
};

View File

@@ -46,6 +46,7 @@ public:
int numerator = 0;
int denominator = 0;
PixelFormat pf = PixelFormat::NO_CHANGE;
long defstride = 0;
GUID guid = GUID_NULL;
};

View File

@@ -1,5 +1,11 @@
#pragma once
#define NOFRAME_BENCH
#ifdef FRAME_BENCH
#include <QElapsedTimer>
#endif
// stl includes
#include <vector>
#include <map>
@@ -166,6 +172,9 @@ private:
double _x_frac_max;
double _y_frac_max;
#ifdef FRAME_BENCH
QElapsedTimer _frameTimer;
#endif
QSocketNotifier *_streamNotifier;
bool _initialized, _reload;

View File

@@ -10,6 +10,7 @@ enum class PixelFormat {
YUYV,
UYVY,
BGR16,
RGB24,
BGR24,
RGB32,
BGR32,
@@ -36,6 +37,10 @@ inline PixelFormat parsePixelFormat(const QString& pixelFormat)
{
return PixelFormat::BGR16;
}
else if (format.compare("rgb24") == 0)
{
return PixelFormat::RGB24;
}
else if (format.compare("bgr24") == 0)
{
return PixelFormat::BGR24;
@@ -80,6 +85,10 @@ inline QString pixelFormatToString(const PixelFormat& pixelFormat)
{
return "BGR16";
}
else if (pixelFormat == PixelFormat::RGB24)
{
return "RGB24";
}
else if (pixelFormat == PixelFormat::BGR24)
{
return "BGR24";
@@ -115,10 +124,10 @@ inline QString pixelFormatToString(const PixelFormat& pixelFormat)
enum class FlipMode
{
NO_CHANGE,
HORIZONTAL,
VERTICAL,
BOTH,
NO_CHANGE
BOTH
};
inline FlipMode parseFlipMode(const QString& flipMode)

View File

@@ -11,7 +11,12 @@ namespace RGBW {
SUBTRACT_MINIMUM,
SUB_MIN_WARM_ADJUST,
SUB_MIN_COOL_ADJUST,
WHITE_OFF
WHITE_OFF,
COLD_WHITE,
NEUTRAL_WHITE,
AUTO,
AUTO_MAX,
AUTO_ACCURATE
};
WhiteAlgorithm stringToWhiteAlgorithm(const QString& str);