SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Slots | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ATVMod Class Reference

#include <atvmod.h>

+ Inheritance diagram for ATVMod:
+ Collaboration diagram for ATVMod:

Classes

struct  ATVCamera
 
class  MsgConfigureATVMod
 
class  MsgConfigureCameraData
 
class  MsgConfigureCameraIndex
 
class  MsgConfigureChannelizer
 
class  MsgConfigureImageFileName
 
class  MsgConfigureVideoFileName
 
class  MsgConfigureVideoFileSourceSeek
 
class  MsgConfigureVideoFileSourceStreamTiming
 
class  MsgReportCameraData
 
class  MsgReportEffectiveSampleRate
 
class  MsgReportVideoFileSourceStreamData
 
class  MsgReportVideoFileSourceStreamTiming
 

Signals

void levelChanged (qreal rmsLevel, qreal peakLevel, int numSamples)
 

Public Member Functions

 ATVMod (DeviceAPI *deviceAPI)
 
 ~ATVMod ()
 
virtual void destroy ()
 
virtual void pull (Sample &sample)
 
virtual void pullAudio (int nbSamples)
 
virtual void start ()
 
virtual void stop ()
 
virtual bool handleMessage (const Message &cmd)
 Processing of a message. Returns true if message has actually been processed. More...
 
virtual void getIdentifier (QString &id)
 
virtual void getTitle (QString &title)
 
virtual qint64 getCenterFrequency () const
 Applies to a default stream. More...
 
virtual QByteArray serialize () const
 
virtual bool deserialize (const QByteArray &data)
 
virtual int getNbSinkStreams () const
 
virtual int getNbSourceStreams () const
 
virtual qint64 getStreamCenterFrequency (int streamIndex, bool sinkElseSource) const
 
virtual int webapiSettingsGet (SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
 
virtual int webapiSettingsPutPatch (bool force, const QStringList &channelSettingsKeys, SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
 
virtual int webapiReportGet (SWGSDRangel::SWGChannelReport &response, QString &errorMessage)
 
int getEffectiveSampleRate () const
 
double getMagSq () const
 
void getCameraNumbers (std::vector< int > &numbers)
 
- Public Member Functions inherited from BasebandSampleSource
 BasebandSampleSource ()
 
virtual ~BasebandSampleSource ()
 
void feed (SampleSourceFifo *sampleFifo, int nbSamples)
 
SampleSourceFifogetSampleSourceFifo ()
 
MessageQueuegetInputMessageQueue ()
 Get the queue for asynchronous inbound communication. More...
 
virtual void setMessageQueueToGUI (MessageQueue *queue)
 
MessageQueuegetMessageQueueToGUI ()
 
void setDeviceSampleSourceFifo (SampleSourceFifo *deviceSampleFifo)
 
- Public Member Functions inherited from ChannelAPI
 ChannelAPI (const QString &name, StreamType streamType)
 
virtual ~ChannelAPI ()
 
virtual void setName (const QString &name)
 
virtual const QString & getName () const
 
int getIndexInDeviceSet () const
 
void setIndexInDeviceSet (int indexInDeviceSet)
 
int getDeviceSetIndex () const
 
void setDeviceSetIndex (int deviceSetIndex)
 
DeviceAPIgetDeviceAPI ()
 
void setDeviceAPI (DeviceAPI *deviceAPI)
 
uint64_t getUID () const
 
StreamType getStreamType () const
 

Static Public Member Functions

static void getBaseValues (int outputSampleRate, int linesPerSecond, int &sampleRateUnits, uint32_t &nbPointsPerRateUnit)
 
static float getRFBandwidthDivisor (ATVModSettings::ATVModulation modulation)
 

Static Public Attributes

static const QString m_channelIdURI = "sdrangel.channeltx.modatv"
 
static const QString m_channelId = "ATVMod"
 

Private Slots

void networkManagerFinished (QNetworkReply *reply)
 

Private Member Functions

void applyChannelSettings (int outputSampleRate, int inputFrequencyOffset, bool force=false)
 
void applySettings (const ATVModSettings &settings, bool force=false)
 
void pullFinalize (Complex &ci, Sample &sample)
 
void pullVideo (Real &sample)
 
void calculateLevel (Real &sample)
 
void modulateSample ()
 
ComplexmodulateSSB (Real &sample)
 
ComplexmodulateVestigialSSB (Real &sample)
 
void applyStandard ()
 
void openImage (const QString &fileName)
 
void openVideo (const QString &fileName)
 
void resizeImage ()
 
void calculateVideoSizes ()
 
void resizeVideo ()
 
void seekVideoFileStream (int seekPercentage)
 
void scanCameras ()
 
void releaseCameras ()
 
void calculateCamerasSizes ()
 
void resizeCameras ()
 
void resizeCamera ()
 
void mixImageAndText (cv::Mat &image)
 
void webapiFormatChannelSettings (SWGSDRangel::SWGChannelSettings &response, const ATVModSettings &settings)
 
void webapiFormatChannelReport (SWGSDRangel::SWGChannelReport &response)
 
void webapiReverseSendSettings (QList< QString > &channelSettingsKeys, const ATVModSettings &settings, bool force)
 
void pullImageLine (Real &sample, bool noHSync=false)
 
void pullVSyncLineLongPulses (Real &sample)
 
void pullVSyncLineEqualizingPulses (Real &sample)
 
void pullVSyncLineEqualizingThenLongPulses (Real &sample)
 
void pullVSyncLineLongThenEqualizingPulses (Real &sample)
 
void pullVSyncLine (Real &sample)
 

Private Attributes

DeviceAPIm_deviceAPI
 
ThreadedBasebandSampleSourcem_threadedChannelizer
 
UpChannelizerm_channelizer
 
int m_outputSampleRate
 
int m_inputFrequencyOffset
 
ATVModSettings m_settings
 
NCO m_carrierNco
 
Complex m_modSample
 
float m_modPhasor
 For FM modulation. More...
 
Interpolator m_interpolator
 
Real m_interpolatorDistance
 
Real m_interpolatorDistanceRemain
 
int m_tvSampleRate
 sample rate for generating signal More...
 
uint32_t m_pointsPerLine
 Number of points per full line. More...
 
int m_pointsPerSync
 number of line points for the horizontal sync More...
 
int m_pointsPerBP
 number of line points for the back porch More...
 
int m_pointsPerImgLine
 number of line points for the image line More...
 
uint32_t m_pointsPerFP
 number of line points for the front porch More...
 
int m_pointsPerFSync
 number of line points for the field first sync More...
 
uint32_t m_pointsPerHBar
 number of line points for a bar of the bar chart More...
 
uint32_t m_linesPerVBar
 number of lines for a bar of the bar chart More...
 
uint32_t m_pointsPerTU
 number of line points per time unit More...
 
int m_nbLines
 number of lines per complete frame More...
 
int m_nbLines2
 same number as above (non interlaced) or half the number above (interlaced) More...
 
uint32_t m_nbImageLines
 number of image lines excluding synchronization lines More...
 
uint32_t m_nbImageLines2
 same number as above (non interlaced) or half the number above (interlaced) More...
 
int m_nbHorizPoints
 number of line points per horizontal line More...
 
int m_nbSyncLinesHeadE
 number of header sync lines on even frame More...
 
int m_nbSyncLinesHeadO
 number of header sync lines on odd frame More...
 
int m_nbSyncLinesBottom
 number of sync lines at bottom More...
 
int m_nbLongSyncLines
 number of whole long sync lines for vertical synchronization More...
 
int m_nbHalfLongSync
 number of half long sync / equalization lines More...
 
int m_nbWholeEqLines
 number of whole equalizing lines More...
 
bool m_singleLongSync
 single or double long sync per long sync line More...
 
int m_nbBlankLines
 number of lines in a frame (full or half) that are blanked (black) at the top of the image More...
 
float m_blankLineLvel
 video level of blank lines More...
 
float m_hBarIncrement
 video level increment at each horizontal bar increment More...
 
float m_vBarIncrement
 video level increment at each vertical bar increment More...
 
bool m_interleaved
 true if image is interlaced (2 half frames per frame) More...
 
bool m_evenImage
 in interlaced mode true if this is an even image More...
 
QMutex m_settingsMutex
 
int m_horizontalCount
 current point index on line More...
 
int m_lineCount
 current line index in frame More...
 
float m_fps
 resulting frames per second More...
 
MovingAverageUtil< double, double, 16 > m_movingAverage
 
quint32 m_levelCalcCount
 
Real m_peakLevel
 
Real m_levelSum
 
cv::Mat m_imageFromFile
 original image not resized not overlaid by text More...
 
cv::Mat m_imageOriginal
 original not resized image More...
 
cv::Mat m_image
 resized image for transmission at given rate More...
 
bool m_imageOK
 
cv::VideoCapture m_video
 current video capture More...
 
cv::Mat m_videoframeOriginal
 current frame from video More...
 
cv::Mat m_videoFrame
 current displayable video frame More...
 
float m_videoFPS
 current video FPS rate More...
 
int m_videoWidth
 current video frame width More...
 
int m_videoHeight
 current video frame height More...
 
float m_videoFx
 current video horizontal scaling factor More...
 
float m_videoFy
 current video vertictal scaling factor More...
 
float m_videoFPSq
 current video FPS sacaling factor More...
 
float m_videoFPSCount
 current video FPS fractional counter More...
 
int m_videoPrevFPSCount
 current video FPS previous integer counter More...
 
int m_videoLength
 current video length in frames More...
 
bool m_videoEOF
 current video has reached end of file More...
 
bool m_videoOK
 
std::vector< ATVCameram_cameras
 vector of available cameras More...
 
int m_cameraIndex
 curent camera index in list of available cameras More...
 
std::string m_overlayText
 
QString m_imageFileName
 
QString m_videoFileName
 
fftfiltm_SSBFilter
 
Complexm_SSBFilterBuffer
 
int m_SSBFilterBufferIndex
 
fftfiltm_DSBFilter
 
Complexm_DSBFilterBuffer
 
int m_DSBFilterBufferIndex
 
QNetworkAccessManager * m_networkManager
 
QNetworkRequest m_networkRequest
 

Static Private Attributes

static const int m_ssbFftLen = 1024
 
static const float m_blackLevel = 0.3f
 
static const float m_spanLevel = 0.7f
 
static const int m_levelNbSamples = 10000
 
static const int m_nbBars = 6
 number of bars in bar or chessboard patterns More...
 
static const int m_cameraFPSTestNbFrames = 100
 number of frames for camera FPS test More...
 

Additional Inherited Members

- Public Types inherited from ChannelAPI
enum  StreamType { StreamSingleSink, StreamSingleSource, StreamMIMO }
 < This is the same enum as in PluginInterface More...
 
- Protected Slots inherited from BasebandSampleSource
void handleInputMessages ()
 
void handleWriteToFifo (int nbSamples)
 
void handleWriteToDeviceFifo (int nbSamples)
 
- Protected Member Functions inherited from BasebandSampleSource
void handleWriteToFifo (SampleSourceFifo *sampleFifo, int nbSamples)
 
- Protected Attributes inherited from BasebandSampleSource
MessageQueue m_inputMessageQueue
 Queue for asynchronous inbound communication. More...
 
MessageQueuem_guiMessageQueue
 Input message queue to the GUI. More...
 
SampleSourceFifo m_sampleFifo
 Internal FIFO for multi-channel processing. More...
 
SampleSourceFifom_deviceSampleFifo
 Reference to the device FIFO for single channel processing. More...
 

Detailed Description

Definition at line 49 of file atvmod.h.

Constructor & Destructor Documentation

◆ ATVMod()

ATVMod::ATVMod ( DeviceAPI deviceAPI)

Definition at line 61 of file atvmod.cpp.

References DeviceAPI::addChannelSource(), DeviceAPI::addChannelSourceAPI(), applyChannelSettings(), applySettings(), m_channelId, m_channelizer, m_deviceAPI, m_DSBFilter, m_DSBFilterBuffer, m_inputFrequencyOffset, m_interpolatorDistance, m_interpolatorDistanceRemain, m_networkManager, m_outputSampleRate, ATVModSettings::m_rfBandwidth, m_settings, m_ssbFftLen, m_SSBFilter, m_SSBFilterBuffer, m_threadedChannelizer, networkManagerFinished(), and scanCameras().

Referenced by ATVMod::MsgReportEffectiveSampleRate::MsgReportEffectiveSampleRate().

61  :
63  m_deviceAPI(deviceAPI),
64  m_outputSampleRate(1000000),
66  m_modPhasor(0.0f),
67  m_tvSampleRate(1000000),
68  m_evenImage(true),
69  m_settingsMutex(QMutex::Recursive),
71  m_lineCount(0),
72  m_imageOK(false),
73  m_videoFPSq(1.0f),
74  m_videoFPSCount(0.0f),
76  m_videoEOF(false),
77  m_videoOK(false),
78  m_cameraIndex(-1),
79  //m_showOverlayText(false),
80  m_SSBFilter(0),
83  m_DSBFilter(0),
86 {
87  setObjectName(m_channelId);
88  scanCameras();
89 
91  m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
92  memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
93 
96  memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
97 
100 
102  applySettings(m_settings, true); // does applyStandard() too;
103 
104  m_channelizer = new UpChannelizer(this);
108 
109  m_networkManager = new QNetworkAccessManager();
110  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
111 }
static const QString m_channelIdURI
Definition: atvmod.h:406
DeviceAPI * m_deviceAPI
Definition: atvmod.h:456
bool m_evenImage
in interlaced mode true if this is an even image
Definition: atvmod.h:497
int m_DSBFilterBufferIndex
Definition: atvmod.h:543
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
int m_videoPrevFPSCount
current video FPS previous integer counter
Definition: atvmod.h:523
fftfilt * m_SSBFilter
Definition: atvmod.h:536
static const QString m_channelId
Definition: atvmod.h:407
Exposes a single source stream (output, Tx)
Definition: channelapi.h:42
static const int m_ssbFftLen
Definition: atvmod.h:548
void addChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Add a channel source (Tx)
Definition: deviceapi.cpp:138
void applySettings(const ATVModSettings &settings, bool force=false)
Definition: atvmod.cpp:1086
float m_modPhasor
For FM modulation.
Definition: atvmod.h:466
QMutex m_settingsMutex
Definition: atvmod.h:498
QNetworkAccessManager * m_networkManager
Definition: atvmod.h:545
UpChannelizer * m_channelizer
Definition: atvmod.h:458
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: atvmod.h:457
Complex * m_SSBFilterBuffer
Definition: atvmod.h:537
ATVModSettings m_settings
Definition: atvmod.h:462
ChannelAPI(const QString &name, StreamType streamType)
Definition: channelapi.cpp:23
int m_SSBFilterBufferIndex
Definition: atvmod.h:538
int m_tvSampleRate
sample rate for generating signal
Definition: atvmod.h:470
Real m_interpolatorDistanceRemain
Definition: atvmod.h:469
void networkManagerFinished(QNetworkReply *reply)
Definition: atvmod.cpp:1597
bool m_imageOK
Definition: atvmod.h:511
Real m_interpolatorDistance
Definition: atvmod.h:468
float m_videoFPSCount
current video FPS fractional counter
Definition: atvmod.h:522
bool m_videoEOF
current video has reached end of file
Definition: atvmod.h:525
bool m_videoOK
Definition: atvmod.h:526
void scanCameras()
Definition: atvmod.cpp:946
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
Real m_rfBandwidth
Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB.
void addChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:174
int m_lineCount
current line index in frame
Definition: atvmod.h:500
std::complex< Real > Complex
Definition: dsptypes.h:43
int m_outputSampleRate
Definition: atvmod.h:460
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: atvmod.cpp:1033
fftfilt * m_DSBFilter
Definition: atvmod.h:541
float m_videoFPSq
current video FPS sacaling factor
Definition: atvmod.h:521
int m_inputFrequencyOffset
Definition: atvmod.h:461
Complex * m_DSBFilterBuffer
Definition: atvmod.h:542
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~ATVMod()

ATVMod::~ATVMod ( )

Definition at line 113 of file atvmod.cpp.

References m_channelizer, m_deviceAPI, m_DSBFilter, m_DSBFilterBuffer, m_networkManager, m_SSBFilter, m_SSBFilterBuffer, m_threadedChannelizer, m_video, networkManagerFinished(), releaseCameras(), DeviceAPI::removeChannelSource(), and DeviceAPI::removeChannelSourceAPI().

Referenced by ATVMod::MsgReportEffectiveSampleRate::MsgReportEffectiveSampleRate().

114 {
115  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
116  delete m_networkManager;
117 
118  if (m_video.isOpened()) {
119  m_video.release();
120  }
121 
122  releaseCameras();
125  delete m_threadedChannelizer;
126  delete m_channelizer;
127  delete m_SSBFilter;
128  delete m_DSBFilter;
129  delete[] m_SSBFilterBuffer;
130  delete[] m_DSBFilterBuffer;
131 }
DeviceAPI * m_deviceAPI
Definition: atvmod.h:456
void removeChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:181
void removeChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Remove a channel source (Tx)
Definition: deviceapi.cpp:147
fftfilt * m_SSBFilter
Definition: atvmod.h:536
QNetworkAccessManager * m_networkManager
Definition: atvmod.h:545
UpChannelizer * m_channelizer
Definition: atvmod.h:458
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: atvmod.h:457
Complex * m_SSBFilterBuffer
Definition: atvmod.h:537
cv::VideoCapture m_video
current video capture
Definition: atvmod.h:513
void networkManagerFinished(QNetworkReply *reply)
Definition: atvmod.cpp:1597
void releaseCameras()
Definition: atvmod.cpp:982
fftfilt * m_DSBFilter
Definition: atvmod.h:541
Complex * m_DSBFilterBuffer
Definition: atvmod.h:542
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ applyChannelSettings()

void ATVMod::applyChannelSettings ( int  outputSampleRate,
int  inputFrequencyOffset,
bool  force = false 
)
private

Definition at line 1033 of file atvmod.cpp.

References applyStandard(), Interpolator::create(), ATVMod::MsgReportEffectiveSampleRate::create(), fftfilt::create_filter(), getBaseValues(), BasebandSampleSource::getMessageQueueToGUI(), getRFBandwidthDivisor(), ATVModSettings::m_atvModulation, m_carrierNco, ATVModSettings::m_fps, m_inputFrequencyOffset, m_interpolator, m_interpolatorDistance, m_interpolatorDistanceRemain, ATVModSettings::m_nbLines, m_outputSampleRate, m_pointsPerLine, ATVModSettings::m_rfBandwidth, m_settings, m_settingsMutex, m_ssbFftLen, m_SSBFilter, m_SSBFilterBuffer, m_SSBFilterBufferIndex, m_tvSampleRate, MessageQueue::push(), and NCO::setFreq().

Referenced by ATVMod(), handleMessage(), and start().

1034 {
1035  qDebug() << "AMMod::applyChannelSettings:"
1036  << " outputSampleRate: " << outputSampleRate
1037  << " inputFrequencyOffset: " << inputFrequencyOffset;
1038 
1039  if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
1040  (outputSampleRate != m_outputSampleRate) || force)
1041  {
1042  m_settingsMutex.lock();
1043  m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
1044  m_settingsMutex.unlock();
1045  }
1046 
1047  if ((outputSampleRate != m_outputSampleRate) || force)
1048  {
1050 
1051  m_settingsMutex.lock();
1052 
1053  if (m_tvSampleRate > 0)
1054  {
1056  m_interpolatorDistance = (Real) m_tvSampleRate / (Real) outputSampleRate;
1060  3.0);
1061  }
1062  else
1063  {
1064  m_tvSampleRate = outputSampleRate;
1065  }
1066 
1068  memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
1070 
1071  applyStandard(); // set all timings
1072  m_settingsMutex.unlock();
1073 
1074  if (getMessageQueueToGUI())
1075  {
1076  MsgReportEffectiveSampleRate *report;
1078  getMessageQueueToGUI()->push(report);
1079  }
1080  }
1081 
1082  m_outputSampleRate = outputSampleRate;
1083  m_inputFrequencyOffset = inputFrequencyOffset;
1084 }
uint32_t m_pointsPerLine
Number of points per full line.
Definition: atvmod.h:471
void push(Message *message, bool emitSignal=true)
Push message onto queue.
ATVModulation m_atvModulation
RF modulation type.
int m_nbLines
Number of lines per full frame.
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
fftfilt * m_SSBFilter
Definition: atvmod.h:536
static const int m_ssbFftLen
Definition: atvmod.h:548
QMutex m_settingsMutex
Definition: atvmod.h:498
void create_filter(float f1, float f2)
Definition: fftfilt.cpp:107
Complex * m_SSBFilterBuffer
Definition: atvmod.h:537
int m_fps
Number of frames per second.
ATVModSettings m_settings
Definition: atvmod.h:462
int m_SSBFilterBufferIndex
Definition: atvmod.h:538
int m_tvSampleRate
sample rate for generating signal
Definition: atvmod.h:470
void setFreq(Real freq, Real sampleRate)
Definition: nco.cpp:49
static float getRFBandwidthDivisor(ATVModSettings::ATVModulation modulation)
Definition: atvmod.cpp:659
Real m_interpolatorDistanceRemain
Definition: atvmod.h:469
Real m_interpolatorDistance
Definition: atvmod.h:468
NCO m_carrierNco
Definition: atvmod.h:464
Interpolator m_interpolator
Definition: atvmod.h:467
void applyStandard()
Definition: atvmod.cpp:676
MessageQueue * getMessageQueueToGUI()
static MsgReportEffectiveSampleRate * create(int sampleRate, uint32_t nbPointsPerLine)
Definition: atvmod.h:340
static void getBaseValues(int outputSampleRate, int linesPerSecond, int &sampleRateUnits, uint32_t &nbPointsPerRateUnit)
Definition: atvmod.cpp:644
Real m_rfBandwidth
Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB.
std::complex< Real > Complex
Definition: dsptypes.h:43
int m_outputSampleRate
Definition: atvmod.h:460
float Real
Definition: dsptypes.h:42
int m_inputFrequencyOffset
Definition: atvmod.h:461
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applySettings()

