From 096e1247e60ad877167dc0a148d2fb86ef7b4262 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 24 Mar 2017 19:06:29 +0100 Subject: [PATCH] ATV Modulator: camera manual FPS setting: modulator and UI communication --- plugins/channeltx/modatv/atvmod.cpp | 16 ++++++++++++++ plugins/channeltx/modatv/atvmod.h | 30 ++++++++++++++++++++++++++ plugins/channeltx/modatv/atvmodgui.cpp | 22 +++++++++++++++++++ plugins/channeltx/modatv/atvmodgui.h | 2 ++ plugins/channeltx/modatv/atvmodgui.ui | 6 +++--- 5 files changed, 73 insertions(+), 3 deletions(-) diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 8958575b8..36508729b 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -30,6 +30,7 @@ MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureVideoFileSourceStreamTiming, Messag MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportVideoFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportVideoFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureCameraIndex, Message) +MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureCameraData, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportCameraData, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureOverlayText, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureShowOverlayText, Message) @@ -631,6 +632,21 @@ bool ATVMod::handleMessage(const Message& cmd) return true; } + else if (MsgConfigureCameraData::match(cmd)) + { + MsgConfigureCameraData& cfg = (MsgConfigureCameraData&) cmd; + int index = cfg.getIndex(); + float mnaualFPS = cfg.getManualFPS(); + bool manualFPSEnable = cfg.getManualFPSEnable(); + + if (index < m_cameras.size()) + { + m_cameras[index].m_videoFPSManual = mnaualFPS; + m_cameras[index].m_videoFPSManualEnable = manualFPSEnable; + } + + return true; + } else if (MsgConfigureOverlayText::match(cmd)) { MsgConfigureOverlayText& cfg = (MsgConfigureOverlayText&) cmd; diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index 9d9fc9943..0be09c77b 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -216,6 +216,36 @@ public: { } }; + class MsgConfigureCameraData : public Message + { + MESSAGE_CLASS_DECLARATION + + public: + int getIndex() const { return m_index; } + float getManualFPS() const { return m_manualFPS; } + bool getManualFPSEnable() const { return m_manualFPSEnable; } + + static MsgConfigureCameraData* create( + int index, + float manualFPS, + bool manualFPSEnable) + { + return new MsgConfigureCameraData(index, manualFPS, manualFPSEnable); + } + + private: + int m_index; + float m_manualFPS; + bool m_manualFPSEnable; + + MsgConfigureCameraData(int index, float manualFPS, bool manualFPSEnable) : + Message(), + m_index(index), + m_manualFPS(manualFPS), + m_manualFPSEnable(manualFPSEnable) + { } + }; + class MsgReportCameraData : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index e098d905d..631441ce4 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -192,6 +192,9 @@ bool ATVModGUI::handleMessage(const Message& 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())); + ui->cameraManualFPSText->setText(tr("%1 FPS").arg(rpt.getFPSManual(), 0, 'f', 1)); + ui->cameraManualFPSEnable->setChecked(rpt.getFPSManualEnable()); + ui->cameraManualFPS->setValue((int) rpt.getFPSManual()*10.0f); int status = rpt.getStatus(); @@ -499,6 +502,25 @@ void ATVModGUI::on_camSelect_currentIndexChanged(int index) m_atvMod->getInputMessageQueue()->push(message); } +void ATVModGUI::on_cameraManualFPSEnable_toggled(bool checked) +{ + ATVMod::MsgConfigureCameraData* message = ATVMod::MsgConfigureCameraData::create( + ui->camSelect->currentIndex(), + checked, + ui->cameraManualFPS->value() / 10.0f); + m_atvMod->getInputMessageQueue()->push(message); +} + +void ATVModGUI::on_cameraManualFPS_valueChanged(int value) +{ + ui->cameraManualFPSText->setText(tr("%1 FPS").arg(value / 10.0f, 0, 'f', 1)); + ATVMod::MsgConfigureCameraData* message = ATVMod::MsgConfigureCameraData::create( + ui->camSelect->currentIndex(), + ui->cameraManualFPSEnable->isChecked(), + value / 10.0f); + m_atvMod->getInputMessageQueue()->push(message); +} + void ATVModGUI::on_overlayTextShow_toggled(bool checked) { ATVMod::MsgConfigureShowOverlayText* message = ATVMod::MsgConfigureShowOverlayText::create(checked); diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 5549c908b..cda021fe0 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -84,6 +84,8 @@ private slots: void on_playCamera_toggled(bool checked); void on_camSelect_currentIndexChanged(int index); + void on_cameraManualFPSEnable_toggled(bool checked); + void on_cameraManualFPS_valueChanged(int value); void on_overlayTextShow_toggled(bool checked); void on_overlayText_textEdited(const QString& arg1); diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index 211b1c92e..c76615c91 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -1134,7 +1134,7 @@ - + Use manual FPS setting @@ -1144,7 +1144,7 @@ - + 24 @@ -1169,7 +1169,7 @@ - + 50