Have fps as int, fix height typo

This commit is contained in:
Lord-Grey 2021-02-07 11:12:28 +01:00
parent 72226cd1de
commit 2ff3c1155b
9 changed files with 18 additions and 16 deletions

View File

@ -64,7 +64,7 @@ public:
QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const override { return {{ devicePath, 0}}; } QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const override { return {{ devicePath, 0}}; }
QStringList getAvailableEncodingFormats(const QString& devicePath, const int& /*deviceInput*/) const override; QStringList getAvailableEncodingFormats(const QString& devicePath, const int& /*deviceInput*/) const override;
QMultiMap<int, int> getAvailableDeviceResolutions(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat) const override; QMultiMap<int, int> getAvailableDeviceResolutions(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat) const override;
QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override; QIntList getAvailableDeviceFramerates(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold, int noSignalCounterThreshold) override; void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold, int noSignalCounterThreshold) override;
void setSignalDetectionOffset( double verticalMin, double horizontalMin, double verticalMax, double horizontalMax) override; void setSignalDetectionOffset( double verticalMin, double horizontalMin, double verticalMax, double horizontalMax) override;
void setSignalDetectionEnable(bool enable) override; void setSignalDetectionEnable(bool enable) override;

View File

@ -155,7 +155,7 @@ public:
/// ///
/// @brief overwrite Grabber.h implementation /// @brief overwrite Grabber.h implementation
/// ///
QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override; QIntList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
public slots: public slots:

View File

@ -171,7 +171,7 @@ public:
/// @param heigth The device heigth /// @param heigth The device heigth
/// @return List of framerates on success else empty List /// @return List of framerates on success else empty List
/// ///
virtual QStringList getAvailableDeviceFramerates(const QString& /*devicePath*/, const int& /*deviceInput*/, const PixelFormat& /*encFormat*/, const unsigned /*width*/, const unsigned /*height*/) const { return QStringList(); } virtual QIntList getAvailableDeviceFramerates(const QString& /*devicePath*/, const int& /*deviceInput*/, const PixelFormat& /*encFormat*/, const unsigned /*width*/, const unsigned /*height*/) const { return QIntList(); }
protected: protected:
ImageResampler _imageResampler; ImageResampler _imageResampler;

View File

@ -103,7 +103,7 @@ public:
/// @param heigth The device heigth /// @param heigth The device heigth
/// @return List of framerates on success else empty List /// @return List of framerates on success else empty List
/// ///
virtual QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const; virtual QIntList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const;
/// ///
/// @brief Get active grabber name /// @brief Get active grabber name

View File

@ -1,4 +1,6 @@
#pragma once #pragma once
#define QSTRING_CSTR(str) str.toLocal8Bit().constData() #define QSTRING_CSTR(str) str.toLocal8Bit().constData()
typedef QList< int > QIntList;

View File

@ -521,10 +521,10 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
{ {
QJsonObject resolution; QJsonObject resolution;
resolution["width"] = width_height.key(); resolution["width"] = width_height.key();
resolution["heigth"] = width_height.value(); resolution["height"] = width_height.value();
QJsonArray fps; QJsonArray fps;
QStringList framerates = GrabberWrapper::getInstance()->getAvailableDeviceFramerates(devicePath, input.value(), parsePixelFormat(encodingFormat), width_height.key(), width_height.value()); QIntList framerates = GrabberWrapper::getInstance()->getAvailableDeviceFramerates(devicePath, input.value(), parsePixelFormat(encodingFormat), width_height.key(), width_height.value());
for (auto framerate : framerates) for (auto framerate : framerates)
{ {
fps.append(framerate); fps.append(framerate);

View File

@ -718,14 +718,14 @@ QMultiMap<int, int> MFGrabber::getAvailableDeviceResolutions(const QString& devi
return result; return result;
} }
QStringList MFGrabber::getAvailableDeviceFramerates(const QString& devicePath, const int& /*device input not used on windows*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const QIntList MFGrabber::getAvailableDeviceFramerates(const QString& devicePath, const int& /*device input not used on windows*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
{ {
QStringList result = QStringList(); QIntList result = QIntList();
for(int i = 0; i < _deviceProperties[devicePath].count(); ++i ) for(int i = 0; i < _deviceProperties[devicePath].count(); ++i )
{ {
QString fps = QString::number(_deviceProperties[devicePath][i].numerator / _deviceProperties[devicePath][i].denominator); int fps = _deviceProperties[devicePath][i].numerator / _deviceProperties[devicePath][i].denominator;
if(!result.contains(fps, Qt::CaseInsensitive) && _deviceProperties[devicePath][i].pf == encFormat && _deviceProperties[devicePath][i].width == width && _deviceProperties[devicePath][i].height == height) if(!result.contains(fps) && _deviceProperties[devicePath][i].pf == encFormat && _deviceProperties[devicePath][i].width == width && _deviceProperties[devicePath][i].height == height)
result << fps; result << fps;
} }

View File

@ -1467,9 +1467,9 @@ QMultiMap<int, int> V4L2Grabber::getAvailableDeviceResolutions(const QString& de
return result; return result;
} }
QStringList V4L2Grabber::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const QIntList V4L2Grabber::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
{ {
QStringList result = QStringList(); QIntList result = QIntList();
for(auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it) for(auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it)
if (it.key() == devicePath) if (it.key() == devicePath)
@ -1478,8 +1478,8 @@ QStringList V4L2Grabber::getAvailableDeviceFramerates(const QString& devicePath,
for (auto enc = input.value().encodingFormats.begin(); enc != input.value().encodingFormats.end(); enc++) for (auto enc = input.value().encodingFormats.begin(); enc != input.value().encodingFormats.end(); enc++)
if(enc.key() == encFormat && enc.value().width == width && enc.value().height == height) if(enc.key() == encFormat && enc.value().width == width && enc.value().height == height)
for (auto fps = enc.value().framerates.begin(); fps != enc.value().framerates.end(); fps++) for (auto fps = enc.value().framerates.begin(); fps != enc.value().framerates.end(); fps++)
if(!result.contains(QString::number(*fps))) if(!result.contains(*fps))
result << QString::number(*fps); result << *fps;
return result; return result;
} }

View File

@ -262,10 +262,10 @@ QMultiMap<int, int> GrabberWrapper::getAvailableDeviceResolutions(const QString&
return QMultiMap<int, int>(); return QMultiMap<int, int>();
} }
QStringList GrabberWrapper::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const QIntList GrabberWrapper::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
{ {
if(_grabberName.startsWith("V4L")) if(_grabberName.startsWith("V4L"))
return _ggrabber->getAvailableDeviceFramerates(devicePath, deviceInput, encFormat, width, height); return _ggrabber->getAvailableDeviceFramerates(devicePath, deviceInput, encFormat, width, height);
return QStringList(); return QIntList();
} }