void ATVMod::applySettings ( const ATVModSettings settings,
bool  force = false 
)
private

Definition at line 1086 of file atvmod.cpp.

References applyStandard(), Interpolator::create(), ATVMod::MsgReportEffectiveSampleRate::create(), fftfilt::create_asym_filter(), fftfilt::create_filter(), getBaseValues(), BasebandSampleSource::getMessageQueueToGUI(), getRFBandwidthDivisor(), ATVModSettings::m_atvModInput, ATVModSettings::m_atvModulation, ATVModSettings::m_atvStd, ATVModSettings::m_cameraPlay, ATVModSettings::m_channelMute, m_DSBFilter, m_DSBFilterBuffer, m_DSBFilterBufferIndex, ATVModSettings::m_fmExcursion, ATVModSettings::m_forceDecimator, ATVModSettings::m_fps, m_imageFromFile, m_imageOriginal, ATVModSettings::m_inputFrequencyOffset, m_interpolator, m_interpolatorDistance, m_interpolatorDistanceRemain, ATVModSettings::m_invertedVideo, ATVModSettings::m_nbLines, m_outputSampleRate, ATVModSettings::m_overlayText, m_pointsPerLine, ATVModSettings::m_reverseAPIAddress, ATVModSettings::m_reverseAPIChannelIndex, ATVModSettings::m_reverseAPIDeviceIndex, ATVModSettings::m_reverseAPIPort, ATVModSettings::m_rfBandwidth, ATVModSettings::m_rfOppBandwidth, ATVModSettings::m_rfScalingFactor, m_settings, m_settingsMutex, ATVModSettings::m_showOverlayText, m_ssbFftLen, m_SSBFilter, m_SSBFilterBuffer, m_SSBFilterBufferIndex, m_tvSampleRate, ATVModSettings::m_uniformLevel, ATVModSettings::m_useReverseAPI, ATVModSettings::m_videoPlay, ATVModSettings::m_videoPlayLoop, mixImageAndText(), MessageQueue::push(), resizeImage(), and webapiReverseSendSettings().

Referenced by ATVMod(), and handleMessage().

1087 {
1088  qDebug() << "ATVMod::applySettings:"
1089  << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
1090  << " m_rfBandwidth: " << settings.m_rfBandwidth
1091  << " m_rfOppBandwidth: " << settings.m_rfOppBandwidth
1092  << " m_atvStd: " << (int) settings.m_atvStd
1093  << " m_nbLines: " << settings.m_nbLines
1094  << " m_fps: " << settings.m_fps
1095  << " m_atvModInput: " << (int) settings.m_atvModInput
1096  << " m_uniformLevel: " << settings.m_uniformLevel
1097  << " m_atvModulation: " << (int) settings.m_atvModulation
1098  << " m_videoPlayLoop: " << settings.m_videoPlayLoop
1099  << " m_videoPlay: " << settings.m_videoPlay
1100  << " m_cameraPlay: " << settings.m_cameraPlay
1101  << " m_channelMute: " << settings.m_channelMute
1102  << " m_invertedVideo: " << settings.m_invertedVideo
1103  << " m_rfScalingFactor: " << settings.m_rfScalingFactor
1104  << " m_fmExcursion: " << settings.m_fmExcursion
1105  << " m_forceDecimator: " << settings.m_forceDecimator
1106  << " m_showOverlayText: " << settings.m_showOverlayText
1107  << " m_overlayText: " << settings.m_overlayText
1108  << " force: " << force;
1109 
1110  QList<QString> reverseAPIKeys;
1111 
1112  if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
1113  reverseAPIKeys.append("inputFrequencyOffset");
1114  }
1115  if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
1116  reverseAPIKeys.append("rfBandwidth");
1117  }
1118  if ((settings.m_rfOppBandwidth != m_settings.m_rfOppBandwidth) || force) {
1119  reverseAPIKeys.append("rfOppBandwidth");
1120  }
1121  if ((settings.m_atvStd != m_settings.m_atvStd) || force) {
1122  reverseAPIKeys.append("atvStd");
1123  }
1124  if ((settings.m_nbLines != m_settings.m_nbLines) || force) {
1125  reverseAPIKeys.append("nbLines");
1126  }
1127  if ((settings.m_fps != m_settings.m_fps) || force) {
1128  reverseAPIKeys.append("fps");
1129  }
1130  if ((settings.m_atvModInput != m_settings.m_atvModInput) || force) {
1131  reverseAPIKeys.append("atvModInput");
1132  }
1133  if ((settings.m_uniformLevel != m_settings.m_uniformLevel) || force) {
1134  reverseAPIKeys.append("uniformLevel");
1135  }
1136  if ((settings.m_uniformLevel != m_settings.m_uniformLevel) || force) {
1137  reverseAPIKeys.append("uniformLevel");
1138  }
1139  if ((settings.m_atvModulation != m_settings.m_atvModulation) || force) {
1140  reverseAPIKeys.append("atvModulation");
1141  }
1142  if ((settings.m_videoPlayLoop != m_settings.m_videoPlayLoop) || force) {
1143  reverseAPIKeys.append("videoPlayLoop");
1144  }
1145  if ((settings.m_videoPlay != m_settings.m_videoPlay) || force) {
1146  reverseAPIKeys.append("videoPlay");
1147  }
1148  if ((settings.m_cameraPlay != m_settings.m_cameraPlay) || force) {
1149  reverseAPIKeys.append("cameraPlay");
1150  }
1151  if ((settings.m_channelMute != m_settings.m_channelMute) || force) {
1152  reverseAPIKeys.append("channelMute");
1153  }
1154  if ((settings.m_invertedVideo != m_settings.m_invertedVideo) || force) {
1155  reverseAPIKeys.append("invertedVideo");
1156  }
1157  if ((settings.m_rfScalingFactor != m_settings.m_rfScalingFactor) || force) {
1158  reverseAPIKeys.append("rfScalingFactor");
1159  }
1160  if ((settings.m_fmExcursion != m_settings.m_fmExcursion) || force) {
1161  reverseAPIKeys.append("fmExcursion");
1162  }
1163  if ((settings.m_forceDecimator != m_settings.m_forceDecimator) || force) {
1164  reverseAPIKeys.append("forceDecimator");
1165  }
1166  if ((settings.m_showOverlayText != m_settings.m_showOverlayText) || force) {
1167  reverseAPIKeys.append("showOverlayText");
1168  }
1169  if ((settings.m_overlayText != m_settings.m_overlayText) || force) {
1170  reverseAPIKeys.append("overlayText");
1171  }
1172 
1173  if ((settings.m_atvStd != m_settings.m_atvStd)
1174  || (settings.m_nbLines != m_settings.m_nbLines)
1175  || (settings.m_fps != m_settings.m_fps)
1176  || (settings.m_rfBandwidth != m_settings.m_rfBandwidth)
1177  || (settings.m_atvModulation != m_settings.m_atvModulation) || force)
1178  {
1180 
1181  m_settingsMutex.lock();
1182 
1183  if (m_tvSampleRate > 0)
1184  {
1190  3.0);
1191  }
1192 
1194  memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
1196 
1197  applyStandard(); // set all timings
1198  m_settingsMutex.unlock();
1199 
1200  if (getMessageQueueToGUI())
1201  {
1202  MsgReportEffectiveSampleRate *report;
1204  getMessageQueueToGUI()->push(report);
1205  }
1206  }
1207 
1208  if ((settings.m_rfOppBandwidth != m_settings.m_rfOppBandwidth)
1209  || (settings.m_rfBandwidth != m_settings.m_rfBandwidth)
1210  || (settings.m_nbLines != m_settings.m_nbLines) // difference in line period may have changed TV sample rate
1211  || (settings.m_fps != m_settings.m_fps) //
1212  || force)
1213  {
1214  m_settingsMutex.lock();
1215 
1217  memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
1219 
1220  m_settingsMutex.unlock();
1221  }
1222 
1223  if ((settings.m_showOverlayText != m_settings.m_showOverlayText) || force)
1224  {
1225  if (!m_imageFromFile.empty())
1226  {
1228 
1229  if (settings.m_showOverlayText) {
1230  qDebug("ATVMod::applySettings: set overlay text");
1232  } else{
1233  qDebug("ATVMod::applySettings: clear overlay text");
1234  }
1235 
1236  resizeImage();
1237  }
1238  }
1239 
1240  if (settings.m_useReverseAPI)
1241  {
1242  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
1247  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
1248  }
1249 
1250  m_settings = settings;
1251 }
uint32_t m_pointsPerLine
Number of points per full line.
Definition: atvmod.h:471
float m_rfScalingFactor
Scaling factor from +/-1 to +/-2^15.
void push(Message *message, bool emitSignal=true)
Push message onto queue.
ATVModulation m_atvModulation
RF modulation type.
uint16_t m_reverseAPIDeviceIndex
int m_DSBFilterBufferIndex
Definition: atvmod.h:543
int m_nbLines
Number of lines per full frame.
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
fftfilt * m_SSBFilter
Definition: atvmod.h:536
static const int m_ssbFftLen
Definition: atvmod.h:548
qint64 m_inputFrequencyOffset
offset from baseband center frequency
QString m_overlayText
QMutex m_settingsMutex
Definition: atvmod.h:498
bool m_channelMute
Mute channel baseband output.
bool m_forceDecimator
Forces decimator even when channel and source sample rates are equal.
void create_filter(float f1, float f2)
Definition: fftfilt.cpp:107
cv::Mat m_imageOriginal
original not resized image
Definition: atvmod.h:509
Complex * m_SSBFilterBuffer
Definition: atvmod.h:537
void resizeImage()
Definition: atvmod.cpp:872
int m_fps
Number of frames per second.
uint16_t m_reverseAPIChannelIndex
ATVModSettings m_settings
Definition: atvmod.h:462
QString m_reverseAPIAddress
int m_SSBFilterBufferIndex
Definition: atvmod.h:538
int m_tvSampleRate
sample rate for generating signal
Definition: atvmod.h:470
static float getRFBandwidthDivisor(ATVModSettings::ATVModulation modulation)
Definition: atvmod.cpp:659
Real m_interpolatorDistanceRemain
Definition: atvmod.h:469
cv::Mat m_imageFromFile
original image not resized not overlaid by text
Definition: atvmod.h:508
float m_fmExcursion
FM excursion factor relative to full bandwidth.
bool m_showOverlayText
Show overlay text on image.
bool m_invertedVideo
True if video signal is inverted before modulation.
Real m_interpolatorDistance
Definition: atvmod.h:468
ATVStd m_atvStd
Standard.
ATVModInput m_atvModInput
Input source type.
bool m_videoPlay
True to play video and false to pause.
Interpolator m_interpolator
Definition: atvmod.h:467
void applyStandard()
Definition: atvmod.cpp:676
bool m_cameraPlay
True to play camera video and false to pause.
MessageQueue * getMessageQueueToGUI()
Real m_uniformLevel
Percentage between black and white for uniform screen display.
static MsgReportEffectiveSampleRate * create(int sampleRate, uint32_t nbPointsPerLine)
Definition: atvmod.h:340
void webapiReverseSendSettings(QList< QString > &channelSettingsKeys, const ATVModSettings &settings, bool force)
Definition: atvmod.cpp:1502
static void getBaseValues(int outputSampleRate, int linesPerSecond, int &sampleRateUnits, uint32_t &nbPointsPerRateUnit)
Definition: atvmod.cpp:644
void create_asym_filter(float fopp, float fin)
two different filters for in band and opposite band
Definition: fftfilt.cpp:174
Real m_rfBandwidth
Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB.
std::complex< Real > Complex
Definition: dsptypes.h:43
uint16_t m_reverseAPIPort
int m_outputSampleRate
Definition: atvmod.h:460
Real m_rfOppBandwidth
Bandwidth of opposite sideband for vestigial SSB.
float Real
Definition: dsptypes.h:42
void mixImageAndText(cv::Mat &image)
Definition: atvmod.cpp:1016
fftfilt * m_DSBFilter
Definition: atvmod.h:541
bool m_videoPlayLoop
Play video in a loop.
Complex * m_DSBFilterBuffer
Definition: atvmod.h:542
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyStandard()

void ATVMod::applyStandard ( )
private

Definition at line 676 of file atvmod.cpp.

References ATVModSettings::ATVStd405, ATVModSettings::ATVStdHSkip, ATVModSettings::ATVStdPAL525, ATVModSettings::ATVStdPAL625, ATVModSettings::ATVStdShort, ATVModSettings::ATVStdShortInterleaved, calculateCamerasSizes(), calculateVideoSizes(), ATVModSettings::m_atvStd, m_blackLevel, m_blankLineLvel, ATVModSettings::m_fps, m_fps, m_hBarIncrement, m_imageOK, m_interleaved, m_linesPerVBar, m_nbBars, m_nbBlankLines, m_nbHalfLongSync, m_nbHorizPoints, m_nbImageLines, m_nbImageLines2, ATVModSettings::m_nbLines, m_nbLines, m_nbLines2, m_nbLongSyncLines, m_nbSyncLinesBottom, m_nbSyncLinesHeadE, m_nbSyncLinesHeadO, m_nbWholeEqLines, m_pointsPerBP, m_pointsPerFP, m_pointsPerFSync, m_pointsPerHBar, m_pointsPerImgLine, m_pointsPerLine, m_pointsPerSync, m_settings, m_singleLongSync, m_spanLevel, m_vBarIncrement, m_videoOK, resizeImage(), and resizeVideo().

Referenced by applyChannelSettings(), and applySettings().

677 {
678  m_pointsPerSync = (uint32_t) ((4.7f / 64.0f) * m_pointsPerLine);
679  m_pointsPerBP = (uint32_t) ((4.7f / 64.0f) * m_pointsPerLine);
680  m_pointsPerFP = (uint32_t) ((2.6f / 64.0f) * m_pointsPerLine);
681  m_pointsPerFSync = (uint32_t) ((2.3f / 64.0f) * m_pointsPerLine);
682 
685 
689 
691  m_nbLines2 = m_nbLines / 2;
692  m_fps = m_settings.m_fps * 1.0f;
693 
694 // qDebug() << "ATVMod::applyStandard: "
695 // << " m_nbLines: " << m_config.m_nbLines
696 // << " m_fps: " << m_config.m_fps
697 // << " rateUnits: " << rateUnits
698 // << " nbPointsPerRateUnit: " << nbPointsPerRateUnit
699 // << " m_tvSampleRate: " << m_tvSampleRate
700 // << " m_pointsPerTU: " << m_pointsPerTU;
701 
702  switch(m_settings.m_atvStd)
703  {
705  m_nbImageLines = m_nbLines; // lines less the total number of sync lines
706  m_nbImageLines2 = m_nbImageLines; // force non interleaved for vbars
707  m_interleaved = false;
708  m_nbSyncLinesHeadE = 0; // number of sync lines on the top of a frame even
709  m_nbSyncLinesHeadO = 0; // number of sync lines on the top of a frame odd
710  m_nbSyncLinesBottom = -1; // force no vsync in even block
711  m_nbLongSyncLines = 0;
712  m_nbHalfLongSync = 0;
713  m_nbWholeEqLines = 0;
714  m_singleLongSync = true;
715  m_nbBlankLines = 0;
716  m_blankLineLvel = 0.7f;
717  m_nbLines2 = m_nbLines - 1;
718  break;
720  m_nbImageLines = m_nbLines - 2; // lines less the total number of sync lines
721  m_nbImageLines2 = m_nbImageLines; // force non interleaved for vbars
722  m_interleaved = false;
723  m_nbSyncLinesHeadE = 1; // number of sync lines on the top of a frame even
724  m_nbSyncLinesHeadO = 1; // number of sync lines on the top of a frame odd
726  m_nbLongSyncLines = 1;
727  m_nbHalfLongSync = 0;
728  m_nbWholeEqLines = 0;
729  m_singleLongSync = true;
730  m_nbBlankLines = 1;
731  m_blankLineLvel = 0.7f;
732  m_nbLines2 = m_nbLines; // force non interleaved => treated as even for all lines
733  break;
735  m_nbImageLines = m_nbLines - 2; // lines less the total number of sync lines
737  m_interleaved = true;
738  m_nbSyncLinesHeadE = 1; // number of sync lines on the top of a frame even
739  m_nbSyncLinesHeadO = 1; // number of sync lines on the top of a frame odd
741  m_nbLongSyncLines = 1;
742  m_nbHalfLongSync = 0;
743  m_nbWholeEqLines = 0;
744  m_singleLongSync = true;
745  m_nbBlankLines = 1;
746  m_blankLineLvel = 0.7f;
747  break;
748  case ATVModSettings::ATVStd405: // Follows loosely the 405 lines standard
749  m_nbImageLines = m_nbLines - 15; // lines less the total number of sync lines
751  m_interleaved = true;
752  m_nbSyncLinesHeadE = 5; // number of sync lines on the top of a frame even
753  m_nbSyncLinesHeadO = 4; // number of sync lines on the top of a frame odd
755  m_nbLongSyncLines = 2;
756  m_nbHalfLongSync = 1;
757  m_nbWholeEqLines = 2;
758  m_singleLongSync = false;
759  m_nbBlankLines = 7; // yields 376 lines (195 - 7) * 2
761  break;
762  case ATVModSettings::ATVStdPAL525: // Follows PAL-M standard
763  m_nbImageLines = m_nbLines - 15;
765  m_interleaved = true;
766  m_nbSyncLinesHeadE = 5;
767  m_nbSyncLinesHeadO = 4; // number of sync lines on the top of a frame odd
769  m_nbLongSyncLines = 2;
770  m_nbHalfLongSync = 1;
771  m_nbWholeEqLines = 2;
772  m_singleLongSync = false;
773  m_nbBlankLines = 15; // yields 480 lines (255 - 15) * 2
775  break;
776  case ATVModSettings::ATVStdPAL625: // Follows PAL-B/G/H standard
777  default:
778  m_nbImageLines = m_nbLines - 15;
780  m_interleaved = true;
781  m_nbSyncLinesHeadE = 5;
782  m_nbSyncLinesHeadO = 4; // number of sync lines on the top of a frame odd
784  m_nbLongSyncLines = 2;
785  m_nbHalfLongSync = 1;
786  m_nbWholeEqLines = 2;
787  m_singleLongSync = false;
788  m_nbBlankLines = 17; // yields 576 lines (305 - 17) * 2
790  }
791 
793 
794  if (m_imageOK)
795  {
796  resizeImage();
797  }
798 
799  if (m_videoOK)
800  {
802  resizeVideo();
803  }
804 
806 }
uint32_t m_pointsPerFP
number of line points for the front porch
Definition: atvmod.h:475
uint32_t m_pointsPerLine
Number of points per full line.
Definition: atvmod.h:471
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_nbLines
number of lines per complete frame
Definition: atvmod.h:480
int m_nbLines
Number of lines per full frame.
uint32_t m_linesPerVBar
number of lines for a bar of the bar chart
Definition: atvmod.h:478
int m_nbWholeEqLines
number of whole equalizing lines
Definition: atvmod.h:490
float m_hBarIncrement
video level increment at each horizontal bar increment
Definition: atvmod.h:494
void resizeVideo()
Definition: atvmod.cpp:891
int m_pointsPerFSync
number of line points for the field first sync
Definition: atvmod.h:476
int m_nbSyncLinesHeadO
number of header sync lines on odd frame
Definition: atvmod.h:486
int m_nbSyncLinesBottom
number of sync lines at bottom
Definition: atvmod.h:487
int m_nbHorizPoints
number of line points per horizontal line
Definition: atvmod.h:484
unsigned int uint32_t
Definition: rtptypes_win.h:46
static const int m_nbBars
number of bars in bar or chessboard patterns
Definition: atvmod.h:552
void calculateCamerasSizes()
Definition: atvmod.cpp:898
uint32_t m_nbImageLines2
same number as above (non interlaced) or half the number above (interlaced)
Definition: atvmod.h:483
float m_vBarIncrement
video level increment at each vertical bar increment
Definition: atvmod.h:495
void resizeImage()
Definition: atvmod.cpp:872
int m_fps
Number of frames per second.
ATVModSettings m_settings
Definition: atvmod.h:462
uint32_t m_pointsPerHBar
number of line points for a bar of the bar chart
Definition: atvmod.h:477
int m_nbHalfLongSync
number of half long sync / equalization lines
Definition: atvmod.h:489
bool m_imageOK
Definition: atvmod.h:511
ATVStd m_atvStd
Standard.
int m_pointsPerImgLine
number of line points for the image line
Definition: atvmod.h:474
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
Definition: atvmod.h:492
bool m_videoOK
Definition: atvmod.h:526
uint32_t m_nbImageLines
number of image lines excluding synchronization lines
Definition: atvmod.h:482
bool m_interleaved
true if image is interlaced (2 half frames per frame)
Definition: atvmod.h:496
void calculateVideoSizes()
Definition: atvmod.cpp:880
float m_blankLineLvel
video level of blank lines
Definition: atvmod.h:493
float m_fps
resulting frames per second
Definition: atvmod.h:501
static const float m_spanLevel
Definition: atvmod.h:550
bool m_singleLongSync
single or double long sync per long sync line
Definition: atvmod.h:491
int m_pointsPerBP
number of line points for the back porch
Definition: atvmod.h:473
int m_nbSyncLinesHeadE
number of header sync lines on even frame
Definition: atvmod.h:485
static const float m_blackLevel
Definition: atvmod.h:549
int m_nbLines2
same number as above (non interlaced) or half the number above (interlaced)
Definition: atvmod.h:481
int m_nbLongSyncLines
number of whole long sync lines for vertical synchronization
Definition: atvmod.h:488
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateCamerasSizes()

