diff options
-rw-r--r-- | utils/qv4l2/capture-win.cpp | 24 | ||||
-rw-r--r-- | utils/qv4l2/capture-win.h | 2 | ||||
-rw-r--r-- | utils/qv4l2/qv4l2.cpp | 6 |
3 files changed, 29 insertions, 3 deletions
diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp index 3437cf1a..d388b03f 100644 --- a/utils/qv4l2/capture-win.cpp +++ b/utils/qv4l2/capture-win.cpp @@ -26,6 +26,8 @@ #include <QApplication> #include <QDesktopWidget> +#include <math.h> + #define MIN_WIN_SIZE_WIDTH 160 #define MIN_WIN_SIZE_HEIGHT 120 @@ -281,6 +283,28 @@ void CaptureWin::setPixelAspectRatio(double ratio) resetSize(); } +float CaptureWin::getHorScaleFactor() +{ + float ow, sw, wscale; + + sw = m_scaledSize.width(); + ow = m_origFrameSize.width(); + wscale = floor(100 * (sw / ow)) / 100.0; + + return wscale; +} + +float CaptureWin::getVertScaleFactor() +{ + float oh, sh, hscale; + + sh = m_scaledSize.height(); + oh = m_origFrameSize.height(); + hscale = floor(100 * (sh / oh)) / 100.0; + + return hscale; +} + void CaptureWin::mouseDoubleClickEvent(QMouseEvent *e) { m_appWin->m_makeFullScreenAct->toggle(); diff --git a/utils/qv4l2/capture-win.h b/utils/qv4l2/capture-win.h index 618f4d6a..7330efe6 100644 --- a/utils/qv4l2/capture-win.h +++ b/utils/qv4l2/capture-win.h @@ -67,6 +67,8 @@ public: void setWindowSize(QSize size); void enableScaling(bool enable); void setPixelAspectRatio(double ratio); + float getHorScaleFactor(); + float getVertScaleFactor(); virtual void setColorspace(unsigned colorspace) = 0; virtual void setField(unsigned field) = 0; virtual void setDisplayColorspace(unsigned colorspace) = 0; diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index 7a346835..0e168e83 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -777,7 +777,6 @@ void ApplicationWindow::outFrame() m_tv = tv; } - status = QString("Frame: %1 Fps: %2").arg(++m_frame).arg(m_fps); if (m_capMethod == methodMmap || m_capMethod == methodUser) { @@ -897,8 +896,9 @@ void ApplicationWindow::capFrame() m_tv = tv; } - - status = QString("Frame: %1 Fps: %2").arg(++m_frame).arg(m_fps); + float wscale = m_capture->getHorScaleFactor(); + float hscale = m_capture->getVertScaleFactor(); + status = QString("Frame: %1 Fps: %2 Scale Factors: %3x%4").arg(++m_frame).arg(m_fps).arg(wscale).arg(hscale); #ifdef HAVE_ALSA if (alsa_thread_is_running()) { if (tv_alsa.tv_sec || tv_alsa.tv_usec) { |