From eb40ce0ddd003b6aefcf88e04d72fc945293ef6c Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 18 Aug 2011 14:29:09 +0200 Subject: [PATCH] qv4l2: when capturing show the frame and fps in both windows. Helps when testing 1080p streams to have it in both places. Signed-off-by: Hans Verkuil --- utils/qv4l2/capture-win.cpp | 12 ++++++++---- utils/qv4l2/capture-win.h | 2 +- utils/qv4l2/qv4l2.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp index 6628b94..838bb00 100644 --- a/utils/qv4l2/capture-win.cpp +++ b/utils/qv4l2/capture-win.cpp @@ -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) diff --git a/utils/qv4l2/capture-win.h b/utils/qv4l2/capture-win.h index 51e554d..1626741 100644 --- a/utils/qv4l2/capture-win.h +++ b/utils/qv4l2/capture-win.h @@ -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: diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index 0fd17ab..bf4a29f 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -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); -- 2.7.4