void ATVMod::calculateCamerasSizes ( )
private

Definition at line 898 of file atvmod.cpp.

References m_cameras, m_fps, m_nbBlankLines, m_nbImageLines, and m_pointsPerImgLine.

Referenced by applyStandard(), and scanCameras().

899 {
900  for (std::vector<ATVCamera>::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it)
901  {
902  it->m_videoFy = (m_nbImageLines - 2*m_nbBlankLines) / (float) it->m_videoHeight;
903  it->m_videoFx = m_pointsPerImgLine / (float) it->m_videoWidth;
904  it->m_videoFPSq = it->m_videoFPS / m_fps;
905  it->m_videoFPSqManual = it->m_videoFPSManual / m_fps;
906  it->m_videoFPSCount = 0; //it->m_videoFPSq;
907  it->m_videoPrevFPSCount = 0;
908 
909  qDebug("ATVMod::calculateCamerasSizes: [%d] factors: %f x %f FPSq: %f", (int) (it - m_cameras.begin()), it->m_videoFx, it->m_videoFy, it->m_videoFPSq);
910  }
911 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
int m_pointsPerImgLine
number of line points for the image line
Definition: atvmod.h:474
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
Definition: atvmod.h:492
uint32_t m_nbImageLines
number of image lines excluding synchronization lines
Definition: atvmod.h:482
float m_fps
resulting frames per second
Definition: atvmod.h:501
+ Here is the caller graph for this function:

◆ calculateLevel()

void ATVMod::calculateLevel ( Real sample)
private

Definition at line 490 of file atvmod.cpp.

References levelChanged(), m_levelCalcCount, m_levelNbSamples, m_levelSum, m_peakLevel, leansdr::max(), and sqrt().

Referenced by modulateSample().

491 {
493  {
494  m_peakLevel = std::max(std::fabs(m_peakLevel), sample);
495  m_levelSum += sample * sample;
497  }
498  else
499  {
500  qreal rmsLevel = std::sqrt(m_levelSum / m_levelNbSamples);
501  //qDebug("NFMMod::calculateLevel: %f %f", rmsLevel, m_peakLevel);
502  emit levelChanged(rmsLevel, m_peakLevel, m_levelNbSamples);
503  m_peakLevel = 0.0f;
504  m_levelSum = 0.0f;
505  m_levelCalcCount = 0;
506  }
507 }
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples)
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2283
Real m_peakLevel
Definition: atvmod.h:505
static const int m_levelNbSamples
Definition: atvmod.h:551
Real m_levelSum
Definition: atvmod.h:506
quint32 m_levelCalcCount
Definition: atvmod.h:504
T max(const T &x, const T &y)
Definition: framework.h:446
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateVideoSizes()

void ATVMod::calculateVideoSizes ( )
private

Definition at line 880 of file atvmod.cpp.

References m_fps, m_nbBlankLines, m_nbImageLines, m_pointsPerImgLine, m_videoFPS, m_videoFPSCount, m_videoFPSq, m_videoFx, m_videoFy, m_videoHeight, m_videoPrevFPSCount, and m_videoWidth.

Referenced by applyStandard(), and openVideo().

881 {
887 
888  qDebug("ATVMod::calculateVideoSizes: factors: %f x %f FPSq: %f", m_videoFx, m_videoFy, m_videoFPSq);
889 }
float m_videoFPS
current video FPS rate
Definition: atvmod.h:516
float m_videoFy
current video vertictal scaling factor
Definition: atvmod.h:520
int m_videoPrevFPSCount
current video FPS previous integer counter
Definition: atvmod.h:523
float m_videoFx
current video horizontal scaling factor
Definition: atvmod.h:519
int m_videoHeight
current video frame height
Definition: atvmod.h:518
int m_pointsPerImgLine
number of line points for the image line
Definition: atvmod.h:474
float m_videoFPSCount
current video FPS fractional counter
Definition: atvmod.h:522
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
Definition: atvmod.h:492
int m_videoWidth
current video frame width
Definition: atvmod.h:517
uint32_t m_nbImageLines
number of image lines excluding synchronization lines
Definition: atvmod.h:482
float m_fps
resulting frames per second
Definition: atvmod.h:501
float m_videoFPSq
current video FPS sacaling factor
Definition: atvmod.h:521
+ Here is the caller graph for this function:

◆ deserialize()

bool ATVMod::deserialize ( const QByteArray &  data)
virtual

Implements ChannelAPI.

Definition at line 1258 of file atvmod.cpp.

References ATVMod::MsgConfigureATVMod::create(), ATVModSettings::deserialize(), BasebandSampleSource::m_inputMessageQueue, m_settings, MessageQueue::push(), and ATVModSettings::resetToDefaults().

Referenced by getCenterFrequency().

