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 000000000..7b2c75d54 Binary files /dev/null and b/sdrbase/resources/camera.png differ 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