qv4l2: when capturing show the frame and fps in both windows.
authorHans Verkuil <hans.verkuil@cisco.com>
Thu, 18 Aug 2011 12:29:09 +0000 (14:29 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Thu, 18 Aug 2011 12:29:09 +0000 (14:29 +0200)
Helps when testing 1080p streams to have it in both places.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/capture-win.cpp
utils/qv4l2/capture-win.h
utils/qv4l2/qv4l2.cpp

index 6628b94..838bb00 100644 (file)
@@ -37,12 +37,15 @@ CaptureWin::CaptureWin()
        vbox->addWidget(m_msg);
 }
 
-void CaptureWin::setImage(const QImage &image, bool init)
+QString CaptureWin::setImage(const QImage &image, bool init)
 {
+       QString txt;
+
        m_label->setPixmap(QPixmap::fromImage(image));
        if (init) {
                m_frame = m_lastFrame = m_fps = 0;
-               m_msg->setText("No frame");
+               txt = "No frame";
+               m_msg->setText(txt);
        } else {
                struct timeval tv, res;
 
@@ -56,9 +59,10 @@ void CaptureWin::setImage(const QImage &image, bool init)
                        m_lastFrame = m_frame;
                        m_tv = tv;
                }
-               m_msg->setText(QString("Frame: %1 Fps: %2")
-                               .arg(++m_frame).arg(m_fps));
+               txt = QString("Frame: %1 Fps: %2").arg(++m_frame).arg(m_fps);
+               m_msg->setText(txt);
        }
+       return txt;
 }
 
 void CaptureWin::closeEvent(QCloseEvent *event)
index 51e554d..1626741 100644 (file)
@@ -34,7 +34,7 @@ public:
        CaptureWin();
        virtual ~CaptureWin() {}
 
-       void setImage(const QImage &image, bool init = false);
+       QString setImage(const QImage &image, bool init = false);
        unsigned frame() const { return m_frame; }
 
 protected:
index 0fd17ab..bf4a29f 100644 (file)
@@ -244,7 +244,8 @@ void ApplicationWindow::capFrame()
        if (err == -1)
                error(v4lconvert_get_error_message(m_convertData));
 
-       m_capture->setImage(*m_capImage);
+       QString status = m_capture->setImage(*m_capImage);
+       statusBar()->showMessage(status);
        if (m_capture->frame() == 1)
                refresh();
 }
@@ -462,7 +463,8 @@ void ApplicationWindow::capStart(bool start)
        m_capture->setMinimumSize(m_capDestFormat.fmt.pix.width, m_capDestFormat.fmt.pix.height);
        m_capImage = new QImage(m_capDestFormat.fmt.pix.width, m_capDestFormat.fmt.pix.height, dstFmt);
        m_capImage->fill(0);
-       m_capture->setImage(*m_capImage, true);
+       QString status = m_capture->setImage(*m_capImage, true);
+       statusBar()->showMessage(status);
        m_capture->show();
        if (startCapture(m_capSrcFormat.fmt.pix.sizeimage)) {
                m_capNotifier = new QSocketNotifier(fd(), QSocketNotifier::Read, m_tabs);