1259 {
1260  if (m_settings.deserialize(data))
1261  {
1262  MsgConfigureATVMod *msg = MsgConfigureATVMod::create(m_settings, true);
1264  return true;
1265  }
1266  else
1267  {
1269  MsgConfigureATVMod *msg = MsgConfigureATVMod::create(m_settings, true);
1271  return false;
1272  }
1273 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
ATVModSettings m_settings
Definition: atvmod.h:462
static MsgConfigureATVMod * create(const ATVModSettings &settings, bool force)
Definition: atvmod.h:60
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
bool deserialize(const QByteArray &data)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

virtual void ATVMod::destroy ( )
inlinevirtual

Implements ChannelAPI.

Definition at line 360 of file atvmod.h.

References handleMessage(), pull(), pullAudio(), start(), and stop().

360 { delete this; }
+ Here is the call graph for this function:

◆ getBaseValues()

void ATVMod::getBaseValues ( int  outputSampleRate,
int  linesPerSecond,
int &  sampleRateUnits,
uint32_t nbPointsPerRateUnit 
)
static

Definition at line 644 of file atvmod.cpp.

References i.

Referenced by applyChannelSettings(), applySettings(), and getMagSq().

645 {
646  int maxPoints = outputSampleRate / linesPerSecond;
647  int i = maxPoints;
648 
649  for (; i > 0; i--)
650  {
651  if ((i * linesPerSecond) % 10 == 0)
652  break;
653  }
654 
655  nbPointsPerRateUnit = i == 0 ? maxPoints : i;
656  sampleRateUnits = nbPointsPerRateUnit * linesPerSecond;
657 }
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ getCameraNumbers()

void ATVMod::getCameraNumbers ( std::vector< int > &  numbers)

Definition at line 990 of file atvmod.cpp.

References ATVMod::MsgReportCameraData::create(), BasebandSampleSource::getMessageQueueToGUI(), m_cameraIndex, m_cameras, m_videoFPS, m_videoHeight, m_videoWidth, and MessageQueue::push().

Referenced by ATVModGUI::ATVModGUI(), and getMagSq().

991 {
992  for (std::vector<ATVCamera>::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it) {
993  numbers.push_back(it->m_cameraNumber);
994  }
995 
996  if (m_cameras.size() > 0)
997  {
998  m_cameraIndex = 0;
999 
1000  if (getMessageQueueToGUI())
1001  {
1002  MsgReportCameraData *report;
1003  report = MsgReportCameraData::create(
1004  m_cameras[0].m_cameraNumber,
1005  m_cameras[0].m_videoFPS,
1006  m_cameras[0].m_videoFPSManual,
1007  m_cameras[0].m_videoFPSManualEnable,
1010  0);
1011  getMessageQueueToGUI()->push(report);
1012  }
1013  }
1014 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgReportCameraData * create(int deviceNumber, float fps, float fpsManual, bool fpsManualEnable, int width, int height, int status)
Definition: atvmod.h:285
float m_videoFPS
current video FPS rate
Definition: atvmod.h:516
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
int m_videoHeight
current video frame height
Definition: atvmod.h:518
int m_videoWidth
current video frame width
Definition: atvmod.h:517
MessageQueue * getMessageQueueToGUI()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCenterFrequency()

virtual qint64 ATVMod::getCenterFrequency ( ) const
inlinevirtual

Applies to a default stream.

Implements ChannelAPI.

Definition at line 370 of file atvmod.h.

References deserialize(), ATVModSettings::m_inputFrequencyOffset, ATVMod::MsgConfigureATVMod::m_settings, and serialize().

qint64 m_inputFrequencyOffset
offset from baseband center frequency
ATVModSettings m_settings
Definition: atvmod.h:462
+ Here is the call graph for this function:

◆ getEffectiveSampleRate()

int ATVMod::getEffectiveSampleRate ( ) const
inline

Definition at line 399 of file atvmod.h.

References m_tvSampleRate.

Referenced by ATVModGUI::displaySettings(), and ATVModGUI::on_modulation_currentIndexChanged().

399 { return m_tvSampleRate; };
int m_tvSampleRate
sample rate for generating signal
Definition: atvmod.h:470
+ Here is the caller graph for this function:

◆ getIdentifier()

virtual void ATVMod::getIdentifier ( QString &  id)
inlinevirtual

Implements ChannelAPI.

Definition at line 368 of file atvmod.h.

368 { id = objectName(); }

◆ getMagSq()

double ATVMod::getMagSq ( ) const
inline

Definition at line 400 of file atvmod.h.

References MovingAverageUtil< T, Total, N >::asDouble(), getBaseValues(), getCameraNumbers(), getRFBandwidthDivisor(), and m_movingAverage.

Referenced by ATVModGUI::tick(), and webapiFormatChannelReport().

400 { return m_movingAverage.asDouble(); }
MovingAverageUtil< double, double, 16 > m_movingAverage
Definition: atvmod.h:503
double asDouble() const
Definition: movingaverage.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNbSinkStreams()

virtual int ATVMod::getNbSinkStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 375 of file atvmod.h.

375 { return 1; }

◆ getNbSourceStreams()

virtual int ATVMod::getNbSourceStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 376 of file atvmod.h.

376 { return 0; }

◆ getRFBandwidthDivisor()

float ATVMod::getRFBandwidthDivisor ( ATVModSettings::ATVModulation  modulation)
static

◆ getStreamCenterFrequency()

virtual qint64 ATVMod::getStreamCenterFrequency ( int  streamIndex,
bool  sinkElseSource 
) const
inlinevirtual

Implements ChannelAPI.

Definition at line 378 of file atvmod.h.

References ATVModSettings::m_inputFrequencyOffset, ATVMod::MsgConfigureATVMod::m_settings, webapiReportGet(), webapiSettingsGet(), and webapiSettingsPutPatch().

379  {
380  (void) streamIndex;
381  (void) sinkElseSource;
383  }
qint64 m_inputFrequencyOffset
offset from baseband center frequency
ATVModSettings m_settings
Definition: atvmod.h:462
+ Here is the call graph for this function:

◆ getTitle()

virtual void ATVMod::getTitle ( QString &  title)
inlinevirtual

Implements ChannelAPI.

Definition at line 369 of file atvmod.h.

References ATVMod::MsgConfigureATVMod::m_settings, and ATVModSettings::m_title.

369 { title = m_settings.m_title; }
ATVModSettings m_settings
Definition: atvmod.h:462

◆ handleMessage()

bool ATVMod::handleMessage ( const Message cmd)
virtual

Processing of a message. Returns true if message has actually been processed.

Implements BasebandSampleSource.

Definition at line 520 of file atvmod.cpp.

References applyChannelSettings(), applySettings(), UpChannelizer::configure(), ATVMod::MsgReportVideoFileSourceStreamTiming::create(), ATVMod::MsgReportCameraData::create(), ATVMod::MsgConfigureChannelizer::getCenterFrequency(), ATVMod::MsgConfigureImageFileName::getFileName(), ATVMod::MsgConfigureVideoFileName::getFileName(), ATVMod::MsgConfigureATVMod::getForce(), UpChannelizer::MsgChannelizerNotification::getFrequencyOffset(), ATVMod::MsgConfigureCameraIndex::getIndex(), ATVMod::MsgConfigureCameraData::getIndex(), BasebandSampleSource::getInputMessageQueue(), ATVMod::MsgConfigureCameraData::getManualFPS(), ATVMod::MsgConfigureCameraData::getManualFPSEnable(), BasebandSampleSource::getMessageQueueToGUI(), UpChannelizer::getOutputSampleRate(), ATVMod::MsgConfigureVideoFileSourceSeek::getPercentage(), UpChannelizer::MsgChannelizerNotification::getSampleRate(), ATVMod::MsgConfigureATVMod::getSettings(), m_cameraIndex, m_cameras, m_channelizer, m_video, m_videoFPS, m_videoHeight, m_videoOK, m_videoWidth, Message::match(), openImage(), openVideo(), MessageQueue::push(), and seekVideoFileStream().

Referenced by destroy().

521 {
523  {
525  qDebug() << "ATVMod::handleMessage: MsgChannelizerNotification:"
526  << " outputSampleRate: " << notif.getSampleRate()
527  << " inputFrequencyOffset: " << notif.getFrequencyOffset();
528 
530 
531  return true;
532  }
533  else if (MsgConfigureChannelizer::match(cmd))
534  {
535  MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
536  qDebug() << "SSBMod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getOutputSampleRate()
537  << " centerFrequency: " << cfg.getCenterFrequency();
538 
541  cfg.getCenterFrequency());
542 
543  return true;
544  }
545  else if (MsgConfigureATVMod::match(cmd))
546  {
547  MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd;
548  qDebug() << "ATVMod::handleMessage: MsgConfigureATVMod";
549 
550  applySettings(cfg.getSettings(), cfg.getForce());
551 
552  return true;
553  }
554  else if (MsgConfigureImageFileName::match(cmd))
555  {
556  MsgConfigureImageFileName& conf = (MsgConfigureImageFileName&) cmd;
557  openImage(conf.getFileName());
558  return true;
559  }
560  else if (MsgConfigureVideoFileName::match(cmd))
561  {
562  MsgConfigureVideoFileName& conf = (MsgConfigureVideoFileName&) cmd;
563  openVideo(conf.getFileName());
564  return true;
565  }
567  {
568  MsgConfigureVideoFileSourceSeek& conf = (MsgConfigureVideoFileSourceSeek&) cmd;
569  int seekPercentage = conf.getPercentage();
570  seekVideoFileStream(seekPercentage);
571  return true;
572  }
574  {
575  int framesCount;
576 
577  if (m_videoOK && m_video.isOpened())
578  {
579  framesCount = m_video.get(CV_CAP_PROP_POS_FRAMES);;
580  } else {
581  framesCount = 0;
582  }
583 
584  if (getMessageQueueToGUI())
585  {
586  MsgReportVideoFileSourceStreamTiming *report;
587  report = MsgReportVideoFileSourceStreamTiming::create(framesCount);
588  getMessageQueueToGUI()->push(report);
589  }
590 
591  return true;
592  }
593  else if (MsgConfigureCameraIndex::match(cmd))
594  {
595  MsgConfigureCameraIndex& cfg = (MsgConfigureCameraIndex&) cmd;
596  uint32_t index = cfg.getIndex() & 0x7FFFFFF;
597 
598  if (index < m_cameras.size())
599  {
600  m_cameraIndex = index;
601 
602  if (getMessageQueueToGUI())
603  {
604  MsgReportCameraData *report;
606  m_cameras[m_cameraIndex].m_cameraNumber,
608  m_cameras[m_cameraIndex].m_videoFPSManual,
609  m_cameras[m_cameraIndex].m_videoFPSManualEnable,
612  0);
613  getMessageQueueToGUI()->push(report);
614  }
615  }
616 
617  return true;
618  }
619  else if (MsgConfigureCameraData::match(cmd))
620  {
621  MsgConfigureCameraData& cfg = (MsgConfigureCameraData&) cmd;
622  uint32_t index = cfg.getIndex() & 0x7FFFFFF;
623  float mnaualFPS = cfg.getManualFPS();
624  bool manualFPSEnable = cfg.getManualFPSEnable();
625 
626  if (index < m_cameras.size())
627  {
628  m_cameras[index].m_videoFPSManual = mnaualFPS;
629  m_cameras[index].m_videoFPSManualEnable = manualFPSEnable;
630  }
631 
632  return true;
633  }
634  else if (DSPSignalNotification::match(cmd))
635  {
636  return true;
637  }
638  else
639  {
640  return false;
641  }
642 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgReportCameraData * create(int deviceNumber, float fps, float fpsManual, bool fpsManualEnable, int width, int height, int status)
Definition: atvmod.h:285
float m_videoFPS
current video FPS rate
Definition: atvmod.h:516
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
int getOutputSampleRate() const
Definition: upchannelizer.h:89
void openImage(const QString &fileName)
Definition: atvmod.cpp:808
unsigned int uint32_t
Definition: rtptypes_win.h:46
void applySettings(const ATVModSettings &settings, bool force=false)
Definition: atvmod.cpp:1086
void openVideo(const QString &fileName)
Definition: atvmod.cpp:831
UpChannelizer * m_channelizer
Definition: atvmod.h:458
static MsgReportVideoFileSourceStreamTiming * create(int frameCount)
Definition: atvmod.h:183
cv::VideoCapture m_video
current video capture
Definition: atvmod.h:513
int m_videoHeight
current video frame height
Definition: atvmod.h:518
static bool match(const Message *message)
Definition: message.cpp:45
int m_videoWidth
current video frame width
Definition: atvmod.h:517
bool m_videoOK
Definition: atvmod.h:526
MessageQueue * getMessageQueueToGUI()
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: atvmod.cpp:1033
void seekVideoFileStream(int seekPercentage)
Definition: atvmod.cpp:932
void configure(MessageQueue *messageQueue, int sampleRate, int centerFrequency)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ levelChanged

void ATVMod::levelChanged ( qreal  rmsLevel,
qreal  peakLevel,
int  numSamples 
)
signal

Level changed

Parameters
rmsLevelRMS level in range 0.0 - 1.0
peakLevelPeak level in range 0.0 - 1.0
numSamplesNumber of audio samples analyzed

Referenced by calculateLevel().

+ Here is the caller graph for this function:

◆ mixImageAndText()

void ATVMod::mixImageAndText ( cv::Mat &  image)
private

Definition at line 1016 of file atvmod.cpp.

References ATVModSettings::m_overlayText, m_settings, and ATVModSettings::m_uniformLevel.

Referenced by applySettings(), openImage(), and pullVideo().

1017 {
1018  int fontFace = cv::FONT_HERSHEY_PLAIN;
1019  double fontScale = image.rows / 100.0;
1020  int thickness = image.cols / 160;
1021  int baseline=0;
1022 
1023  fontScale = fontScale < 4.0f ? 4.0f : fontScale; // minimum size
1024  cv::Size textSize = cv::getTextSize(m_settings.m_overlayText.toStdString(), fontFace, fontScale, thickness, &baseline);
1025  baseline += thickness;
1026 
1027  // position the text in the top left corner
1028  cv::Point textOrg(6, textSize.height+10);
1029  // then put the text itself
1030  cv::putText(image, m_settings.m_overlayText.toStdString(), textOrg, fontFace, fontScale, cv::Scalar::all(255*m_settings.m_uniformLevel), thickness, CV_AA);
1031 }
QString m_overlayText
ATVModSettings m_settings
Definition: atvmod.h:462
Real m_uniformLevel
Percentage between black and white for uniform screen display.
+ Here is the caller graph for this function:

◆ modulateSample()

void ATVMod::modulateSample ( )
private

Definition at line 194 of file atvmod.cpp.

References ATVModSettings::ATVModulationAM, ATVModSettings::ATVModulationFM, ATVModSettings::ATVModulationLSB, ATVModSettings::ATVModulationUSB, ATVModSettings::ATVModulationVestigialLSB, ATVModSettings::ATVModulationVestigialUSB, calculateLevel(), cos(), ATVModSettings::m_atvModulation, ATVModSettings::m_fmExcursion, ATVModSettings::m_invertedVideo, m_modPhasor, m_modSample, M_PI, ATVModSettings::m_rfScalingFactor, m_settings, modulateSSB(), modulateVestigialSSB(), pullVideo(), and sin().

Referenced by pull().

195 {
196  Real t;
197 
198  pullVideo(t);
199  calculateLevel(t);
200 
201  t = m_settings.m_invertedVideo ? 1.0f - t : t;
202 
203  switch (m_settings.m_atvModulation)
204  {
205  case ATVModSettings::ATVModulationFM: // FM half bandwidth deviation
206  m_modPhasor += (t - 0.5f) * m_settings.m_fmExcursion * 2.0f * M_PI;
207  if (m_modPhasor > 2.0f * M_PI) m_modPhasor -= 2.0f * M_PI; // limit growth
208  if (m_modPhasor < 2.0f * M_PI) m_modPhasor += 2.0f * M_PI; // limit growth
211  break;
216  break;
221  break;
222  case ATVModSettings::ATVModulationAM: // AM 90%
223  default:
224  m_modSample.real((t*1.8f + 0.1f) * (m_settings.m_rfScalingFactor/2.0f)); // modulate and scale zero frequency carrier
225  m_modSample.imag(0.0f);
226  }
227 }
float m_rfScalingFactor
Scaling factor from +/-1 to +/-2^15.
ATVModulation m_atvModulation
RF modulation type.
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
Complex & modulateVestigialSSB(Real &sample)
Definition: atvmod.cpp:248
#define M_PI
Definition: rdsdemod.cpp:27
float m_modPhasor
For FM modulation.
Definition: atvmod.h:466
ATVModSettings m_settings
Definition: atvmod.h:462
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2265
float m_fmExcursion
FM excursion factor relative to full bandwidth.
bool m_invertedVideo
True if video signal is inverted before modulation.
Complex & modulateSSB(Real &sample)
Definition: atvmod.cpp:229
float Real
Definition: dsptypes.h:42
void pullVideo(Real &sample)
Definition: atvmod.cpp:267
Complex m_modSample
Definition: atvmod.h:465
void calculateLevel(Real &sample)
Definition: atvmod.cpp:490
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modulateSSB()

Complex & ATVMod::modulateSSB ( Real sample)
private

Definition at line 229 of file atvmod.cpp.

References ATVModSettings::ATVModulationUSB, ATVModSettings::m_atvModulation, m_settings, m_SSBFilter, m_SSBFilterBuffer, m_SSBFilterBufferIndex, and fftfilt::runSSB().

Referenced by modulateSample().

230 {
231  int n_out;
232  Complex ci(sample, 0.0f);
233  fftfilt::cmplx *filtered;
234 
236 
237  if (n_out > 0)
238  {
239  memcpy((void *) m_SSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
241  }
242 
244 
245  return m_SSBFilterBuffer[m_SSBFilterBufferIndex-1];
246 }
ATVModulation m_atvModulation
RF modulation type.
fftfilt * m_SSBFilter
Definition: atvmod.h:536
std::complex< float > cmplx
Definition: fftfilt.h:21
Complex * m_SSBFilterBuffer
Definition: atvmod.h:537
ATVModSettings m_settings
Definition: atvmod.h:462
int m_SSBFilterBufferIndex
Definition: atvmod.h:538
int runSSB(const cmplx &in, cmplx **out, bool usb, bool getDC=true)
Definition: fftfilt.cpp:284
std::complex< Real > Complex
Definition: dsptypes.h:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modulateVestigialSSB()

Complex & ATVMod::modulateVestigialSSB ( Real sample)
private

Definition at line 248 of file atvmod.cpp.

References ATVModSettings::ATVModulationVestigialUSB, ATVModSettings::m_atvModulation, m_DSBFilter, m_DSBFilterBuffer, m_DSBFilterBufferIndex, m_settings, and fftfilt::runAsym().

Referenced by modulateSample().

249 {
250  int n_out;
251  Complex ci(sample, 0.0f);
252  fftfilt::cmplx *filtered;
253 
255 
256  if (n_out > 0)
257  {
258  memcpy((void *) m_DSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
260  }
261 
263 
264  return m_DSBFilterBuffer[m_DSBFilterBufferIndex-1];
265 }
ATVModulation m_atvModulation
RF modulation type.
int m_DSBFilterBufferIndex
Definition: atvmod.h:543
std::complex< float > cmplx
Definition: fftfilt.h:21
ATVModSettings m_settings
Definition: atvmod.h:462
std::complex< Real > Complex
Definition: dsptypes.h:43
fftfilt * m_DSBFilter
Definition: atvmod.h:541
int runAsym(const cmplx &in, cmplx **out, bool usb)
Asymmetrical fitering can be used for vestigial sideband.
Definition: fftfilt.cpp:360
Complex * m_DSBFilterBuffer
Definition: atvmod.h:542
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ networkManagerFinished

void ATVMod::networkManagerFinished ( QNetworkReply *  reply)
privateslot

Definition at line 1597 of file atvmod.cpp.

Referenced by ATVMod(), and ~ATVMod().

1598 {
1599  QNetworkReply::NetworkError replyError = reply->error();
1600 
1601  if (replyError)
1602  {
1603  qWarning() << "ATVMod::networkManagerFinished:"
1604  << " error(" << (int) replyError
1605  << "): " << replyError
1606  << ": " << reply->errorString();
1607  return;
1608  }
1609 
1610  QString answer = reply->readAll();
1611  answer.chop(1); // remove last \n
1612  qDebug("ATVMod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
1613 }
+ Here is the caller graph for this function:

◆ openImage()

void ATVMod::openImage ( const QString &  fileName)
private

Definition at line 808 of file atvmod.cpp.

References m_imageFileName, m_imageFromFile, m_imageOK, m_imageOriginal, m_settings, ATVModSettings::m_showOverlayText, mixImageAndText(), and resizeImage().

Referenced by handleMessage().

809 {
810  m_imageFromFile = cv::imread(qPrintable(fileName), CV_LOAD_IMAGE_GRAYSCALE);
811  m_imageOK = m_imageFromFile.data != 0;
812 
813  if (m_imageOK)
814  {
815  m_imageFileName = fileName;
817 
820  }
821 
822  resizeImage();
823  }
824  else
825  {
826  m_imageFileName.clear();
827  qDebug("ATVMod::openImage: cannot open image file %s", qPrintable(fileName));
828  }
829 }
cv::Mat m_imageOriginal
original not resized image
Definition: atvmod.h:509
void resizeImage()
Definition: atvmod.cpp:872
ATVModSettings m_settings
Definition: atvmod.h:462
cv::Mat m_imageFromFile
original image not resized not overlaid by text
Definition: atvmod.h:508
bool m_showOverlayText
Show overlay text on image.
bool m_imageOK
Definition: atvmod.h:511
QString m_imageFileName
Definition: atvmod.h:532
void mixImageAndText(cv::Mat &image)
Definition: atvmod.cpp:1016
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openVideo()

void ATVMod::openVideo ( const QString &  fileName)
private

Definition at line 831 of file atvmod.cpp.

References calculateVideoSizes(), ATVMod::MsgReportVideoFileSourceStreamData::create(), BasebandSampleSource::getMessageQueueToGUI(), m_video, m_videoEOF, m_videoFileName, m_videoFPS, m_videoHeight, m_videoLength, m_videoOK, m_videoWidth, and MessageQueue::push().

Referenced by handleMessage().

832 {
833  //if (m_videoOK && m_video.isOpened()) m_video.release(); should be done by OpenCV in open method
834 
835  m_videoOK = m_video.open(qPrintable(fileName));
836 
837  if (m_videoOK)
838  {
839  m_videoFileName = fileName;
840  m_videoFPS = m_video.get(CV_CAP_PROP_FPS);
841  m_videoWidth = (int) m_video.get(CV_CAP_PROP_FRAME_WIDTH);
842  m_videoHeight = (int) m_video.get(CV_CAP_PROP_FRAME_HEIGHT);
843  m_videoLength = (int) m_video.get(CV_CAP_PROP_FRAME_COUNT);
844  int ex = static_cast<int>(m_video.get(CV_CAP_PROP_FOURCC));
845  char ext[] = {(char)(ex & 0XFF),(char)((ex & 0XFF00) >> 8),(char)((ex & 0XFF0000) >> 16),(char)((ex & 0XFF000000) >> 24),0};
846 
847  qDebug("ATVMod::openVideo: %s FPS: %f size: %d x %d #frames: %d codec: %s",
848  m_video.isOpened() ? "OK" : "KO",
849  m_videoFPS,
850  m_videoWidth,
853  ext);
854 
856  m_videoEOF = false;
857 
858  if (getMessageQueueToGUI())
859  {
860  MsgReportVideoFileSourceStreamData *report;
862  getMessageQueueToGUI()->push(report);
863  }
864  }
865  else
866  {
867  m_videoFileName.clear();
868  qDebug("ATVMod::openVideo: cannot open video file %s", qPrintable(fileName));
869  }
870 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
float m_videoFPS
current video FPS rate
Definition: atvmod.h:516
QString m_videoFileName
Definition: atvmod.h:533
static MsgReportVideoFileSourceStreamData * create(int frameRate, quint32 recordLength)
Definition: atvmod.h:204
int m_videoLength
current video length in frames
Definition: atvmod.h:524
cv::VideoCapture m_video
current video capture
Definition: atvmod.h:513
int m_videoHeight
current video frame height
Definition: atvmod.h:518
bool m_videoEOF
current video has reached end of file
Definition: atvmod.h:525
int m_videoWidth
current video frame width
Definition: atvmod.h:517
bool m_videoOK
Definition: atvmod.h:526
MessageQueue * getMessageQueueToGUI()
void calculateVideoSizes()
Definition: atvmod.cpp:880
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pull()

void ATVMod::pull ( Sample sample)
virtual

Implements BasebandSampleSource.

Definition at line 138 of file atvmod.cpp.

References Interpolator::decimate(), Interpolator::interpolate(), ATVModSettings::m_channelMute, ATVModSettings::m_forceDecimator, Sample::m_imag, m_interpolator, m_interpolatorDistance, m_interpolatorDistanceRemain, m_modSample, m_outputSampleRate, Sample::m_real, m_settings, m_settingsMutex, m_tvSampleRate, modulateSample(), and pullFinalize().

Referenced by destroy().

139 {
141  {
142  sample.m_real = 0.0f;
143  sample.m_imag = 0.0f;
144  return;
145  }
146 
147  Complex ci;
148 
149  m_settingsMutex.lock();
150 
151  if ((m_tvSampleRate == m_outputSampleRate) && (!m_settings.m_forceDecimator)) // no interpolation nor decimation
152  {
153  modulateSample();
154  pullFinalize(m_modSample, sample);
155  }
156  else
157  {
158  if (m_interpolatorDistance > 1.0f) // decimate
159  {
160  modulateSample();
161 
163  {
164  modulateSample();
165  }
166  }
167  else
168  {
170  {
171  modulateSample();
172  }
173  }
174 
176  pullFinalize(ci, sample);
177  }
178 }
bool decimate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:38
void pullFinalize(Complex &ci, Sample &sample)
Definition: atvmod.cpp:180
bool interpolate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:53
void modulateSample()
Definition: atvmod.cpp:194
QMutex m_settingsMutex
Definition: atvmod.h:498
bool m_channelMute
Mute channel baseband output.
bool m_forceDecimator
Forces decimator even when channel and source sample rates are equal.
FixReal m_real
Definition: dsptypes.h:64
ATVModSettings m_settings
Definition: atvmod.h:462
int m_tvSampleRate
sample rate for generating signal
Definition: atvmod.h:470
Real m_interpolatorDistanceRemain
Definition: atvmod.h:469
Real m_interpolatorDistance
Definition: atvmod.h:468
Interpolator m_interpolator
Definition: atvmod.h:467
FixReal m_imag
Definition: dsptypes.h:65
std::complex< Real > Complex
Definition: dsptypes.h:43
int m_outputSampleRate
Definition: atvmod.h:460
Complex m_modSample
Definition: atvmod.h:465
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAudio()

void ATVMod::pullAudio ( int  nbSamples)
virtual

Reimplemented from BasebandSampleSource.

Definition at line 133 of file atvmod.cpp.

Referenced by destroy().

134 {
135  (void) nbSamples;
136 }
+ Here is the caller graph for this function:

◆ pullFinalize()

void ATVMod::pullFinalize ( Complex ci,
Sample sample 
)
private

Definition at line 180 of file atvmod.cpp.

References m_carrierNco, Sample::m_imag, m_movingAverage, Sample::m_real, m_settingsMutex, NCO::nextIQ(), and SDR_TX_SCALED.

Referenced by pull().

181 {
182  ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
183 
184  m_settingsMutex.unlock();
185 
186  double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
187  magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
188  m_movingAverage(magsq);
189 
190  sample.m_real = (FixReal) ci.real();
191  sample.m_imag = (FixReal) ci.imag();
192 }
Complex nextIQ()
Return next complex sample.
Definition: nco.cpp:61
QMutex m_settingsMutex
Definition: atvmod.h:498
FixReal m_real
Definition: dsptypes.h:64
MovingAverageUtil< double, double, 16 > m_movingAverage
Definition: atvmod.h:503
NCO m_carrierNco
Definition: atvmod.h:464
FixReal m_imag
Definition: dsptypes.h:65
#define SDR_TX_SCALED
Definition: dsptypes.h:40
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullImageLine()

void ATVMod::pullImageLine ( Real sample,
bool  noHSync = false 
)
inlineprivate

Definition at line 581 of file atvmod.h.

References ATVModSettings::ATVModInputCamera, ATVModSettings::ATVModInputChessboard, ATVModSettings::ATVModInputHBars, ATVModSettings::ATVModInputHGradient, ATVModSettings::ATVModInputImage, ATVModSettings::ATVModInputUniform, ATVModSettings::ATVModInputVBars, ATVModSettings::ATVModInputVGradient, ATVModSettings::ATVModInputVideo, ATVModSettings::m_atvModInput, m_blackLevel, m_cameraIndex, m_lineCount, m_linesPerVBar, m_nbImageLines2, m_nbSyncLinesHeadE, m_nbSyncLinesHeadO, m_pointsPerBP, m_pointsPerHBar, ATVModSettings::m_uniformLevel, and ATVMod::ATVCamera::m_videoFrame.

Referenced by pullVideo().

582  {
583  if (m_horizontalCount < m_pointsPerSync) // sync pulse
584  {
585  sample = noHSync ? m_blackLevel : 0.0f; // ultra-black
586  }
587  else if (m_horizontalCount < m_pointsPerSync + m_pointsPerBP) // back porch
588  {
589  sample = m_blackLevel; // black
590  }
592  {
593  int pointIndex = m_horizontalCount - (m_pointsPerSync + m_pointsPerBP);
594  int oddity = m_lineCount < m_nbLines2 + 1 ? 0 : 1;
595  int iLine = oddity == 0 ? m_lineCount : m_lineCount - m_nbLines2 - 1;
596  int iLineImage = iLine - m_nbBlankLines - (oddity == 0 ? m_nbSyncLinesHeadE : m_nbSyncLinesHeadO);
597 
598  switch(m_settings.m_atvModInput)
599  {
601  sample = (((float)pointIndex) / m_pointsPerHBar) * m_hBarIncrement + m_blackLevel;
602  break;
604  sample = (((float)iLine) / m_linesPerVBar) * m_vBarIncrement + m_blackLevel;
605  break;
607  sample = (((iLine / m_linesPerVBar)*5 + (pointIndex / m_pointsPerHBar)) % 2) * m_spanLevel * m_settings.m_uniformLevel + m_blackLevel;
608  break;
610  sample = (pointIndex / (float) m_pointsPerImgLine) * m_spanLevel + m_blackLevel;
611  break;
613  sample = ((iLine -5) / (float) m_nbImageLines2) * m_spanLevel + m_blackLevel;
614  break;
616  if (!m_imageOK || (iLineImage < -oddity) || m_image.empty())
617  {
619  }
620  else
621  {
622  unsigned char pixv;
623 
624  if (m_interleaved) {
625  pixv = m_image.at<unsigned char>(2*iLineImage + oddity, pointIndex); // row (y), col (x)
626  } else {
627  pixv = m_image.at<unsigned char>(iLineImage, pointIndex); // row (y), col (x)
628  }
629 
630  sample = (pixv / 256.0f) * m_spanLevel + m_blackLevel;
631  }
632  break;
634  if (!m_videoOK || (iLineImage < -oddity) || m_videoFrame.empty())
635  {
637  }
638  else
639  {
640  unsigned char pixv;
641 
642  if (m_interleaved) {
643  pixv = m_videoFrame.at<unsigned char>(2*iLineImage + oddity, pointIndex); // row (y), col (x)
644  } else {
645  pixv = m_videoFrame.at<unsigned char>(iLineImage, pointIndex); // row (y), col (x)
646  }
647 
648  sample = (pixv / 256.0f) * m_spanLevel + m_blackLevel;
649  }
650  break;
652  if ((iLineImage < -oddity) || (m_cameraIndex < 0))
653  {
655  }
656  else
657  {
658  ATVCamera& camera = m_cameras[m_cameraIndex];
659 
660  if (camera.m_videoFrame.empty())
661  {
663  }
664  else
665  {
666  unsigned char pixv;
667 
668  if (m_interleaved) {
669  pixv = camera.m_videoFrame.at<unsigned char>(2*iLineImage + oddity, pointIndex); // row (y), col (x)
670  } else {
671  pixv = camera.m_videoFrame.at<unsigned char>(iLineImage, pointIndex); // row (y), col (x)
672  }
673 
674  sample = (pixv / 256.0f) * m_spanLevel + m_blackLevel;
675  }
676  }
677  break;
679  default:
681  }
682  }
683  else // front porch
684  {
685  sample = m_blackLevel; // black
686  }
687  }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
uint32_t m_linesPerVBar
number of lines for a bar of the bar chart
Definition: atvmod.h:478
float m_hBarIncrement
video level increment at each horizontal bar increment
Definition: atvmod.h:494
int m_nbSyncLinesHeadO
number of header sync lines on odd frame
Definition: atvmod.h:486
uint32_t m_nbImageLines2
same number as above (non interlaced) or half the number above (interlaced)
Definition: atvmod.h:483
float m_vBarIncrement
video level increment at each vertical bar increment
Definition: atvmod.h:495
ATVModSettings m_settings
Definition: atvmod.h:462
uint32_t m_pointsPerHBar
number of line points for a bar of the bar chart
Definition: atvmod.h:477
cv::Mat m_videoFrame
current displayable video frame
Definition: atvmod.h:515
bool m_imageOK
Definition: atvmod.h:511
ATVModInput m_atvModInput
Input source type.
int m_pointsPerImgLine
number of line points for the image line
Definition: atvmod.h:474
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
Definition: atvmod.h:492
bool m_videoOK
Definition: atvmod.h:526
bool m_interleaved
true if image is interlaced (2 half frames per frame)
Definition: atvmod.h:496
Real m_uniformLevel
Percentage between black and white for uniform screen display.
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
cv::Mat m_image
resized image for transmission at given rate
Definition: atvmod.h:510
static const float m_spanLevel
Definition: atvmod.h:550
int m_lineCount
current line index in frame
Definition: atvmod.h:500
int m_pointsPerBP
number of line points for the back porch
Definition: atvmod.h:473
int m_nbSyncLinesHeadE
number of header sync lines on even frame
Definition: atvmod.h:485
static const float m_blackLevel
Definition: atvmod.h:549
int m_nbLines2
same number as above (non interlaced) or half the number above (interlaced)
Definition: atvmod.h:481
+ Here is the caller graph for this function:

◆ pullVideo()

void ATVMod::pullVideo ( Real sample)
private

Definition at line 267 of file atvmod.cpp.

References ATVModSettings::ATVModInputCamera, ATVModSettings::ATVModInputVideo, ATVModSettings::ATVStdHSkip, ATVMod::MsgReportCameraData::create(), BasebandSampleSource::getMessageQueueToGUI(), i, ATVModSettings::m_atvModInput, ATVModSettings::m_atvStd, ATVMod::ATVCamera::m_camera, m_cameraFPSTestNbFrames, m_cameraIndex, ATVMod::ATVCamera::m_cameraNumber, ATVModSettings::m_cameraPlay, m_cameras, m_evenImage, m_fps, m_horizontalCount, m_lineCount, m_nbBlankLines, m_nbHorizPoints, m_nbLines, m_nbLines2, m_nbSyncLinesBottom, m_nbSyncLinesHeadE, m_nbSyncLinesHeadO, m_settings, ATVModSettings::m_showOverlayText, m_video, m_videoEOF, ATVMod::ATVCamera::m_videoFPS, m_videoFPS, ATVMod::ATVCamera::m_videoFPSCount, m_videoFPSCount, ATVMod::ATVCamera::m_videoFPSManual, ATVMod::ATVCamera::m_videoFPSManualEnable, ATVMod::ATVCamera::m_videoFPSq, m_videoFPSq, ATVMod::ATVCamera::m_videoFPSqManual, ATVMod::ATVCamera::m_videoframeOriginal, m_videoframeOriginal, ATVMod::ATVCamera::m_videoHeight, m_videoOK, ATVModSettings::m_videoPlay, ATVModSettings::m_videoPlayLoop, ATVMod::ATVCamera::m_videoPrevFPSCount, m_videoPrevFPSCount, ATVMod::ATVCamera::m_videoWidth, mixImageAndText(), pullImageLine(), pullVSyncLine(), MessageQueue::push(), resizeCamera(), resizeVideo(), seekVideoFileStream(), and start().

Referenced by modulateSample().

268 {
269  if ((m_settings.m_atvStd == ATVModSettings::ATVStdHSkip) && (m_lineCount == m_nbLines2)) // last line in skip mode
270  {
271  pullImageLine(sample, true); // pull image line without sync
272  }
273  else if (m_lineCount < m_nbLines2 + 1) // even image or non interlaced
274  {
275  int iLine = m_lineCount;
276 
277  if (iLine < m_nbSyncLinesHeadE + m_nbBlankLines)
278  {
279  pullVSyncLine(sample);
280  }
281  else if (iLine > m_nbLines2 - m_nbSyncLinesBottom)
282  {
283  pullVSyncLine(sample);
284  }
285  else
286  {
287  pullImageLine(sample);
288  }
289  }
290  else // odd image
291  {
292  int iLine = m_lineCount - m_nbLines2 - 1;
293 
294  if (iLine < m_nbSyncLinesHeadO + m_nbBlankLines)
295  {
296  pullVSyncLine(sample);
297  }
298  else if (iLine > m_nbLines2 - 1 - m_nbSyncLinesBottom)
299  {
300  pullVSyncLine(sample);
301  }
302  else
303  {
304  pullImageLine(sample);
305  }
306  }
307 
309  {
311  }
312  else
313  {
314  if (m_lineCount < m_nbLines - 1)
315  {
316  m_lineCount++;
318  }
319  else // new image
320  {
321  m_lineCount = 0;
323 
325  {
326  int grabOK = 0;
327  int fpsIncrement = (int) m_videoFPSCount - m_videoPrevFPSCount;
328 
329  // move a number of frames according to increment
330  // use grab to test for EOF then retrieve to preserve last valid frame as the current original frame
331  // TODO: handle pause (no move)
332  for (int i = 0; i < fpsIncrement; i++)
333  {
334  grabOK = m_video.grab();
335  if (!grabOK) break;
336  }
337 
338  if (grabOK)
339  {
340  cv::Mat colorFrame;
341  m_video.retrieve(colorFrame);
342 
343  if (!colorFrame.empty()) // some frames may not come out properly
344  {
346  mixImageAndText(colorFrame);
347  }
348 
349  cv::cvtColor(colorFrame, m_videoframeOriginal, CV_BGR2GRAY);
350  resizeVideo();
351  }
352  }
353  else
354  {
355  if (m_settings.m_videoPlayLoop) { // play loop
357  } else { // stops
358  m_videoEOF = true;
359  }
360  }
361 
363  {
366  }
367  else
368  {
371  }
372  }
374  {
375  ATVCamera& camera = m_cameras[m_cameraIndex]; // currently selected canera
376 
377  if (camera.m_videoFPS < 0.0f) // default frame rate when it could not be obtained via get
378  {
379  time_t start, end;
380  cv::Mat frame;
381 
382  if (getMessageQueueToGUI())
383  {
384  MsgReportCameraData *report;
386  camera.m_cameraNumber,
387  0.0f,
388  camera.m_videoFPSManual,
389  camera.m_videoFPSManualEnable,
390  camera.m_videoWidth,
391  camera.m_videoHeight,
392  1); // open splash screen on GUI side
393  getMessageQueueToGUI()->push(report);
394  }
395 
396  int nbFrames = 0;
397 
398  time(&start);
399 
400  for (int i = 0; i < m_cameraFPSTestNbFrames; i++)
401  {
402  camera.m_camera >> frame;
403  if (!frame.empty()) nbFrames++;
404  }
405 
406  time(&end);
407 
408  double seconds = difftime (end, start);
409  // take a 10% guard and divide bandwidth between all cameras as a hideous hack
410  camera.m_videoFPS = ((nbFrames / seconds) * 0.9) / m_cameras.size();
411  camera.m_videoFPSq = camera.m_videoFPS / m_fps;
412  camera.m_videoFPSCount = camera.m_videoFPSq;
413  camera.m_videoPrevFPSCount = 0;
414 
415  if (getMessageQueueToGUI())
416  {
417  MsgReportCameraData *report;
419  camera.m_cameraNumber,
420  camera.m_videoFPS,
421  camera.m_videoFPSManual,
422  camera.m_videoFPSManualEnable,
423  camera.m_videoWidth,
424  camera.m_videoHeight,
425  2); // close splash screen on GUI side
426  getMessageQueueToGUI()->push(report);
427  }
428  }
429  else if (camera.m_videoFPS == 0.0f) // Hideous hack for windows
430  {
431  camera.m_videoFPS = 5.0f;
432  camera.m_videoFPSq = camera.m_videoFPS / m_fps;
433  camera.m_videoFPSCount = camera.m_videoFPSq;
434  camera.m_videoPrevFPSCount = 0;
435 
436  if (getMessageQueueToGUI())
437  {
438  MsgReportCameraData *report;
440  camera.m_cameraNumber,
441  camera.m_videoFPS,
442  camera.m_videoFPSManual,
443  camera.m_videoFPSManualEnable,
444  camera.m_videoWidth,
445  camera.m_videoHeight,
446  0);
447  getMessageQueueToGUI()->push(report);
448  }
449  }
450 
451  int fpsIncrement = (int) camera.m_videoFPSCount - camera.m_videoPrevFPSCount;
452 
453  // move a number of frames according to increment
454  // use grab to test for EOF then retrieve to preserve last valid frame as the current original frame
455  cv::Mat colorFrame;
456 
457  for (int i = 0; i < fpsIncrement; i++)
458  {
459  camera.m_camera >> colorFrame;
460  if (colorFrame.empty()) break;
461  }
462 
463  if (!colorFrame.empty()) // some frames may not come out properly
464  {
466  mixImageAndText(colorFrame);
467  }
468 
469  cv::cvtColor(colorFrame, camera.m_videoframeOriginal, CV_BGR2GRAY);
470  resizeCamera();
471  }
472 
473  if (camera.m_videoFPSCount < (camera.m_videoFPSManualEnable ? camera.m_videoFPSManual : camera.m_videoFPS))
474  {
475  camera.m_videoPrevFPSCount = (int) camera.m_videoFPSCount;
476  camera.m_videoFPSCount += (camera.m_videoFPSManualEnable ? camera.m_videoFPSqManual : camera.m_videoFPSq);
477  }
478  else
479  {
480  camera.m_videoPrevFPSCount = 0;
481  camera.m_videoFPSCount = (camera.m_videoFPSManualEnable ? camera.m_videoFPSqManual : camera.m_videoFPSq);
482  }
483  }
484  }
485 
486  m_horizontalCount = 0;
487  }
488 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
bool m_evenImage
in interlaced mode true if this is an even image
Definition: atvmod.h:497
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgReportCameraData * create(int deviceNumber, float fps, float fpsManual, bool fpsManualEnable, int width, int height, int status)
Definition: atvmod.h:285
int m_nbLines
number of lines per complete frame
Definition: atvmod.h:480
float m_videoFPS
current video FPS rate
Definition: atvmod.h:516
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
int m_videoPrevFPSCount
current video FPS previous integer counter
Definition: atvmod.h:523
static const int m_cameraFPSTestNbFrames
number of frames for camera FPS test
Definition: atvmod.h:553
void resizeVideo()
Definition: atvmod.cpp:891
int m_nbSyncLinesHeadO
number of header sync lines on odd frame
Definition: atvmod.h:486
int m_nbSyncLinesBottom
number of sync lines at bottom
Definition: atvmod.h:487
int m_nbHorizPoints
number of line points per horizontal line
Definition: atvmod.h:484
void pullVSyncLine(Real &sample)
Definition: atvmod.h:767
cv::VideoCapture m_video
current video capture
Definition: atvmod.h:513
void pullImageLine(Real &sample, bool noHSync=false)
Definition: atvmod.h:581
ATVModSettings m_settings
Definition: atvmod.h:462
int32_t i
Definition: decimators.h:244
bool m_showOverlayText
Show overlay text on image.
ATVStd m_atvStd
Standard.
virtual void start()
Definition: atvmod.cpp:509
ATVModInput m_atvModInput
Input source type.
cv::Mat m_videoframeOriginal
current frame from video
Definition: atvmod.h:514
float m_videoFPSCount
current video FPS fractional counter
Definition: atvmod.h:522
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
Definition: atvmod.h:492
bool m_videoEOF
current video has reached end of file
Definition: atvmod.h:525
bool m_videoPlay
True to play video and false to pause.
bool m_videoOK
Definition: atvmod.h:526
bool m_cameraPlay
True to play camera video and false to pause.
MessageQueue * getMessageQueueToGUI()
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
float m_fps
resulting frames per second
Definition: atvmod.h:501
int m_lineCount
current line index in frame
Definition: atvmod.h:500
int m_nbSyncLinesHeadE
number of header sync lines on even frame
Definition: atvmod.h:485
void seekVideoFileStream(int seekPercentage)
Definition: atvmod.cpp:932
void resizeCamera()
Definition: atvmod.cpp:923
void mixImageAndText(cv::Mat &image)
Definition: atvmod.cpp:1016
float m_videoFPSq
current video FPS sacaling factor
Definition: atvmod.h:521
bool m_videoPlayLoop
Play video in a loop.
int m_nbLines2
same number as above (non interlaced) or half the number above (interlaced)
Definition: atvmod.h:481
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullVSyncLine()

