aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Arbring <aarbring@cisco.com>2014-08-05 15:38:27 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2014-08-07 08:28:16 +0200
commit086994e0497ba81b79cb0c8e15020797b3cf764c (patch)
tree8a5befa91de45cf12df1977cfe095f769796de47
parentafc06c00aa003548f95d84e0faf1371658ddf8b9 (diff)
qv4l2: Adding width and height scaling to the status bar
Signed-off-by: Anton Arbring <aarbring@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/qv4l2/capture-win.cpp24
-rw-r--r--utils/qv4l2/capture-win.h2
-rw-r--r--utils/qv4l2/qv4l2.cpp6
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) {

Privacy Policy