From 41fac50526a7b4d3f29573e37fa368f97ffec4ea Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 11 Mar 2017 06:57:22 +0100 Subject: [PATCH] ATV Modulator: added camera details to the GUI --- plugins/channeltx/modatv/atvmod.cpp | 33 +++++++-- plugins/channeltx/modatv/atvmod.h | 16 ++-- plugins/channeltx/modatv/atvmodgui.cpp | 9 ++- plugins/channeltx/modatv/atvmodgui.h | 2 +- plugins/channeltx/modatv/atvmodgui.ui | 99 +++++++++++++++++++++++-- sdrbase/resources/camera.png | Bin 0 -> 823 bytes sdrbase/resources/res.qrc | 1 + 7 files changed, 133 insertions(+), 27 deletions(-) create mode 100644 sdrbase/resources/camera.png diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 77a4e7a80..1b522cc9b 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -624,6 +624,14 @@ void ATVMod::scanCameras() m_cameras.back().m_videoFPS = m_cameras.back().m_camera.get(CV_CAP_PROP_FPS); m_cameras.back().m_videoWidth = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_WIDTH); m_cameras.back().m_videoHeight = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_HEIGHT); + + m_cameras.back().m_videoFPS = m_cameras.back().m_videoFPS < 0 ? 25.0f : m_cameras.back().m_videoFPS; + + qDebug("ATVMod::scanCameras: [%d] FPS: %f %dx%d", + i, + m_cameras.back().m_videoFPS, + m_cameras.back().m_videoWidth , + m_cameras.back().m_videoHeight); } else { @@ -634,13 +642,6 @@ void ATVMod::scanCameras() if (m_cameras.size() > 0) { m_cameraIndex = 0; - MsgReportCameraData *report; - report = MsgReportCameraData::create( - m_cameras[0].m_cameraNumber, - m_cameras[0].m_videoFPS, - m_cameras[0].m_videoWidth, - m_cameras[0].m_videoHeight); - getOutputMessageQueue()->push(report); } } @@ -652,3 +653,21 @@ void ATVMod::releaseCameras() } } +void ATVMod::getCameraNumbers(std::vector& numbers) +{ + for (std::vector::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it) { + numbers.push_back(it->m_cameraNumber); + } + + if (m_cameras.size() > 0) + { + m_cameraIndex = 0; + MsgReportCameraData *report; + report = MsgReportCameraData::create( + m_cameras[0].m_cameraNumber, + m_cameras[0].m_videoFPS, + m_cameras[0].m_videoWidth, + m_cameras[0].m_videoHeight); + getOutputMessageQueue()->push(report); + } +} diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index 5778e54fc..560e7ec87 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -214,7 +214,7 @@ public: public: int getdeviceNumber() const { return m_deviceNumber; } - int getFPS() const { return m_fps; } + float getFPS() const { return m_fps; } int getWidth() const { return m_width; } int getHeight() const { return m_height; } @@ -233,13 +233,13 @@ public: protected: int m_deviceNumber; - int m_fps; + float m_fps; int m_width; int m_height; MsgReportCameraData( int deviceNumber, - int fps, + float fps, int width, int height) : Message(), @@ -271,11 +271,7 @@ public: Real getMagSq() const { return m_movingAverage.average(); } - void getCameraNumbers(std::vector& numbers) { - for (std::vector::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it) { - numbers.push_back(it->m_cameraNumber); - } - } + void getCameraNumbers(std::vector& numbers); static int getSampleRateUnits(ATVStd std); @@ -349,7 +345,7 @@ private: { } }; - typedef struct ATVCamera + struct ATVCamera { cv::VideoCapture m_camera; //!< camera object cv::Mat m_videoframeOriginal; //!< camera non resized image @@ -364,7 +360,7 @@ private: ATVCamera() : m_cameraNumber(-1), - m_videoFPS(25), + m_videoFPS(25.0f), m_videoWidth(1), m_videoHeight(1), m_videoFx(1.0f), diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index 3a5c2653e..79d51e630 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -164,7 +164,10 @@ bool ATVModGUI::handleMessage(const Message& message) } else if (ATVMod::MsgReportCameraData::match(message)) { - // TODO + ATVMod::MsgReportCameraData& rpt = (ATVMod::MsgReportCameraData&) message; + ui->cameraDeviceNumber->setText(tr("#%1").arg(rpt.getdeviceNumber())); + ui->camerFPS->setText(tr("%1 FPS").arg(rpt.getFPS(), 0, 'f', 2)); + ui->cameraImageSize->setText(tr("%1x%2").arg(rpt.getWidth()).arg(rpt.getHeight())); return true; } else @@ -270,7 +273,7 @@ void ATVModGUI::on_playLoop_toggled(bool checked) applySettings(); } -void ATVModGUI::on_play_toggled(bool checked) +void ATVModGUI::on_playVideo_toggled(bool checked) { ui->navTimeSlider->setEnabled(!checked); m_enableNavTime = !checked; @@ -406,7 +409,7 @@ void ATVModGUI::applySettings() ui->uniformLevel->value() / 100.0f, (ATVMod::ATVModulation) ui->modulation->currentIndex(), ui->playLoop->isChecked(), - ui->play->isChecked(), + ui->playVideo->isChecked(), ui->channelMute->isChecked()); } } diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index ad8e595bd..0ded39277 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -68,7 +68,7 @@ private slots: void on_imageFileDialog_clicked(bool checked); void on_videoFileDialog_clicked(bool checked); - void on_play_toggled(bool checked); + void on_playVideo_toggled(bool checked); void on_playLoop_toggled(bool checked); void on_navTimeSlider_valueChanged(int value); diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index 335b8ce54..3bbb4b72e 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -6,7 +6,7 @@ 0 0 - 342 + 386 364 @@ -39,13 +39,13 @@ 10 10 - 320 + 360 341 - 280 + 360 0 @@ -536,7 +536,7 @@ - + Record file play/pause @@ -656,13 +656,100 @@ + + + 24 + 24 + + - Cam + + + + :/camera.png - + + + + 24 + 24 + + + + + + + + :/play.png + :/pause.png + :/play.png + :/play.png:/play.png + + + + + + + + 50 + 16777215 + + + + Select camera + + + + + + + + 24 + 0 + + + + camera device number + + + -- + + + + + + + + 66 + 0 + + + + camera FPS + + + -- + + + + + + + + 70 + 0 + + + + camera image size + + + -- + + diff --git a/sdrbase/resources/camera.png b/sdrbase/resources/camera.png new file mode 100644 index 0000000000000000000000000000000000000000..7b2c75d541fe4fdfcc43a62416454332a52fc175 GIT binary patch literal 823 zcmV-71IYY|P)nu~ zK~zY`t(8xRm1Pvhf9K9W|1bvQ5K4kgLC6ehrMS=_7ecdWQ4k?5B2t)Hq@*ixVT8*< z3~A9q5pAcqbD>rU%`_2}FcC8~GX*ith$IM!qce`b7M(A?zV2MS)q%^s_nh}U&w0=L zocD!?H1%J_qF4|S4HJvFS_4`#cQGOs8(~DfK-pLPRs(nx*amC@YQXovm%wa9SPv^o zpfz9(uoh?sZU8e8F_-bJz`MX^;AWZ(Q%fCCsN2;k^^*FA`ilBd`rcNLs-xNo0| zivPXz|CEGXMH|WjP>-qKsx4Lg8qfhe3tWzf>m}991D^q%Ko9UcaKEgoBnseG;X^>hJ)YIkYP z3g7_n3~=%vGZ69T8~{%O=W|D&0CT_=;5p!H;0xd-U>z_FTmu$?-jwYr;QfeLP*(!G zfEy7pQV_fVe4I%$z=Ld04Y&i$XDgOxOYdZn8*=^g5izUw0f&K|zz}dS)Mda0pbglU zV39z78^(&yY|V$jp)BeE@LeAIHefI6BRMGV(4^(SO{mlAHFb~Lr4FcHsT*5M6)n)b zE#_wu7zBQ-C)59QRcEV4B4Ruu9#n&^O|+v{Iu9#g%a+P}Sb}!owbC_xEAO7UB;Bo! z0%x;jbqQJ;5Oe@f1Kace?bLoj@B=UaJPv%2iu#M-KJXjRms1)QX_5&?v-&7ixfxgm z90NWFjsuSY*9(%!-o6PO0mkw%i3SH+eyn=)65JgT)9U&xWLHl6Tg98)2E3YqjtWpC zn+8rt#8^oT-N5U>ufRF}539Zp&1k%-8L48a`~ld0xZy|J6rKP8002ovPDHLkV1f^3 BV)_68 literal 0 HcmV?d00001 diff --git a/sdrbase/resources/res.qrc b/sdrbase/resources/res.qrc index 1d0437d80..98db68f8f 100644 --- a/sdrbase/resources/res.qrc +++ b/sdrbase/resources/res.qrc @@ -74,5 +74,6 @@ film_reel.png film.png picture.png + camera.png