void ATVMod::pullVSyncLine ( Real sample)
inlineprivate

Definition at line 767 of file atvmod.h.

References m_blankLineLvel, m_lineCount, pullVSyncLineEqualizingPulses(), pullVSyncLineEqualizingThenLongPulses(), pullVSyncLineLongPulses(), and pullVSyncLineLongThenEqualizingPulses().

Referenced by pullVideo().

768  {
769  if (m_lineCount < m_nbLines2 + 1) // even
770  {
771  int fieldLine = m_lineCount;
772 
773  if (fieldLine < m_nbLongSyncLines) // 0,1: Whole line "long" pulses
774  {
775  pullVSyncLineLongPulses(sample);
776  }
777  else if (fieldLine < m_nbLongSyncLines + m_nbHalfLongSync) // long pulse then equalizing pulse
778  {
780  }
781  else if (fieldLine < m_nbLongSyncLines + m_nbHalfLongSync + m_nbWholeEqLines) // Whole line equalizing pulses
782  {
784  }
785  else if (fieldLine > m_nbLines2 - m_nbHalfLongSync) // equalizing pulse then long pulse
786  {
788  }
789  else if (fieldLine > m_nbLines2 - m_nbHalfLongSync - m_nbWholeEqLines) // Whole line equalizing pulses
790  {
792  }
793  else // black images
794  {
796  {
797  sample = 0.0f;
798  }
799  else
800  {
801  sample = m_blankLineLvel;
802  }
803  }
804  }
805  else // odd
806  {
807  int fieldLine = m_lineCount - m_nbLines2 - 1;
808 
809  if (fieldLine < m_nbLongSyncLines) // 0,1: Whole line "long" pulses
810  {
811  pullVSyncLineLongPulses(sample);
812  }
813  else if (fieldLine < m_nbLongSyncLines + m_nbWholeEqLines) // Whole line equalizing pulses
814  {
816  }
817  else if (fieldLine > m_nbLines2 - 1 - m_nbWholeEqLines - m_nbHalfLongSync) // Whole line equalizing pulses
818  {
820  }
821  else // black images
822  {
824  {
825  sample = 0.0f;
826  }
827  else
828  {
829  sample = m_blankLineLvel;
830  }
831  }
832  }
833  }
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_nbWholeEqLines
number of whole equalizing lines
Definition: atvmod.h:490
void pullVSyncLineLongThenEqualizingPulses(Real &sample)
Definition: atvmod.h:747
void pullVSyncLineLongPulses(Real &sample)
Definition: atvmod.h:689
int m_nbHalfLongSync
number of half long sync / equalization lines
Definition: atvmod.h:489
void pullVSyncLineEqualizingThenLongPulses(Real &sample)
Definition: atvmod.h:727
void pullVSyncLineEqualizingPulses(Real &sample)
Definition: atvmod.h:707
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
float m_blankLineLvel
video level of blank lines
Definition: atvmod.h:493
int m_lineCount
current line index in frame
Definition: atvmod.h:500
int m_nbLines2
same number as above (non interlaced) or half the number above (interlaced)
Definition: atvmod.h:481
int m_nbLongSyncLines
number of whole long sync lines for vertical synchronization
Definition: atvmod.h:488
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullVSyncLineEqualizingPulses()

void ATVMod::pullVSyncLineEqualizingPulses ( Real sample)
inlineprivate

Definition at line 707 of file atvmod.h.

References m_blackLevel.

Referenced by pullVSyncLine().

708  {
710  {
711  sample = 0.0f; // ultra-black
712  }
713  else if (m_horizontalCount < (m_nbHorizPoints/2))
714  {
715  sample = m_blackLevel; // black
716  }
718  {
719  sample = 0.0f; // ultra-black
720  }
721  else
722  {
723  sample = m_blackLevel; // black
724  }
725  }
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_pointsPerFSync
number of line points for the field first sync
Definition: atvmod.h:476
int m_nbHorizPoints
number of line points per horizontal line
Definition: atvmod.h:484
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
static const float m_blackLevel
Definition: atvmod.h:549
+ Here is the caller graph for this function:

◆ pullVSyncLineEqualizingThenLongPulses()

void ATVMod::pullVSyncLineEqualizingThenLongPulses ( Real sample)
inlineprivate

Definition at line 727 of file atvmod.h.

References m_blackLevel.

Referenced by pullVSyncLine().

728  {
730  {
731  sample = 0.0f; // ultra-black
732  }
733  else if (m_horizontalCount < (m_nbHorizPoints/2))
734  {
735  sample = m_blackLevel; // black
736  }
738  {
739  sample = 0.0f; // ultra-black
740  }
741  else
742  {
743  sample = m_blackLevel; // black
744  }
745  }
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_nbHorizPoints
number of line points per horizontal line
Definition: atvmod.h:484
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
static const float m_blackLevel
Definition: atvmod.h:549
+ Here is the caller graph for this function:

◆ pullVSyncLineLongPulses()

void ATVMod::pullVSyncLineLongPulses ( Real sample)
inlineprivate

Definition at line 689 of file atvmod.h.

References m_blackLevel, and m_pointsPerSync.

Referenced by pullVSyncLine().

690  {
691  int halfIndex = m_horizontalCount % (m_nbHorizPoints/2);
692 
693  if (halfIndex < (m_nbHorizPoints/2) - m_pointsPerSync) // ultra-black
694  {
695  sample = 0.0f;
696  }
697  else // black
698  {
700  sample = 0.0f;
701  } else {
702  sample = m_blackLevel;
703  }
704  }
705  }
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_nbHorizPoints
number of line points per horizontal line
Definition: atvmod.h:484
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
bool m_singleLongSync
single or double long sync per long sync line
Definition: atvmod.h:491
static const float m_blackLevel
Definition: atvmod.h:549
+ Here is the caller graph for this function:

