diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 777a66b26..af58507dd 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -1984,13 +1984,13 @@ void Settings::setCamVideoRes(QRect newValue) } } -unsigned short Settings::getCamVideoFPS() const +float Settings::getCamVideoFPS() const { QMutexLocker locker{&bigLock}; return camVideoFPS; } -void Settings::setCamVideoFPS(unsigned short newValue) +void Settings::setCamVideoFPS(float newValue) { QMutexLocker locker{&bigLock}; diff --git a/src/persistence/settings.h b/src/persistence/settings.h index fe749a8d5..58a9053d1 100644 --- a/src/persistence/settings.h +++ b/src/persistence/settings.h @@ -117,7 +117,7 @@ class Settings : public QObject, public ICoreSettings, public IAudioSettings, pu Q_PROPERTY(QRect camVideoRes READ getCamVideoRes WRITE setCamVideoRes NOTIFY camVideoResChanged FINAL) Q_PROPERTY(QRect screenRegion READ getScreenRegion WRITE setScreenRegion NOTIFY screenRegionChanged FINAL) Q_PROPERTY(bool screenGrabbed READ getScreenGrabbed WRITE setScreenGrabbed NOTIFY screenGrabbedChanged FINAL) - Q_PROPERTY(quint16 camVideoFPS READ getCamVideoFPS WRITE setCamVideoFPS NOTIFY camVideoFPSChanged FINAL) + Q_PROPERTY(float camVideoFPS READ getCamVideoFPS WRITE setCamVideoFPS NOTIFY camVideoFPSChanged FINAL) public: enum class StyleType @@ -394,8 +394,8 @@ public: QRect getCamVideoRes() const override; void setCamVideoRes(QRect newValue) override; - unsigned short getCamVideoFPS() const override; - void setCamVideoFPS(unsigned short newValue) override; + float getCamVideoFPS() const override; + void setCamVideoFPS(float newValue) override; SIGNAL_IMPL(Settings, videoDevChanged, const QString& device) SIGNAL_IMPL(Settings, screenRegionChanged, const QRect& region) @@ -658,7 +658,7 @@ private: QRect camVideoRes; QRect screenRegion; bool screenGrabbed; - unsigned short camVideoFPS; + float camVideoFPS; struct friendProp { diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index 4451961a7..3c542db7a 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -153,9 +153,11 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode) return nullptr; } - int FPS = 5; - if (mode.FPS) { + float FPS = 5; + if (mode.FPS > 0.0f) { FPS = mode.FPS; + } else { + qWarning() << "VideoMode could be invalid!"; } const std::string videoSize = QStringLiteral("%1x%2").arg(mode.width).arg(mode.height).toStdString(); diff --git a/src/video/ivideosettings.h b/src/video/ivideosettings.h index b01593120..9af85981a 100644 --- a/src/video/ivideosettings.h +++ b/src/video/ivideosettings.h @@ -20,8 +20,8 @@ public: virtual QRect getCamVideoRes() const = 0; virtual void setCamVideoRes(QRect newValue) = 0; - virtual unsigned short getCamVideoFPS() const = 0; - virtual void setCamVideoFPS(unsigned short newValue) = 0; + virtual float getCamVideoFPS() const = 0; + virtual void setCamVideoFPS(float newValue) = 0; DECLARE_SIGNAL(videoDevChanged, const QString& device); DECLARE_SIGNAL(screenRegionChanged, const QRect& region); diff --git a/src/video/videomode.cpp b/src/video/videomode.cpp index 111e952c9..e5fa50c71 100644 --- a/src/video/videomode.cpp +++ b/src/video/videomode.cpp @@ -33,7 +33,7 @@ * @brief Frames per second supported by the device at this resolution */ -VideoMode::VideoMode(int width, int height, int x, int y, int FPS, int format) +VideoMode::VideoMode(int width, int height, int x, int y, float FPS, int format) : width(width) , height(height) , x(x) diff --git a/src/video/videomode.h b/src/video/videomode.h index b21c62deb..c16747950 100644 --- a/src/video/videomode.h +++ b/src/video/videomode.h @@ -30,7 +30,7 @@ struct VideoMode float FPS; uint32_t pixel_format; - VideoMode(int width = 0, int height = 0, int x = 0, int y = 0, int FPS = 0, int format = 0); + VideoMode(int width = 0, int height = 0, int x = 0, int y = 0, float FPS = 0.0f, int format = 0); explicit VideoMode(QRect rect);