diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 031f29f7b..be671d8cc 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -76,9 +76,18 @@ void ATVMod::configure(MessageQueue* messageQueue, ATVModInput atvModInput, Real uniformLevel, ATVModulation atvModulation, + bool videoPlayLoop, + bool videoPlay, bool channelMute) { - Message* cmd = MsgConfigureATVMod::create(rfBandwidth, atvStd, atvModInput, uniformLevel, atvModulation); + Message* cmd = MsgConfigureATVMod::create( + rfBandwidth, + atvStd, + atvModInput, + uniformLevel, + atvModulation, + videoPlayLoop, + videoPlay); messageQueue->push(cmd); } @@ -185,7 +194,7 @@ void ATVMod::pullVideo(Real& sample) m_lineCount = 0; m_evenImage = !m_evenImage; - if ((m_running.m_atvModInput == ATVModInputVideo) && m_videoOK) + if ((m_running.m_atvModInput == ATVModInputVideo) && m_videoOK && (m_running.m_videoPlay)) { int grabOK; int fpsIncrement = (int) m_videoFPSCount - m_videoPrevFPSCount; @@ -212,7 +221,10 @@ void ATVMod::pullVideo(Real& sample) } else { - // TODO: handle play loop + if (m_running.m_videoPlayLoop) // play loop + { + seekVideoFileStream(0); + } } if (m_videoFPSCount < m_videoFPS) @@ -287,6 +299,8 @@ bool ATVMod::handleMessage(const Message& cmd) m_config.m_atvStd = cfg.getATVStd(); m_config.m_uniformLevel = cfg.getUniformLevel(); m_config.m_atvModulation = cfg.getModulation(); + m_config.m_videoPlayLoop = cfg.getVideoPlayLoop(); + m_config.m_videoPlay = cfg.getVideoPlay(); apply(); @@ -295,7 +309,9 @@ bool ATVMod::handleMessage(const Message& cmd) << " m_atvStd: " << (int) m_config.m_atvStd << " m_atvModInput: " << (int) m_config.m_atvModInput << " m_uniformLevel: " << m_config.m_uniformLevel - << " m_atvModulation: " << (int) m_config.m_atvModulation; + << " m_atvModulation: " << (int) m_config.m_atvModulation + << " m_videoPlayLoop: " << m_config.m_videoPlayLoop + << " m_videoPlay: " << m_config.m_videoPlay; return true; } @@ -382,6 +398,8 @@ void ATVMod::apply(bool force) m_running.m_atvStd = m_config.m_atvStd; m_running.m_uniformLevel = m_config.m_uniformLevel; m_running.m_atvModulation = m_config.m_atvModulation; + m_running.m_videoPlayLoop = m_config.m_videoPlayLoop; + m_running.m_videoPlay = m_config.m_videoPlay; } int ATVMod::getSampleRateUnits(ATVStd std) diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index acbe6396f..2d3f1c3ba 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -194,6 +194,8 @@ public: ATVModInput atvModInput, Real uniformLevel, ATVModulation atvModulation, + bool videoPlayLoop, + bool videoPlay, bool channelMute); virtual void pull(Sample& sample); @@ -226,15 +228,26 @@ private: ATVModInput getATVModInput() const { return m_atvModInput; } Real getUniformLevel() const { return m_uniformLevel; } ATVModulation getModulation() const { return m_atvModulation; } + bool getVideoPlayLoop() const { return m_videoPlayLoop; } + bool getVideoPlay() const { return m_videoPlay; } static MsgConfigureATVMod* create( Real rfBandwidth, ATVStd atvStd, ATVModInput atvModInput, Real uniformLevel, - ATVModulation atvModulation) + ATVModulation atvModulation, + bool videoPlayLoop, + bool videoPlay) { - return new MsgConfigureATVMod(rfBandwidth, atvStd, atvModInput, uniformLevel, atvModulation); + return new MsgConfigureATVMod( + rfBandwidth, + atvStd, + atvModInput, + uniformLevel, + atvModulation, + videoPlayLoop, + videoPlay); } private: @@ -243,19 +256,25 @@ private: ATVModInput m_atvModInput; Real m_uniformLevel; ATVModulation m_atvModulation; + bool m_videoPlayLoop; + bool m_videoPlay; MsgConfigureATVMod( Real rfBandwidth, ATVStd atvStd, ATVModInput atvModInput, Real uniformLevel, - ATVModulation atvModulation) : + ATVModulation atvModulation, + bool videoPlayLoop, + bool videoPlay) : Message(), m_rfBandwidth(rfBandwidth), m_atvStd(atvStd), m_atvModInput(atvModInput), m_uniformLevel(uniformLevel), - m_atvModulation(atvModulation) + m_atvModulation(atvModulation), + m_videoPlayLoop(videoPlayLoop), + m_videoPlay(videoPlay) { } }; @@ -268,6 +287,8 @@ private: ATVModInput m_atvModInput; //!< Input source type Real m_uniformLevel; //!< Percentage between black and white for uniform screen display ATVModulation m_atvModulation; //!< RF modulation type + bool m_videoPlayLoop; //!< Play video in a loop + bool m_videoPlay; //!< True to play video and false to pause Config() : m_outputSampleRate(-1), @@ -276,7 +297,9 @@ private: m_atvStd(ATVStdPAL625), m_atvModInput(ATVModInputHBars), m_uniformLevel(0.5f), - m_atvModulation(ATVModulationAM) + m_atvModulation(ATVModulationAM), + m_videoPlayLoop(false), + m_videoPlay(false) { } }; diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index d9985d732..51078ca55 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -270,6 +270,29 @@ void ATVModGUI::on_videoFileDialog_clicked(bool checked) } } +void ATVModGUI::on_playLoop_toggled(bool checked) +{ + applySettings(); +} + +void ATVModGUI::on_play_toggled(bool checked) +{ + ui->navTimeSlider->setEnabled(!checked); + m_enableNavTime = !checked; + applySettings(); +} + +void ATVModGUI::on_navTimeSlider_valueChanged(int value) +{ + if (m_enableNavTime && ((value >= 0) && (value <= 100))) + { + int seekFame = (m_videoLength * value) / 100; + ATVMod::MsgConfigureVideoFileSourceSeek* message = ATVMod::MsgConfigureVideoFileSourceSeek::create(value); + m_atvMod->getInputMessageQueue()->push(message); + } +} + + void ATVModGUI::configureImageFileName() { qDebug() << "ATVModGUI::configureImageFileName: " << m_imageFileName.toStdString().c_str(); @@ -380,6 +403,8 @@ void ATVModGUI::applySettings() (ATVMod::ATVModInput) ui->inputSelect->currentIndex(), ui->uniformLevel->value() / 100.0f, (ATVMod::ATVModulation) ui->modulation->currentIndex(), + ui->playLoop->isChecked(), + ui->play->isChecked(), ui->channelMute->isChecked()); } } diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 2e79a9575..5fdce53dd 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -69,6 +69,10 @@ private slots: void on_imageFileDialog_clicked(bool checked); void on_videoFileDialog_clicked(bool checked); + void on_play_toggled(bool checked); + void on_playLoop_toggled(bool checked); + void on_navTimeSlider_valueChanged(int value); + void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index c5eb1ffa0..1835c0d41 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -169,7 +169,7 @@ - Mute/Unmute channel + Mute/Unmute channel (not implemented) ... @@ -223,7 +223,7 @@ - Demodulator (RF) bandwidth + Modulator (RF) bandwidth when interpolation takes place 1 @@ -285,7 +285,7 @@ - Audio input gain + Video input gain (not implemented) 20 @@ -346,6 +346,9 @@ + + TV standard + PAL625L @@ -355,6 +358,9 @@ + + Video pattern or input source + Uniform