◆ pullVSyncLineLongThenEqualizingPulses()

void ATVMod::pullVSyncLineLongThenEqualizingPulses ( Real sample)
inlineprivate

Definition at line 747 of file atvmod.h.

References m_blackLevel.

Referenced by pullVSyncLine().

748  {
750  {
751  sample = 0.0f; // ultra-black
752  }
753  else if (m_horizontalCount < (m_nbHorizPoints/2))
754  {
755  sample = m_blackLevel; // black
756  }
758  {
759  sample = 0.0f; // ultra-black
760  }
761  else
762  {
763  sample = m_blackLevel; // black
764  }
765  }
int m_pointsPerSync
number of line points for the horizontal sync
Definition: atvmod.h:472
int m_pointsPerFSync
number of line points for the field first sync
Definition: atvmod.h:476
int m_nbHorizPoints
number of line points per horizontal line
Definition: atvmod.h:484
int m_horizontalCount
current point index on line
Definition: atvmod.h:499
static const float m_blackLevel
Definition: atvmod.h:549
+ Here is the caller graph for this function:

◆ releaseCameras()

void ATVMod::releaseCameras ( )
private

Definition at line 982 of file atvmod.cpp.

References m_cameras.

Referenced by ~ATVMod().

983 {
984  for (std::vector<ATVCamera>::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it)
985  {
986  if (it->m_camera.isOpened()) it->m_camera.release();
987  }
988 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
+ Here is the caller graph for this function:

◆ resizeCamera()

void ATVMod::resizeCamera ( )
private

Definition at line 923 of file atvmod.cpp.

References m_cameraIndex, m_cameras, ATVMod::ATVCamera::m_videoFrame, ATVMod::ATVCamera::m_videoframeOriginal, ATVMod::ATVCamera::m_videoFx, and ATVMod::ATVCamera::m_videoFy.

Referenced by pullVideo().

924 {
925  ATVCamera& camera = m_cameras[m_cameraIndex];
926 
927  if (!camera.m_videoframeOriginal.empty()) {
928  cv::resize(camera.m_videoframeOriginal, camera.m_videoFrame, cv::Size(), camera.m_videoFx, camera.m_videoFy); // resize current frame
929  }
930 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
+ Here is the caller graph for this function:

◆ resizeCameras()

void ATVMod::resizeCameras ( )
private

Definition at line 913 of file atvmod.cpp.

References m_cameras.

914 {
915  for (std::vector<ATVCamera>::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it)
916  {
917  if (!it->m_videoframeOriginal.empty()) {
918  cv::resize(it->m_videoframeOriginal, it->m_videoFrame, cv::Size(), it->m_videoFx, it->m_videoFy); // resize current frame
919  }
920  }
921 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528

◆ resizeImage()

void ATVMod::resizeImage ( )
private

Definition at line 872 of file atvmod.cpp.

References m_image, m_imageOriginal, m_nbBlankLines, m_nbImageLines, and m_pointsPerImgLine.

Referenced by applySettings(), applyStandard(), and openImage().

873 {
874  float fy = (m_nbImageLines - 2*m_nbBlankLines) / (float) m_imageOriginal.rows;
875  float fx = m_pointsPerImgLine / (float) m_imageOriginal.cols;
876  cv::resize(m_imageOriginal, m_image, cv::Size(), fx, fy);
877  qDebug("ATVMod::resizeImage: %d x %d -> %d x %d", m_imageOriginal.cols, m_imageOriginal.rows, m_image.cols, m_image.rows);
878 }
cv::Mat m_imageOriginal
original not resized image
Definition: atvmod.h:509
int m_pointsPerImgLine
number of line points for the image line
Definition: atvmod.h:474
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
Definition: atvmod.h:492
uint32_t m_nbImageLines
number of image lines excluding synchronization lines
Definition: atvmod.h:482
cv::Mat m_image
resized image for transmission at given rate
Definition: atvmod.h:510
+ Here is the caller graph for this function:

◆ resizeVideo()

void ATVMod::resizeVideo ( )
private

Definition at line 891 of file atvmod.cpp.

References m_videoFrame, m_videoframeOriginal, m_videoFx, and m_videoFy.

Referenced by applyStandard(), and pullVideo().

892 {
893  if (!m_videoframeOriginal.empty()) {
894  cv::resize(m_videoframeOriginal, m_videoFrame, cv::Size(), m_videoFx, m_videoFy); // resize current frame
895  }
896 }
float m_videoFy
current video vertictal scaling factor
Definition: atvmod.h:520
float m_videoFx
current video horizontal scaling factor
Definition: atvmod.h:519
cv::Mat m_videoFrame
current displayable video frame
Definition: atvmod.h:515
cv::Mat m_videoframeOriginal
current frame from video
Definition: atvmod.h:514
+ Here is the caller graph for this function:

◆ scanCameras()

void ATVMod::scanCameras ( )
private

Definition at line 946 of file atvmod.cpp.

References calculateCamerasSizes(), i, m_cameraIndex, and m_cameras.

Referenced by ATVMod().

947 {
948  for (int i = 0; i < 4; i++)
949  {
950  ATVCamera newCamera;
951  m_cameras.push_back(newCamera);
952  m_cameras.back().m_cameraNumber = i;
953  m_cameras.back().m_camera.open(i);
954 
955  if (m_cameras.back().m_camera.isOpened())
956  {
957  m_cameras.back().m_videoFPS = m_cameras.back().m_camera.get(CV_CAP_PROP_FPS);
958  m_cameras.back().m_videoWidth = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_WIDTH);
959  m_cameras.back().m_videoHeight = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_HEIGHT);
960 
961  //m_cameras.back().m_videoFPS = m_cameras.back().m_videoFPS < 0 ? 16.3f : m_cameras.back().m_videoFPS;
962 
963  qDebug("ATVMod::scanCameras: [%d] FPS: %f %dx%d",
964  i,
965  m_cameras.back().m_videoFPS,
966  m_cameras.back().m_videoWidth ,
967  m_cameras.back().m_videoHeight);
968  }
969  else
970  {
971  m_cameras.pop_back();
972  }
973  }
974 
975  if (m_cameras.size() > 0)
976  {
978  m_cameraIndex = 0;
979  }
980 }
std::vector< ATVCamera > m_cameras
vector of available cameras
Definition: atvmod.h:528
int m_cameraIndex
curent camera index in list of available cameras
Definition: atvmod.h:529
void calculateCamerasSizes()
Definition: atvmod.cpp:898
int32_t i
Definition: decimators.h:244
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ seekVideoFileStream()

void ATVMod::seekVideoFileStream ( int  seekPercentage)
private

Definition at line 932 of file atvmod.cpp.

References m_settingsMutex, m_video, m_videoEOF, m_videoFPSCount, m_videoFPSq, m_videoLength, m_videoOK, and m_videoPrevFPSCount.

Referenced by handleMessage(), and pullVideo().

933 {
934  QMutexLocker mutexLocker(&m_settingsMutex);
935 
936  if ((m_videoOK) && m_video.isOpened())
937  {
938  int seekPoint = ((m_videoLength * seekPercentage) / 100);
939  m_video.set(CV_CAP_PROP_POS_FRAMES, seekPoint);
942  m_videoEOF = false;
943  }
944 }
int m_videoLength
current video length in frames
Definition: atvmod.h:524
int m_videoPrevFPSCount
current video FPS previous integer counter
Definition: atvmod.h:523
QMutex m_settingsMutex
Definition: atvmod.h:498
cv::VideoCapture m_video
current video capture
Definition: atvmod.h:513
float m_videoFPSCount
current video FPS fractional counter
Definition: atvmod.h:522
bool m_videoEOF
current video has reached end of file
Definition: atvmod.h:525
bool m_videoOK
Definition: atvmod.h:526
float m_videoFPSq
current video FPS sacaling factor
Definition: atvmod.h:521
+ Here is the caller graph for this function:

◆ serialize()

QByteArray ATVMod::serialize ( ) const
virtual

Implements ChannelAPI.

Definition at line 1253 of file atvmod.cpp.

References m_settings, and ATVModSettings::serialize().

Referenced by getCenterFrequency().

1254 {
1255  return m_settings.serialize();
1256 }
QByteArray serialize() const
ATVModSettings m_settings
Definition: atvmod.h:462
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void ATVMod::start ( )
virtual

Implements BasebandSampleSource.

Definition at line 509 of file atvmod.cpp.

References applyChannelSettings(), ATVModSettings::m_inputFrequencyOffset, m_inputFrequencyOffset, m_outputSampleRate, and m_settings.

Referenced by destroy(), and pullVideo().

510 {
511  qDebug() << "ATVMod::start: m_outputSampleRate: " << m_outputSampleRate
512  << " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
514 }
qint64 m_inputFrequencyOffset
offset from baseband center frequency
ATVModSettings m_settings
Definition: atvmod.h:462
int m_outputSampleRate
Definition: atvmod.h:460
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: atvmod.cpp:1033
int m_inputFrequencyOffset
Definition: atvmod.h:461
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void ATVMod::stop ( )
virtual

Implements BasebandSampleSource.

Definition at line 516 of file atvmod.cpp.

Referenced by destroy().

517 {
518 }
+ Here is the caller graph for this function:

◆ webapiFormatChannelReport()

void ATVMod::webapiFormatChannelReport ( SWGSDRangel::SWGChannelReport response)
private

Definition at line 1496 of file atvmod.cpp.

References CalcDb::dbPower(), SWGSDRangel::SWGChannelReport::getAtvModReport(), getMagSq(), m_outputSampleRate, SWGSDRangel::SWGATVModReport::setChannelPowerDb(), and SWGSDRangel::SWGATVModReport::setChannelSampleRate().

Referenced by webapiReportGet().

1497 {
1500 }
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
void setChannelSampleRate(qint32 channel_sample_rate)
SWGATVModReport * getAtvModReport()
double getMagSq() const
Definition: atvmod.h:400
int m_outputSampleRate
Definition: atvmod.h:460
void setChannelPowerDb(float channel_power_db)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatChannelSettings()

void ATVMod::webapiFormatChannelSettings ( SWGSDRangel::SWGChannelSettings response,
const ATVModSettings settings 
)
private

Definition at line 1436 of file atvmod.cpp.

References SWGSDRangel::SWGChannelSettings::getAtvModSettings(), SWGSDRangel::SWGATVModSettings::getImageFileName(), SWGSDRangel::SWGATVModSettings::getOverlayText(), SWGSDRangel::SWGATVModSettings::getReverseApiAddress(), SWGSDRangel::SWGATVModSettings::getTitle(), SWGSDRangel::SWGATVModSettings::getVideoFileName(), ATVModSettings::m_atvModInput, ATVModSettings::m_atvModulation, ATVModSettings::m_atvStd, ATVModSettings::m_cameraPlay, ATVModSettings::m_channelMute, ATVModSettings::m_fmExcursion, ATVModSettings::m_forceDecimator, ATVModSettings::m_fps, m_imageFileName, ATVModSettings::m_inputFrequencyOffset, ATVModSettings::m_invertedVideo, ATVModSettings::m_nbLines, ATVModSettings::m_overlayText, ATVModSettings::m_reverseAPIAddress, ATVModSettings::m_reverseAPIChannelIndex, ATVModSettings::m_reverseAPIDeviceIndex, ATVModSettings::m_reverseAPIPort, ATVModSettings::m_rfBandwidth, ATVModSettings::m_rfOppBandwidth, ATVModSettings::m_rfScalingFactor, ATVModSettings::m_rgbColor, ATVModSettings::m_showOverlayText, ATVModSettings::m_title, ATVModSettings::m_uniformLevel, ATVModSettings::m_useReverseAPI, m_videoFileName, ATVModSettings::m_videoPlay, ATVModSettings::m_videoPlayLoop, SWGSDRangel::SWGATVModSettings::setAtvModInput(), SWGSDRangel::SWGATVModSettings::setAtvModulation(), SWGSDRangel::SWGATVModSettings::setAtvStd(), SWGSDRangel::SWGATVModSettings::setCameraPlay(), SWGSDRangel::SWGATVModSettings::setChannelMute(), SWGSDRangel::SWGATVModSettings::setFmExcursion(), SWGSDRangel::SWGATVModSettings::setForceDecimator(), SWGSDRangel::SWGATVModSettings::setFps(), SWGSDRangel::SWGATVModSettings::setImageFileName(), SWGSDRangel::SWGATVModSettings::setInputFrequencyOffset(), SWGSDRangel::SWGATVModSettings::setInvertedVideo(), SWGSDRangel::SWGATVModSettings::setNbLines(), SWGSDRangel::SWGATVModSettings::setOverlayText(), SWGSDRangel::SWGATVModSettings::setReverseApiAddress(), SWGSDRangel::SWGATVModSettings::setReverseApiChannelIndex(), SWGSDRangel::SWGATVModSettings::setReverseApiDeviceIndex(), SWGSDRangel::SWGATVModSettings::setReverseApiPort(), SWGSDRangel::SWGATVModSettings::setRfBandwidth(), SWGSDRangel::SWGATVModSettings::setRfOppBandwidth(), SWGSDRangel::SWGATVModSettings::setRfScalingFactor(), SWGSDRangel::SWGATVModSettings::setRgbColor(), SWGSDRangel::SWGATVModSettings::setShowOverlayText(), SWGSDRangel::SWGATVModSettings::setTitle(), SWGSDRangel::SWGATVModSettings::setUniformLevel(), SWGSDRangel::SWGATVModSettings::setUseReverseApi(), SWGSDRangel::SWGATVModSettings::setVideoFileName(), SWGSDRangel::SWGATVModSettings::setVideoPlay(), and SWGSDRangel::SWGATVModSettings::setVideoPlayLoop().

Referenced by webapiSettingsGet(), and webapiSettingsPutPatch().

1437 {
1439  response.getAtvModSettings()->setRfBandwidth(settings.m_rfBandwidth);
1441  response.getAtvModSettings()->setAtvStd(settings.m_atvStd);
1442  response.getAtvModSettings()->setNbLines(settings.m_nbLines);
1443  response.getAtvModSettings()->setFps(settings.m_fps);
1444  response.getAtvModSettings()->setAtvModInput(settings.m_atvModInput);
1445  response.getAtvModSettings()->setUniformLevel(settings.m_uniformLevel);
1446  response.getAtvModSettings()->setAtvModulation(settings.m_atvModulation);
1447  response.getAtvModSettings()->setVideoPlayLoop(settings.m_videoPlayLoop ? 1 : 0);
1448  response.getAtvModSettings()->setVideoPlay(settings.m_videoPlay ? 1 : 0);
1449  response.getAtvModSettings()->setCameraPlay(settings.m_cameraPlay ? 1 : 0);
1450  response.getAtvModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
1451  response.getAtvModSettings()->setInvertedVideo(settings.m_invertedVideo ? 1 : 0);
1453  response.getAtvModSettings()->setFmExcursion(settings.m_fmExcursion);
1454  response.getAtvModSettings()->setForceDecimator(settings.m_forceDecimator ? 1 : 0);
1455  response.getAtvModSettings()->setShowOverlayText(settings.m_showOverlayText ? 1 : 0);
1456 
1457  if (response.getAtvModSettings()->getOverlayText()) {
1458  *response.getAtvModSettings()->getOverlayText() = settings.m_overlayText;
1459  } else {
1460  response.getAtvModSettings()->setOverlayText(new QString(settings.m_overlayText));
1461  }
1462 
1463  response.getAtvModSettings()->setRgbColor(settings.m_rgbColor);
1464 
1465  if (response.getAtvModSettings()->getTitle()) {
1466  *response.getAtvModSettings()->getTitle() = settings.m_title;
1467  } else {
1468  response.getAtvModSettings()->setTitle(new QString(settings.m_title));
1469  }
1470 
1471  if (response.getAtvModSettings()->getImageFileName()) {
1473  } else {
1474  response.getAtvModSettings()->setImageFileName(new QString(m_imageFileName));
1475  }
1476 
1477  if (response.getAtvModSettings()->getVideoFileName()) {
1479  } else {
1480  response.getAtvModSettings()->setVideoFileName(new QString(m_videoFileName));
1481  }
1482 
1483  response.getAtvModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
1484 
1485  if (response.getAtvModSettings()->getReverseApiAddress()) {
1487  } else {
1488  response.getAtvModSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
1489  }
1490 
1494 }
float m_rfScalingFactor
Scaling factor from +/-1 to +/-2^15.
void setUseReverseApi(qint32 use_reverse_api)
void setInvertedVideo(qint32 inverted_video)
void setCameraPlay(qint32 camera_play)
ATVModulation m_atvModulation
RF modulation type.
uint16_t m_reverseAPIDeviceIndex
int m_nbLines
Number of lines per full frame.
QString m_videoFileName
Definition: atvmod.h:533
void setAtvModInput(qint32 atv_mod_input)
void setOverlayText(QString *overlay_text)
void setReverseApiAddress(QString *reverse_api_address)
void setFmExcursion(float fm_excursion)
void setUniformLevel(float uniform_level)
void setVideoPlay(qint32 video_play)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setShowOverlayText(qint32 show_overlay_text)
void setForceDecimator(qint32 force_decimator)
quint32 m_rgbColor
void setVideoFileName(QString *video_file_name)
void setRfOppBandwidth(float rf_opp_bandwidth)
void setRfBandwidth(float rf_bandwidth)
qint64 m_inputFrequencyOffset
offset from baseband center frequency
QString m_overlayText
bool m_channelMute
Mute channel baseband output.
bool m_forceDecimator
Forces decimator even when channel and source sample rates are equal.
void setImageFileName(QString *image_file_name)
void setVideoPlayLoop(qint32 video_play_loop)
int m_fps
Number of frames per second.
uint16_t m_reverseAPIChannelIndex
SWGATVModSettings * getAtvModSettings()
void setRgbColor(qint32 rgb_color)
QString m_reverseAPIAddress
void setInputFrequencyOffset(qint64 input_frequency_offset)
float m_fmExcursion
FM excursion factor relative to full bandwidth.
bool m_showOverlayText
Show overlay text on image.
bool m_invertedVideo
True if video signal is inverted before modulation.
void setChannelMute(qint32 channel_mute)
ATVStd m_atvStd
Standard.
void setAtvModulation(qint32 atv_modulation)
ATVModInput m_atvModInput
Input source type.
QString m_imageFileName
Definition: atvmod.h:532
bool m_videoPlay
True to play video and false to pause.
bool m_cameraPlay
True to play camera video and false to pause.
Real m_uniformLevel
Percentage between black and white for uniform screen display.
void setRfScalingFactor(float rf_scaling_factor)
Real m_rfBandwidth
Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB.
void setReverseApiPort(qint32 reverse_api_port)
uint16_t m_reverseAPIPort
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
Real m_rfOppBandwidth
Bandwidth of opposite sideband for vestigial SSB.
bool m_videoPlayLoop
Play video in a loop.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReportGet()

int ATVMod::webapiReportGet ( SWGSDRangel::SWGChannelReport response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 1425 of file atvmod.cpp.

References SWGSDRangel::SWGChannelReport::getAtvModReport(), SWGSDRangel::SWGATVModReport::init(), SWGSDRangel::SWGChannelReport::setAtvModReport(), and webapiFormatChannelReport().

Referenced by getStreamCenterFrequency().

1428 {
1429  (void) errorMessage;
1431  response.getAtvModReport()->init();
1432  webapiFormatChannelReport(response);
1433  return 200;
1434 }
void setAtvModReport(SWGATVModReport *atv_mod_report)
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport &response)
Definition: atvmod.cpp:1496
SWGATVModReport * getAtvModReport()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendSettings()

void ATVMod::webapiReverseSendSettings ( QList< QString > &  channelSettingsKeys,
const ATVModSettings settings,
bool  force 
)
private

Definition at line 1502 of file atvmod.cpp.

References SWGSDRangel::SWGChannelSettings::asJson(), SWGSDRangel::SWGChannelSettings::getAtvModSettings(), ChannelAPI::getDeviceSetIndex(), ChannelAPI::getIndexInDeviceSet(), ATVModSettings::m_atvModInput, ATVModSettings::m_atvModulation, ATVModSettings::m_atvStd, ATVModSettings::m_cameraPlay, ATVModSettings::m_channelMute, ATVModSettings::m_fmExcursion, ATVModSettings::m_forceDecimator, ATVModSettings::m_fps, ATVModSettings::m_inputFrequencyOffset, ATVModSettings::m_invertedVideo, ATVModSettings::m_nbLines, m_networkManager, m_networkRequest, ATVModSettings::m_overlayText, ATVModSettings::m_reverseAPIAddress, ATVModSettings::m_reverseAPIChannelIndex, ATVModSettings::m_reverseAPIDeviceIndex, ATVModSettings::m_reverseAPIPort, ATVModSettings::m_rfBandwidth, ATVModSettings::m_rfOppBandwidth, ATVModSettings::m_rfScalingFactor, ATVModSettings::m_rgbColor, ATVModSettings::m_showOverlayText, ATVModSettings::m_title, ATVModSettings::m_uniformLevel, ATVModSettings::m_videoPlay, ATVModSettings::m_videoPlayLoop, SWGSDRangel::SWGATVModSettings::setAtvModInput(), SWGSDRangel::SWGChannelSettings::setAtvModSettings(), SWGSDRangel::SWGATVModSettings::setAtvModulation(), SWGSDRangel::SWGATVModSettings::setAtvStd(), SWGSDRangel::SWGATVModSettings::setCameraPlay(), SWGSDRangel::SWGATVModSettings::setChannelMute(), SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGChannelSettings::setDirection(), SWGSDRangel::SWGATVModSettings::setFmExcursion(), SWGSDRangel::SWGATVModSettings::setForceDecimator(), SWGSDRangel::SWGATVModSettings::setFps(), SWGSDRangel::SWGATVModSettings::setInputFrequencyOffset(), SWGSDRangel::SWGATVModSettings::setInvertedVideo(), SWGSDRangel::SWGATVModSettings::setNbLines(), SWGSDRangel::SWGChannelSettings::setOriginatorChannelIndex(), SWGSDRangel::SWGChannelSettings::setOriginatorDeviceSetIndex(), SWGSDRangel::SWGATVModSettings::setOverlayText(), SWGSDRangel::SWGATVModSettings::setRfBandwidth(), SWGSDRangel::SWGATVModSettings::setRfOppBandwidth(), SWGSDRangel::SWGATVModSettings::setRfScalingFactor(), SWGSDRangel::SWGATVModSettings::setRgbColor(), SWGSDRangel::SWGATVModSettings::setShowOverlayText(), SWGSDRangel::SWGATVModSettings::setTitle(), SWGSDRangel::SWGATVModSettings::setUniformLevel(), SWGSDRangel::SWGATVModSettings::setVideoPlay(), and SWGSDRangel::SWGATVModSettings::setVideoPlayLoop().

Referenced by applySettings().

1503 {
1505  swgChannelSettings->setDirection(1); // single source (Tx)
1506  swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
1507  swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
1508  swgChannelSettings->setChannelType(new QString("ATVMod"));
1509  swgChannelSettings->setAtvModSettings(new SWGSDRangel::SWGATVModSettings());
1510  SWGSDRangel::SWGATVModSettings *swgATVModSettings = swgChannelSettings->getAtvModSettings();
1511 
1512  // transfer data that has been modified. When force is on transfer all data except reverse API data
1513 
1514  if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
1515  swgATVModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
1516  }
1517  if (channelSettingsKeys.contains("rfBandwidth") || force) {
1518  swgATVModSettings->setRfBandwidth(settings.m_rfBandwidth);
1519  }
1520  if (channelSettingsKeys.contains("rfOppBandwidth") || force) {
1521  swgATVModSettings->setRfOppBandwidth(settings.m_rfOppBandwidth);
1522  }
1523  if (channelSettingsKeys.contains("atvStd") || force) {
1524  swgATVModSettings->setAtvStd((int) settings.m_atvStd);
1525  }
1526  if (channelSettingsKeys.contains("nbLines") || force) {
1527  swgATVModSettings->setNbLines(settings.m_nbLines);
1528  }
1529  if (channelSettingsKeys.contains("fps") || force) {
1530  swgATVModSettings->setFps(settings.m_fps);
1531  }
1532  if (channelSettingsKeys.contains("atvModInput") || force) {
1533  swgATVModSettings->setAtvModInput((int) settings.m_atvModInput);
1534  }
1535  if (channelSettingsKeys.contains("uniformLevel") || force) {
1536  swgATVModSettings->setUniformLevel(settings.m_uniformLevel);
1537  }
1538  if (channelSettingsKeys.contains("atvModulation") || force) {
1539  swgATVModSettings->setAtvModulation((int) settings.m_atvModulation);
1540  }
1541  if (channelSettingsKeys.contains("videoPlayLoop") || force) {
1542  swgATVModSettings->setVideoPlayLoop(settings.m_videoPlayLoop ? 1 : 0);
1543  }
1544  if (channelSettingsKeys.contains("videoPlay") || force) {
1545  swgATVModSettings->setVideoPlay(settings.m_videoPlay ? 1 : 0);
1546  }
1547  if (channelSettingsKeys.contains("cameraPlay") || force) {
1548  swgATVModSettings->setCameraPlay(settings.m_cameraPlay ? 1 : 0);
1549  }
1550  if (channelSettingsKeys.contains("channelMute") || force) {
1551  swgATVModSettings->setChannelMute(settings.m_channelMute ? 1 : 0);
1552  }
1553  if (channelSettingsKeys.contains("invertedVideo") || force) {
1554  swgATVModSettings->setInvertedVideo(settings.m_invertedVideo ? 1 : 0);
1555  }
1556  if (channelSettingsKeys.contains("rfScalingFactor") || force) {
1557  swgATVModSettings->setRfScalingFactor(settings.m_rfScalingFactor);
1558  }
1559  if (channelSettingsKeys.contains("fmExcursion") || force) {
1560  swgATVModSettings->setFmExcursion(settings.m_fmExcursion);
1561  }
1562  if (channelSettingsKeys.contains("forceDecimator") || force) {
1563  swgATVModSettings->setForceDecimator(settings.m_forceDecimator ? 1 : 0);
1564  }
1565  if (channelSettingsKeys.contains("showOverlayText") || force) {
1566  swgATVModSettings->setShowOverlayText(settings.m_showOverlayText ? 1 : 0);
1567  }
1568  if (channelSettingsKeys.contains("overlayText") || force) {
1569  swgATVModSettings->setOverlayText(new QString(settings.m_overlayText));
1570  }
1571  if (channelSettingsKeys.contains("rgbColor") || force) {
1572  swgATVModSettings->setRgbColor(settings.m_rgbColor);
1573  }
1574  if (channelSettingsKeys.contains("title") || force) {
1575  swgATVModSettings->setTitle(new QString(settings.m_title));
1576  }
1577 
1578  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
1579  .arg(settings.m_reverseAPIAddress)
1580  .arg(settings.m_reverseAPIPort)
1581  .arg(settings.m_reverseAPIDeviceIndex)
1582  .arg(settings.m_reverseAPIChannelIndex);
1583  m_networkRequest.setUrl(QUrl(channelSettingsURL));
1584  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
1585 
1586  QBuffer *buffer=new QBuffer();
1587  buffer->open((QBuffer::ReadWrite));
1588  buffer->write(swgChannelSettings->asJson().toUtf8());
1589  buffer->seek(0);
1590 
1591  // Always use PATCH to avoid passing reverse API settings
1592  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
1593 
1594  delete swgChannelSettings;
1595 }
void setOriginatorChannelIndex(qint32 originator_channel_index)
float m_rfScalingFactor
Scaling factor from +/-1 to +/-2^15.
void setInvertedVideo(qint32 inverted_video)
void setCameraPlay(qint32 camera_play)
ATVModulation m_atvModulation
RF modulation type.
uint16_t m_reverseAPIDeviceIndex
int m_nbLines
Number of lines per full frame.
void setAtvModInput(qint32 atv_mod_input)
void setOverlayText(QString *overlay_text)
int getDeviceSetIndex() const
Definition: channelapi.h:89
void setFmExcursion(float fm_excursion)
void setUniformLevel(float uniform_level)
void setVideoPlay(qint32 video_play)
void setShowOverlayText(qint32 show_overlay_text)
void setForceDecimator(qint32 force_decimator)
quint32 m_rgbColor
void setRfOppBandwidth(float rf_opp_bandwidth)
void setRfBandwidth(float rf_bandwidth)
void setChannelType(QString *channel_type)
qint64 m_inputFrequencyOffset
offset from baseband center frequency
void setOriginatorDeviceSetIndex(qint32 originator_device_set_index)
QString m_overlayText
bool m_channelMute
Mute channel baseband output.
QNetworkAccessManager * m_networkManager
Definition: atvmod.h:545
bool m_forceDecimator
Forces decimator even when channel and source sample rates are equal.
void setVideoPlayLoop(qint32 video_play_loop)
QNetworkRequest m_networkRequest
Definition: atvmod.h:546
int m_fps
Number of frames per second.
uint16_t m_reverseAPIChannelIndex
SWGATVModSettings * getAtvModSettings()
void setRgbColor(qint32 rgb_color)
QString m_reverseAPIAddress
void setInputFrequencyOffset(qint64 input_frequency_offset)
float m_fmExcursion
FM excursion factor relative to full bandwidth.
bool m_showOverlayText
Show overlay text on image.
bool m_invertedVideo
True if video signal is inverted before modulation.
void setChannelMute(qint32 channel_mute)
ATVStd m_atvStd
Standard.
virtual QString asJson() override
void setAtvModulation(qint32 atv_modulation)
ATVModInput m_atvModInput
Input source type.
bool m_videoPlay
True to play video and false to pause.
bool m_cameraPlay
True to play camera video and false to pause.
Real m_uniformLevel
Percentage between black and white for uniform screen display.
void setRfScalingFactor(float rf_scaling_factor)
void setAtvModSettings(SWGATVModSettings *atv_mod_settings)
Real m_rfBandwidth
Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB.
int getIndexInDeviceSet() const
Definition: channelapi.h:87
uint16_t m_reverseAPIPort
Real m_rfOppBandwidth
Bandwidth of opposite sideband for vestigial SSB.
bool m_videoPlayLoop
Play video in a loop.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsGet()

