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}}; }
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;
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 setSignalDetectionOffset( double verticalMin, double horizontalMin, double verticalMax, double horizontalMax) override;
void setSignalDetectionEnable(bool enable) override;

View File

@ -155,7 +155,7 @@ public:
///
/// @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:

View File

@ -171,7 +171,7 @@ public:
/// @param heigth The device heigth
/// @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:
ImageResampler _imageResampler;

View File

@ -103,7 +103,7 @@ public:
/// @param heigth The device heigth
/// @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

View File

@ -1,4 +1,6 @@
#pragma once
#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;
resolution["width"] = width_height.key();
resolution["heigth"] = width_height.value();
resolution["height"] = width_height.value();
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)
{
fps.append(framerate);

View File

@ -718,14 +718,14 @@ QMultiMap<int, int> MFGrabber::getAvailableDeviceResolutions(const QString& devi
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 )
{
QString fps = QString::number(_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)
int fps = _deviceProperties[devicePath][i].numerator / _deviceProperties[devicePath][i].denominator;
if(!result.contains(fps) && _deviceProperties[devicePath][i].pf == encFormat && _deviceProperties[devicePath][i].width == width && _deviceProperties[devicePath][i].height == height)
result << fps;
}

View File

@ -1467,9 +1467,9 @@ QMultiMap<int, int> V4L2Grabber::getAvailableDeviceResolutions(const QString& de
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)
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++)
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++)
if(!result.contains(QString::number(*fps)))
result << QString::number(*fps);
if(!result.contains(*fps))
result << *fps;
return result;
}

View File

@ -262,10 +262,10 @@ QMultiMap<int, int> GrabberWrapper::getAvailableDeviceResolutions(const QString&
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"))
return _ggrabber->getAvailableDeviceFramerates(devicePath, deviceInput, encFormat, width, height);
return QStringList();
return QIntList();
}