mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Added image flipping ability to MF Grabber
This commit is contained in:
@@ -56,7 +56,7 @@ public:
|
||||
QList<DevicePropertiesItem> valid = QList<DevicePropertiesItem>();
|
||||
};
|
||||
|
||||
MFGrabber(const QString & device, const unsigned width, const unsigned height, const unsigned fps, const unsigned input, int pixelDecimation);
|
||||
MFGrabber(const QString & device, const unsigned width, const unsigned height, const unsigned fps, const unsigned input, int pixelDecimation, QString flipMode);
|
||||
~MFGrabber() override;
|
||||
|
||||
void receive_image(const void *frameImageBuffer, int size);
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
bool setFramerate(int fps) override;
|
||||
void setFpsSoftwareDecimation(int decimation);
|
||||
void setEncoding(QString enc);
|
||||
void setFlipMode(QString flipMode);
|
||||
void setBrightnessContrastSaturationHue(int brightness, int contrast, int saturation, int hue);
|
||||
|
||||
public slots:
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
unsigned int threadIndex, PixelFormat pixelFormat, uint8_t* sharedData,
|
||||
int size, int width, int height, int lineLength,
|
||||
int subsamp, unsigned cropLeft, unsigned cropTop, unsigned cropBottom, unsigned cropRight,
|
||||
VideoMode videoMode, int currentFrame, int pixelDecimation);
|
||||
VideoMode videoMode, FlipMode flipMode, int currentFrame, int pixelDecimation);
|
||||
void run();
|
||||
|
||||
bool isBusy();
|
||||
@@ -45,30 +45,33 @@ private:
|
||||
void processImageMjpeg();
|
||||
|
||||
#ifdef HAVE_TURBO_JPEG
|
||||
tjhandle _decompress;
|
||||
tjscalingfactor* _scalingFactors;
|
||||
tjhandle _transform,
|
||||
_decompress;
|
||||
tjscalingfactor* _scalingFactors;
|
||||
tjtransform* _xform;
|
||||
#endif
|
||||
|
||||
static volatile bool _isActive;
|
||||
volatile bool _isBusy;
|
||||
QSemaphore _semaphore;
|
||||
unsigned int _workerIndex;
|
||||
PixelFormat _pixelFormat;
|
||||
uint8_t* _localData;
|
||||
int _localDataSize;
|
||||
int _scalingFactorsCount;
|
||||
int _size;
|
||||
int _width;
|
||||
int _height;
|
||||
int _lineLength;
|
||||
int _subsamp;
|
||||
unsigned _cropLeft;
|
||||
unsigned _cropTop;
|
||||
unsigned _cropBottom;
|
||||
unsigned _cropRight;
|
||||
int _currentFrame;
|
||||
int _pixelDecimation;
|
||||
ImageResampler _imageResampler;
|
||||
volatile bool _isBusy;
|
||||
QSemaphore _semaphore;
|
||||
unsigned int _threadIndex;
|
||||
PixelFormat _pixelFormat;
|
||||
uint8_t* _localData;
|
||||
int _localDataSize,
|
||||
_scalingFactorsCount,
|
||||
_size,
|
||||
_width,
|
||||
_height,
|
||||
_lineLength,
|
||||
_subsamp,
|
||||
_currentFrame,
|
||||
_pixelDecimation;
|
||||
unsigned _cropLeft,
|
||||
_cropTop,
|
||||
_cropBottom,
|
||||
_cropRight;
|
||||
FlipMode _flipMode;
|
||||
ImageResampler _imageResampler;
|
||||
};
|
||||
|
||||
class MFThreadManager : public QObject
|
||||
@@ -116,7 +119,7 @@ public:
|
||||
|
||||
if (_threads != nullptr)
|
||||
{
|
||||
for(unsigned i=0; i < _maxThreads; i++)
|
||||
for(unsigned i = 0; i < _maxThreads; i++)
|
||||
if (_threads[i] != nullptr)
|
||||
{
|
||||
_threads[i]->quit();
|
||||
@@ -125,6 +128,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int _maxThreads;
|
||||
MFThread** _threads;
|
||||
unsigned int _maxThreads;
|
||||
MFThread** _threads;
|
||||
};
|
||||
|
@@ -8,7 +8,7 @@ class MFWrapper : public GrabberWrapper
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MFWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned fps, const unsigned input, int pixelDecimation);
|
||||
MFWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned fps, const unsigned input, int pixelDecimation, QString flipMode);
|
||||
~MFWrapper() override;
|
||||
|
||||
bool getSignalDetectionEnable() const;
|
||||
|
@@ -86,8 +86,8 @@ private:
|
||||
|
||||
unsigned _display;
|
||||
int _pixelDecimation;
|
||||
unsigned _screenWidth;
|
||||
unsigned _screenHeight;
|
||||
unsigned _calculatedWidth;
|
||||
unsigned _calculatedHeight;
|
||||
unsigned _src_x;
|
||||
unsigned _src_y;
|
||||
unsigned _src_x_max;
|
||||
|
@@ -30,6 +30,12 @@ public:
|
||||
///
|
||||
virtual void setVideoMode(VideoMode mode);
|
||||
|
||||
///
|
||||
/// Apply new flip mode (vertical/horizontal/both)
|
||||
/// @param[in] mode The new flip mode
|
||||
///
|
||||
virtual void setFlipMode(FlipMode mode);
|
||||
|
||||
///
|
||||
/// @brief Apply new crop values, on errors reject the values
|
||||
///
|
||||
@@ -161,8 +167,11 @@ protected:
|
||||
|
||||
bool _useImageResampler;
|
||||
|
||||
/// the selected VideoMode
|
||||
VideoMode _videoMode;
|
||||
/// The selected VideoMode
|
||||
VideoMode _videoMode;
|
||||
|
||||
/// The used Flip Mode
|
||||
FlipMode _flipMode;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
int _width;
|
||||
|
@@ -120,10 +120,10 @@ inline QString pixelFormatToString(const PixelFormat& pixelFormat)
|
||||
|
||||
enum class FlipMode
|
||||
{
|
||||
HORIZONTAL = 1,
|
||||
VERTICAL = 2,
|
||||
BOTH = HORIZONTAL | VERTICAL,
|
||||
NO_CHANGE = 4
|
||||
HORIZONTAL,
|
||||
VERTICAL,
|
||||
BOTH,
|
||||
NO_CHANGE
|
||||
};
|
||||
|
||||
inline FlipMode parseFlipMode(const QString& flipMode)
|
||||
@@ -131,15 +131,15 @@ inline FlipMode parseFlipMode(const QString& flipMode)
|
||||
// convert to lower case
|
||||
QString mode = flipMode.toLower();
|
||||
|
||||
if (flipMode.compare("horizontal") == 0)
|
||||
if (mode.compare("horizontal") == 0)
|
||||
{
|
||||
return FlipMode::HORIZONTAL;
|
||||
}
|
||||
else if (flipMode.compare("vertical") == 0)
|
||||
else if (mode.compare("vertical") == 0)
|
||||
{
|
||||
return FlipMode::VERTICAL;
|
||||
}
|
||||
else if (flipMode.compare("both") == 0)
|
||||
else if (mode.compare("both") == 0)
|
||||
{
|
||||
return FlipMode::BOTH;
|
||||
}
|
||||
@@ -150,7 +150,6 @@ inline FlipMode parseFlipMode(const QString& flipMode)
|
||||
|
||||
inline QString flipModeToString(const FlipMode& flipMode)
|
||||
{
|
||||
|
||||
if ( flipMode == FlipMode::HORIZONTAL)
|
||||
{
|
||||
return "horizontal";
|
||||
|
Reference in New Issue
Block a user