int ATVMod::webapiSettingsGet ( SWGSDRangel::SWGChannelSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 1275 of file atvmod.cpp.

References SWGSDRangel::SWGChannelSettings::getAtvModSettings(), SWGSDRangel::SWGATVModSettings::init(), m_settings, SWGSDRangel::SWGChannelSettings::setAtvModSettings(), and webapiFormatChannelSettings().

Referenced by getStreamCenterFrequency().

1278 {
1279  (void) errorMessage;
1281  response.getAtvModSettings()->init();
1283  return 200;
1284 }
ATVModSettings m_settings
Definition: atvmod.h:462
SWGATVModSettings * getAtvModSettings()
void setAtvModSettings(SWGATVModSettings *atv_mod_settings)
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const ATVModSettings &settings)
Definition: atvmod.cpp:1436
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

int ATVMod::webapiSettingsPutPatch ( bool  force,
const QStringList &  channelSettingsKeys,
SWGSDRangel::SWGChannelSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 1286 of file atvmod.cpp.

References ATVMod::MsgConfigureATVMod::create(), ATVMod::MsgConfigureChannelizer::create(), ATVMod::MsgConfigureImageFileName::create(), ATVMod::MsgConfigureVideoFileName::create(), SWGSDRangel::SWGATVModSettings::getAtvModInput(), SWGSDRangel::SWGChannelSettings::getAtvModSettings(), SWGSDRangel::SWGATVModSettings::getAtvModulation(), SWGSDRangel::SWGATVModSettings::getAtvStd(), SWGSDRangel::SWGATVModSettings::getCameraPlay(), SWGSDRangel::SWGATVModSettings::getChannelMute(), SWGSDRangel::SWGATVModSettings::getFmExcursion(), SWGSDRangel::SWGATVModSettings::getForceDecimator(), SWGSDRangel::SWGATVModSettings::getFps(), SWGSDRangel::SWGATVModSettings::getImageFileName(), SWGSDRangel::SWGATVModSettings::getInputFrequencyOffset(), SWGSDRangel::SWGATVModSettings::getInvertedVideo(), SWGSDRangel::SWGATVModSettings::getNbLines(), SWGSDRangel::SWGATVModSettings::getOverlayText(), SWGSDRangel::SWGATVModSettings::getReverseApiAddress(), SWGSDRangel::SWGATVModSettings::getReverseApiChannelIndex(), SWGSDRangel::SWGATVModSettings::getReverseApiDeviceIndex(), SWGSDRangel::SWGATVModSettings::getReverseApiPort(), SWGSDRangel::SWGATVModSettings::getRfBandwidth(), SWGSDRangel::SWGATVModSettings::getRfOppBandwidth(), SWGSDRangel::SWGATVModSettings::getRfScalingFactor(), SWGSDRangel::SWGATVModSettings::getRgbColor(), SWGSDRangel::SWGATVModSettings::getShowOverlayText(), SWGSDRangel::SWGATVModSettings::getTitle(), SWGSDRangel::SWGATVModSettings::getUniformLevel(), SWGSDRangel::SWGATVModSettings::getUseReverseApi(), SWGSDRangel::SWGATVModSettings::getVideoFileName(), SWGSDRangel::SWGATVModSettings::getVideoPlay(), SWGSDRangel::SWGATVModSettings::getVideoPlayLoop(), ATVModSettings::m_atvModInput, ATVModSettings::m_atvModulation, ATVModSettings::m_atvStd, ATVModSettings::m_cameraPlay, ATVModSettings::m_channelMute, ATVModSettings::m_fmExcursion, ATVModSettings::m_forceDecimator, ATVModSettings::m_fps, BasebandSampleSource::m_guiMessageQueue, ATVModSettings::m_inputFrequencyOffset, BasebandSampleSource::m_inputMessageQueue, ATVModSettings::m_invertedVideo, ATVModSettings::m_nbLines, ATVModSettings::m_overlayText, ATVModSettings::m_reverseAPIAddress, ATVModSettings::m_reverseAPIChannelIndex, ATVModSettings::m_reverseAPIDeviceIndex, ATVModSettings::m_reverseAPIPort, ATVModSettings::m_rfBandwidth, ATVModSettings::m_rfOppBandwidth, ATVModSettings::m_rfScalingFactor, ATVModSettings::m_rgbColor, m_settings, ATVModSettings::m_showOverlayText, ATVModSettings::m_title, ATVModSettings::m_uniformLevel, ATVModSettings::m_useReverseAPI, ATVModSettings::m_videoPlay, ATVModSettings::m_videoPlayLoop, MessageQueue::push(), and webapiFormatChannelSettings().

Referenced by getStreamCenterFrequency().

1291 {
1292  (void) errorMessage;
1293  ATVModSettings settings = m_settings;
1294  bool frequencyOffsetChanged = false;
1295 
1296  if (channelSettingsKeys.contains("inputFrequencyOffset"))
1297  {
1299  frequencyOffsetChanged = true;
1300  }
1301  if (channelSettingsKeys.contains("rfBandwidth")) {
1302  settings.m_rfBandwidth = response.getAtvModSettings()->getRfBandwidth();
1303  }
1304  if (channelSettingsKeys.contains("rfOppBandwidth")) {
1305  settings.m_rfOppBandwidth = response.getAtvModSettings()->getRfOppBandwidth();
1306  }
1307  if (channelSettingsKeys.contains("atvStd")) {
1308  settings.m_atvStd = (ATVModSettings::ATVStd) response.getAtvModSettings()->getAtvStd();
1309  }
1310  if (channelSettingsKeys.contains("nbLines")) {
1311  settings.m_nbLines = response.getAtvModSettings()->getNbLines();
1312  }
1313  if (channelSettingsKeys.contains("fps")) {
1314  settings.m_fps = response.getAtvModSettings()->getFps();
1315  }
1316  if (channelSettingsKeys.contains("atvModInput")) {
1318  }
1319  if (channelSettingsKeys.contains("uniformLevel")) {
1320  settings.m_uniformLevel = response.getAtvModSettings()->getUniformLevel();
1321  }
1322  if (channelSettingsKeys.contains("atvModulation")) {
1324  }
1325  if (channelSettingsKeys.contains("videoPlayLoop")) {
1326  settings.m_videoPlayLoop = response.getAtvModSettings()->getVideoPlayLoop() != 0;
1327  }
1328  if (channelSettingsKeys.contains("videoPlay")) {
1329  settings.m_videoPlay = response.getAtvModSettings()->getVideoPlay() != 0;
1330  }
1331  if (channelSettingsKeys.contains("cameraPlay")) {
1332  settings.m_cameraPlay = response.getAtvModSettings()->getCameraPlay() != 0;
1333  }
1334  if (channelSettingsKeys.contains("channelMute")) {
1335  settings.m_channelMute = response.getAtvModSettings()->getChannelMute() != 0;
1336  }
1337  if (channelSettingsKeys.contains("invertedVideo")) {
1338  settings.m_invertedVideo = response.getAtvModSettings()->getInvertedVideo() != 0;
1339  }
1340  if (channelSettingsKeys.contains("rfScalingFactor")) {
1341  settings.m_rfScalingFactor = response.getAtvModSettings()->getRfScalingFactor();
1342  }
1343  if (channelSettingsKeys.contains("fmExcursion")) {
1344  settings.m_fmExcursion = response.getAtvModSettings()->getFmExcursion();
1345  }
1346  if (channelSettingsKeys.contains("forceDecimator")) {
1347  settings.m_forceDecimator = response.getAtvModSettings()->getForceDecimator() != 0;
1348  }
1349  if (channelSettingsKeys.contains("showOverlayText")) {
1350  settings.m_showOverlayText = response.getAtvModSettings()->getShowOverlayText() != 0;
1351  }
1352  if (channelSettingsKeys.contains("overlayText")) {
1353  settings.m_overlayText = *response.getAtvModSettings()->getOverlayText();
1354  }
1355  if (channelSettingsKeys.contains("rgbColor")) {
1356  settings.m_rgbColor = response.getAtvModSettings()->getRgbColor();
1357  }
1358  if (channelSettingsKeys.contains("title")) {
1359  settings.m_title = *response.getAtvModSettings()->getTitle();
1360  }
1361  if (channelSettingsKeys.contains("useReverseAPI")) {
1362  settings.m_useReverseAPI = response.getAtvModSettings()->getUseReverseApi() != 0;
1363  }
1364  if (channelSettingsKeys.contains("reverseAPIAddress")) {
1366  }
1367  if (channelSettingsKeys.contains("reverseAPIPort")) {
1368  settings.m_reverseAPIPort = response.getAtvModSettings()->getReverseApiPort();
1369  }
1370  if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
1372  }
1373  if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
1375  }
1376  if (frequencyOffsetChanged)
1377  {
1379  settings.m_inputFrequencyOffset);
1380  m_inputMessageQueue.push(msgChan);
1381  }
1382 
1383  MsgConfigureATVMod *msg = MsgConfigureATVMod::create(settings, force);
1385 
1386  if (m_guiMessageQueue) // forward to GUI if any
1387  {
1388  MsgConfigureATVMod *msgToGUI = MsgConfigureATVMod::create(settings, force);
1389  m_guiMessageQueue->push(msgToGUI);
1390  }
1391 
1392  if (channelSettingsKeys.contains("imageFileName"))
1393  {
1394  MsgConfigureImageFileName *msg = MsgConfigureImageFileName::create(
1395  *response.getAtvModSettings()->getImageFileName());
1397 
1398  if (m_guiMessageQueue) // forward to GUI if any
1399  {
1400  MsgConfigureImageFileName *msgToGUI = MsgConfigureImageFileName::create(
1401  *response.getAtvModSettings()->getImageFileName());
1402  m_guiMessageQueue->push(msgToGUI);
1403  }
1404  }
1405 
1406  if (channelSettingsKeys.contains("videoFileName"))
1407  {
1408  MsgConfigureVideoFileName *msg = MsgConfigureVideoFileName::create(
1409  *response.getAtvModSettings()->getVideoFileName());
1411 
1412  if (m_guiMessageQueue) // forward to GUI if any
1413  {
1414  MsgConfigureVideoFileName *msgToGUI = MsgConfigureVideoFileName::create(
1415  *response.getAtvModSettings()->getVideoFileName());
1416  m_guiMessageQueue->push(msgToGUI);
1417  }
1418  }
1419 
1420  webapiFormatChannelSettings(response, settings);
1421 
1422  return 200;
1423 }
float m_rfScalingFactor
Scaling factor from +/-1 to +/-2^15.
static MsgConfigureVideoFileName * create(const QString &fileName)
Definition: atvmod.h:124
void push(Message *message, bool emitSignal=true)
Push message onto queue.
ATVModulation m_atvModulation
RF modulation type.
uint16_t m_reverseAPIDeviceIndex
int m_nbLines
Number of lines per full frame.
static MsgConfigureImageFileName * create(const QString &fileName)
Definition: atvmod.h:103
quint32 m_rgbColor
qint64 m_inputFrequencyOffset
offset from baseband center frequency
QString m_overlayText
bool m_channelMute
Mute channel baseband output.
bool m_forceDecimator
Forces decimator even when channel and source sample rates are equal.
int m_fps
Number of frames per second.
uint16_t m_reverseAPIChannelIndex
ATVModSettings m_settings
Definition: atvmod.h:462
SWGATVModSettings * getAtvModSettings()
QString m_reverseAPIAddress
float m_fmExcursion
FM excursion factor relative to full bandwidth.
bool m_showOverlayText
Show overlay text on image.
bool m_invertedVideo
True if video signal is inverted before modulation.
ATVStd m_atvStd
Standard.
static MsgConfigureATVMod * create(const ATVModSettings &settings, bool force)
Definition: atvmod.h:60
ATVModInput m_atvModInput
Input source type.
bool m_videoPlay
True to play video and false to pause.
bool m_cameraPlay
True to play camera video and false to pause.
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
Real m_uniformLevel
Percentage between black and white for uniform screen display.
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
Real m_rfBandwidth
Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB.
uint16_t m_reverseAPIPort
static MsgConfigureChannelizer * create(int centerFrequency)
Definition: atvmod.h:82
Real m_rfOppBandwidth
Bandwidth of opposite sideband for vestigial SSB.
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const ATVModSettings &settings)
Definition: atvmod.cpp:1436
bool m_videoPlayLoop
Play video in a loop.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_blackLevel

const float ATVMod::m_blackLevel = 0.3f
staticprivate

◆ m_blankLineLvel

float ATVMod::m_blankLineLvel
private

video level of blank lines

Definition at line 493 of file atvmod.h.

Referenced by applyStandard(), and pullVSyncLine().

◆ m_cameraFPSTestNbFrames

const int ATVMod::m_cameraFPSTestNbFrames = 100
staticprivate

number of frames for camera FPS test

Definition at line 553 of file atvmod.h.

Referenced by pullVideo().

◆ m_cameraIndex

int ATVMod::m_cameraIndex
private

curent camera index in list of available cameras

Definition at line 529 of file atvmod.h.

Referenced by getCameraNumbers(), handleMessage(), pullImageLine(), pullVideo(), resizeCamera(), and scanCameras().

◆ m_cameras

std::vector<ATVCamera> ATVMod::m_cameras
private

vector of available cameras

Definition at line 528 of file atvmod.h.

Referenced by calculateCamerasSizes(), getCameraNumbers(), handleMessage(), pullVideo(), releaseCameras(), resizeCamera(), resizeCameras(), and scanCameras().

◆ m_carrierNco

NCO ATVMod::m_carrierNco
private

Definition at line 464 of file atvmod.h.

Referenced by applyChannelSettings(), and pullFinalize().

◆ m_channelId

const QString ATVMod::m_channelId = "ATVMod"
static

Definition at line 407 of file atvmod.h.

Referenced by ATVMod(), and ATVModPlugin::initPlugin().

◆ m_channelIdURI

const QString ATVMod::m_channelIdURI = "sdrangel.channeltx.modatv"
static

Definition at line 406 of file atvmod.h.

Referenced by ATVModGUI::ATVModGUI(), and ATVModPlugin::initPlugin().

◆ m_channelizer

UpChannelizer* ATVMod::m_channelizer
private

Definition at line 458 of file atvmod.h.

Referenced by ATVMod(), handleMessage(), and ~ATVMod().

◆ m_deviceAPI

DeviceAPI* ATVMod::m_deviceAPI
private

Definition at line 456 of file atvmod.h.

Referenced by ATVMod(), and ~ATVMod().

◆ m_DSBFilter

fftfilt* ATVMod::m_DSBFilter
private

Definition at line 541 of file atvmod.h.

Referenced by applySettings(), ATVMod(), modulateVestigialSSB(), and ~ATVMod().

◆ m_DSBFilterBuffer

Complex* ATVMod::m_DSBFilterBuffer
private

Definition at line 542 of file atvmod.h.

Referenced by applySettings(), ATVMod(), modulateVestigialSSB(), and ~ATVMod().

◆ m_DSBFilterBufferIndex

int ATVMod::m_DSBFilterBufferIndex
private

Definition at line 543 of file atvmod.h.

Referenced by applySettings(), and modulateVestigialSSB().

◆ m_evenImage

bool ATVMod::m_evenImage
private

in interlaced mode true if this is an even image

Definition at line 497 of file atvmod.h.

Referenced by pullVideo().

◆ m_fps

float ATVMod::m_fps
private

resulting frames per second

Definition at line 501 of file atvmod.h.

Referenced by applyStandard(), calculateCamerasSizes(), calculateVideoSizes(), ATVMod::MsgReportCameraData::getFPS(), and pullVideo().

◆ m_hBarIncrement

float ATVMod::m_hBarIncrement
private

video level increment at each horizontal bar increment

Definition at line 494 of file atvmod.h.

Referenced by applyStandard().

◆ m_horizontalCount

int ATVMod::m_horizontalCount
private

current point index on line

Definition at line 499 of file atvmod.h.

Referenced by pullVideo().

◆ m_image

cv::Mat ATVMod::m_image
private

resized image for transmission at given rate

Definition at line 510 of file atvmod.h.

Referenced by resizeImage().

◆ m_imageFileName

QString ATVMod::m_imageFileName
private

Definition at line 532 of file atvmod.h.

Referenced by openImage(), and webapiFormatChannelSettings().

◆ m_imageFromFile

cv::Mat ATVMod::m_imageFromFile
private

original image not resized not overlaid by text

Definition at line 508 of file atvmod.h.

Referenced by applySettings(), and openImage().

◆ m_imageOK

bool ATVMod::m_imageOK
private

Definition at line 511 of file atvmod.h.

Referenced by applyStandard(), and openImage().

◆ m_imageOriginal

cv::Mat ATVMod::m_imageOriginal
private

original not resized image

Definition at line 509 of file atvmod.h.

Referenced by applySettings(), openImage(), and resizeImage().

◆ m_inputFrequencyOffset

int ATVMod::m_inputFrequencyOffset
private

Definition at line 461 of file atvmod.h.

Referenced by applyChannelSettings(), ATVMod(), and start().

◆ m_interleaved

bool ATVMod::m_interleaved
private

true if image is interlaced (2 half frames per frame)

Definition at line 496 of file atvmod.h.

Referenced by applyStandard().

◆ m_interpolator

Interpolator ATVMod::m_interpolator
private

Definition at line 467 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), and pull().

◆ m_interpolatorDistance

Real ATVMod::m_interpolatorDistance
private

Definition at line 468 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), ATVMod(), and pull().

◆ m_interpolatorDistanceRemain

Real ATVMod::m_interpolatorDistanceRemain
private

Definition at line 469 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), ATVMod(), and pull().

◆ m_levelCalcCount

quint32 ATVMod::m_levelCalcCount
private

Definition at line 504 of file atvmod.h.

Referenced by calculateLevel().

◆ m_levelNbSamples

const int ATVMod::m_levelNbSamples = 10000
staticprivate

Definition at line 551 of file atvmod.h.

Referenced by calculateLevel().

◆ m_levelSum

Real ATVMod::m_levelSum
private

Definition at line 506 of file atvmod.h.

Referenced by calculateLevel().

◆ m_lineCount

int ATVMod::m_lineCount
private

current line index in frame

Definition at line 500 of file atvmod.h.

Referenced by pullImageLine(), pullVideo(), and pullVSyncLine().

◆ m_linesPerVBar

uint32_t ATVMod::m_linesPerVBar
private

number of lines for a bar of the bar chart

Definition at line 478 of file atvmod.h.

Referenced by applyStandard(), and pullImageLine().

◆ m_modPhasor

float ATVMod::m_modPhasor
private

For FM modulation.

Definition at line 466 of file atvmod.h.

Referenced by modulateSample().

◆ m_modSample

Complex ATVMod::m_modSample
private

Definition at line 465 of file atvmod.h.

Referenced by modulateSample(), and pull().

◆ m_movingAverage

MovingAverageUtil<double, double, 16> ATVMod::m_movingAverage
private

Definition at line 503 of file atvmod.h.

Referenced by getMagSq(), and pullFinalize().

◆ m_nbBars

const int ATVMod::m_nbBars = 6
staticprivate

number of bars in bar or chessboard patterns

Definition at line 552 of file atvmod.h.

Referenced by applyStandard().

◆ m_nbBlankLines

int ATVMod::m_nbBlankLines
private

number of lines in a frame (full or half) that are blanked (black) at the top of the image

Definition at line 492 of file atvmod.h.

Referenced by applyStandard(), calculateCamerasSizes(), calculateVideoSizes(), pullVideo(), and resizeImage().

◆ m_nbHalfLongSync

int ATVMod::m_nbHalfLongSync
private

number of half long sync / equalization lines

Definition at line 489 of file atvmod.h.

Referenced by applyStandard().

◆ m_nbHorizPoints

int ATVMod::m_nbHorizPoints
private

number of line points per horizontal line

Definition at line 484 of file atvmod.h.

Referenced by applyStandard(), and pullVideo().

◆ m_nbImageLines

uint32_t ATVMod::m_nbImageLines
private

number of image lines excluding synchronization lines

Definition at line 482 of file atvmod.h.

Referenced by applyStandard(), calculateCamerasSizes(), calculateVideoSizes(), and resizeImage().

◆ m_nbImageLines2

uint32_t ATVMod::m_nbImageLines2
private

same number as above (non interlaced) or half the number above (interlaced)

Definition at line 483 of file atvmod.h.

Referenced by applyStandard(), and pullImageLine().

◆ m_nbLines

int ATVMod::m_nbLines
private

number of lines per complete frame

Definition at line 480 of file atvmod.h.

Referenced by applyStandard(), and pullVideo().

◆ m_nbLines2

int ATVMod::m_nbLines2
private

same number as above (non interlaced) or half the number above (interlaced)

Definition at line 481 of file atvmod.h.

Referenced by applyStandard(), and pullVideo().

◆ m_nbLongSyncLines

int ATVMod::m_nbLongSyncLines
private

number of whole long sync lines for vertical synchronization

Definition at line 488 of file atvmod.h.

Referenced by applyStandard().

◆ m_nbSyncLinesBottom

int ATVMod::m_nbSyncLinesBottom
private

number of sync lines at bottom

Definition at line 487 of file atvmod.h.

Referenced by applyStandard(), and pullVideo().

◆ m_nbSyncLinesHeadE

int ATVMod::m_nbSyncLinesHeadE
private

number of header sync lines on even frame

Definition at line 485 of file atvmod.h.

Referenced by applyStandard(), pullImageLine(), and pullVideo().

◆ m_nbSyncLinesHeadO

int ATVMod::m_nbSyncLinesHeadO
private

number of header sync lines on odd frame

Definition at line 486 of file atvmod.h.

Referenced by applyStandard(), pullImageLine(), and pullVideo().

◆ m_nbWholeEqLines

int ATVMod::m_nbWholeEqLines
private

number of whole equalizing lines

Definition at line 490 of file atvmod.h.

Referenced by applyStandard().

◆ m_networkManager

QNetworkAccessManager* ATVMod::m_networkManager
private

Definition at line 545 of file atvmod.h.

Referenced by ATVMod(), webapiReverseSendSettings(), and ~ATVMod().

◆ m_networkRequest

QNetworkRequest ATVMod::m_networkRequest
private

Definition at line 546 of file atvmod.h.

Referenced by webapiReverseSendSettings().

◆ m_outputSampleRate

int ATVMod::m_outputSampleRate
private

◆ m_overlayText

std::string ATVMod::m_overlayText
private

Definition at line 531 of file atvmod.h.

◆ m_peakLevel

Real ATVMod::m_peakLevel
private

Definition at line 505 of file atvmod.h.

Referenced by calculateLevel().

◆ m_pointsPerBP

int ATVMod::m_pointsPerBP
private

number of line points for the back porch

Definition at line 473 of file atvmod.h.

Referenced by applyStandard(), and pullImageLine().

◆ m_pointsPerFP

uint32_t ATVMod::m_pointsPerFP
private

number of line points for the front porch

Definition at line 475 of file atvmod.h.

Referenced by applyStandard().

◆ m_pointsPerFSync

int ATVMod::m_pointsPerFSync
private

number of line points for the field first sync

Definition at line 476 of file atvmod.h.

Referenced by applyStandard().

◆ m_pointsPerHBar

uint32_t ATVMod::m_pointsPerHBar
private

number of line points for a bar of the bar chart

Definition at line 477 of file atvmod.h.

Referenced by applyStandard(), and pullImageLine().

◆ m_pointsPerImgLine

int ATVMod::m_pointsPerImgLine
private

number of line points for the image line

Definition at line 474 of file atvmod.h.

Referenced by applyStandard(), calculateCamerasSizes(), calculateVideoSizes(), and resizeImage().

◆ m_pointsPerLine

uint32_t ATVMod::m_pointsPerLine
private

Number of points per full line.

Definition at line 471 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), and applyStandard().

◆ m_pointsPerSync

int ATVMod::m_pointsPerSync
private

number of line points for the horizontal sync

Definition at line 472 of file atvmod.h.

Referenced by applyStandard(), and pullVSyncLineLongPulses().

◆ m_pointsPerTU

uint32_t ATVMod::m_pointsPerTU
private

number of line points per time unit

Definition at line 479 of file atvmod.h.

◆ m_settings

ATVModSettings ATVMod::m_settings
private

◆ m_settingsMutex

QMutex ATVMod::m_settingsMutex
private

◆ m_singleLongSync

bool ATVMod::m_singleLongSync
private

single or double long sync per long sync line

Definition at line 491 of file atvmod.h.

Referenced by applyStandard().

◆ m_spanLevel

const float ATVMod::m_spanLevel = 0.7f
staticprivate

Definition at line 550 of file atvmod.h.

Referenced by applyStandard().

◆ m_ssbFftLen

const int ATVMod::m_ssbFftLen = 1024
staticprivate

Definition at line 548 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), and ATVMod().

◆ m_SSBFilter

fftfilt* ATVMod::m_SSBFilter
private

Definition at line 536 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), ATVMod(), modulateSSB(), and ~ATVMod().

◆ m_SSBFilterBuffer

Complex* ATVMod::m_SSBFilterBuffer
private

Definition at line 537 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), ATVMod(), modulateSSB(), and ~ATVMod().

◆ m_SSBFilterBufferIndex

int ATVMod::m_SSBFilterBufferIndex
private

Definition at line 538 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), and modulateSSB().

◆ m_threadedChannelizer

ThreadedBasebandSampleSource* ATVMod::m_threadedChannelizer
private

Definition at line 457 of file atvmod.h.

Referenced by ATVMod(), and ~ATVMod().

◆ m_tvSampleRate

int ATVMod::m_tvSampleRate
private

sample rate for generating signal

Definition at line 470 of file atvmod.h.

Referenced by applyChannelSettings(), applySettings(), getEffectiveSampleRate(), and pull().

◆ m_vBarIncrement

float ATVMod::m_vBarIncrement
private

video level increment at each vertical bar increment

Definition at line 495 of file atvmod.h.

Referenced by applyStandard().

◆ m_video

cv::VideoCapture ATVMod::m_video
private

current video capture

Definition at line 513 of file atvmod.h.

Referenced by handleMessage(), openVideo(), pullVideo(), seekVideoFileStream(), and ~ATVMod().

◆ m_videoEOF

bool ATVMod::m_videoEOF
private

current video has reached end of file

Definition at line 525 of file atvmod.h.

Referenced by openVideo(), pullVideo(), and seekVideoFileStream().

◆ m_videoFileName

QString ATVMod::m_videoFileName
private

Definition at line 533 of file atvmod.h.

Referenced by openVideo(), and webapiFormatChannelSettings().

◆ m_videoFPS

float ATVMod::m_videoFPS
private

current video FPS rate

Definition at line 516 of file atvmod.h.

Referenced by calculateVideoSizes(), getCameraNumbers(), handleMessage(), openVideo(), and pullVideo().

◆ m_videoFPSCount

float ATVMod::m_videoFPSCount
private

current video FPS fractional counter

Definition at line 522 of file atvmod.h.

Referenced by calculateVideoSizes(), pullVideo(), and seekVideoFileStream().

◆ m_videoFPSq

float ATVMod::m_videoFPSq
private

current video FPS sacaling factor

Definition at line 521 of file atvmod.h.

Referenced by calculateVideoSizes(), pullVideo(), and seekVideoFileStream().

◆ m_videoFrame

cv::Mat ATVMod::m_videoFrame
private

current displayable video frame

Definition at line 515 of file atvmod.h.

Referenced by resizeVideo().

◆ m_videoframeOriginal

cv::Mat ATVMod::m_videoframeOriginal
private

current frame from video

Definition at line 514 of file atvmod.h.

Referenced by pullVideo(), and resizeVideo().

◆ m_videoFx

float ATVMod::m_videoFx
private

current video horizontal scaling factor

Definition at line 519 of file atvmod.h.

Referenced by calculateVideoSizes(), and resizeVideo().

◆ m_videoFy

float ATVMod::m_videoFy
private

current video vertictal scaling factor

Definition at line 520 of file atvmod.h.

Referenced by calculateVideoSizes(), and resizeVideo().

◆ m_videoHeight

int ATVMod::m_videoHeight
private

current video frame height

Definition at line 518 of file atvmod.h.

Referenced by calculateVideoSizes(), getCameraNumbers(), handleMessage(), and openVideo().

◆ m_videoLength

int ATVMod::m_videoLength
private

current video length in frames

Definition at line 524 of file atvmod.h.

Referenced by ATVMod::MsgReportVideoFileSourceStreamData::getVideoLength(), openVideo(), and seekVideoFileStream().

◆ m_videoOK

bool ATVMod::m_videoOK
private

Definition at line 526 of file atvmod.h.

Referenced by applyStandard(), handleMessage(), openVideo(), pullVideo(), and seekVideoFileStream().

◆ m_videoPrevFPSCount

int ATVMod::m_videoPrevFPSCount
private

current video FPS previous integer counter

Definition at line 523 of file atvmod.h.

Referenced by calculateVideoSizes(), pullVideo(), and seekVideoFileStream().

◆ m_videoWidth

int ATVMod::m_videoWidth
private

current video frame width

Definition at line 517 of file atvmod.h.

Referenced by calculateVideoSizes(), getCameraNumbers(), handleMessage(), and openVideo().


The documentation for this class was generated from the following files: