18 #ifndef PLUGINS_CHANNELTX_MODATV_ATVMOD_H_ 19 #define PLUGINS_CHANNELTX_MODATV_ATVMOD_H_ 25 #include <QNetworkRequest> 27 #include <opencv2/core/core.hpp> 28 #include <opencv2/highgui/highgui.hpp> 29 #include <opencv2/videoio.hpp> 43 class QNetworkAccessManager;
92 m_centerFrequency(centerFrequency)
155 m_seekPercentage(seekPercentage)
193 m_frameCount(frameCount)
205 quint32 recordLength)
217 m_frameRate(frameRate),
218 m_videoLength(videoLength)
255 bool manualFPSEnable)
268 m_manualFPS(manualFPS),
269 m_manualFPSEnable(manualFPSEnable)
289 bool fpsManualEnable,
317 bool fpsManualEnable,
322 m_deviceNumber(deviceNumber),
324 m_fpsManual(fpsManual),
325 m_fpsManualEnable(fpsManualEnable),
353 m_sampleRate(sampleRate),
354 m_nbPointsPerLine(nbPointsPerLine)
364 virtual void start();
381 (void) sinkElseSource;
387 QString& errorMessage);
391 const QStringList& channelSettingsKeys,
393 QString& errorMessage);
397 QString& errorMessage);
403 static void getBaseValues(
int outputSampleRate,
int linesPerSecond,
int& sampleRateUnits,
uint32_t& nbPointsPerRateUnit);
416 void levelChanged(qreal rmsLevel, qreal peakLevel,
int numSamples);
443 m_videoFPSManual(20.0f),
444 m_videoFPSManualEnable(false),
450 m_videoFPSqManual(1.0f),
451 m_videoFPSCount(0.0f),
452 m_videoPrevFPSCount(0)
583 if (m_horizontalCount < m_pointsPerSync)
587 else if (m_horizontalCount < m_pointsPerSync + m_pointsPerBP)
591 else if (m_horizontalCount < m_pointsPerSync + m_pointsPerBP + m_pointsPerImgLine)
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;
601 sample = (((float)pointIndex) /
m_pointsPerHBar) * m_hBarIncrement + m_blackLevel;
604 sample = (((float)iLine) /
m_linesPerVBar) * m_vBarIncrement + m_blackLevel;
610 sample = (pointIndex / (float) m_pointsPerImgLine) * m_spanLevel +
m_blackLevel;
613 sample = ((iLine -5) / (
float)
m_nbImageLines2) * m_spanLevel + m_blackLevel;
616 if (!m_imageOK || (iLineImage < -oddity) || m_image.empty())
625 pixv = m_image.at<
unsigned char>(2*iLineImage + oddity, pointIndex);
627 pixv = m_image.at<
unsigned char>(iLineImage, pointIndex);
630 sample = (pixv / 256.0f) * m_spanLevel + m_blackLevel;
634 if (!m_videoOK || (iLineImage < -oddity) || m_videoFrame.empty())
643 pixv = m_videoFrame.at<
unsigned char>(2*iLineImage + oddity, pointIndex);
645 pixv = m_videoFrame.at<
unsigned char>(iLineImage, pointIndex);
648 sample = (pixv / 256.0f) * m_spanLevel + m_blackLevel;
652 if ((iLineImage < -oddity) || (m_cameraIndex < 0))
669 pixv = camera.
m_videoFrame.at<
unsigned char>(2*iLineImage + oddity, pointIndex);
671 pixv = camera.
m_videoFrame.at<
unsigned char>(iLineImage, pointIndex);
674 sample = (pixv / 256.0f) * m_spanLevel + m_blackLevel;
691 int halfIndex = m_horizontalCount % (m_nbHorizPoints/2);
699 if (m_singleLongSync && (m_horizontalCount < m_nbHorizPoints/2)) {
709 if (m_horizontalCount < m_pointsPerSync)
713 else if (m_horizontalCount < (m_nbHorizPoints/2))
717 else if (m_horizontalCount < (m_nbHorizPoints/2) + m_pointsPerFSync)
729 if (m_horizontalCount < m_pointsPerSync)
733 else if (m_horizontalCount < (m_nbHorizPoints/2))
737 else if (m_horizontalCount < m_nbHorizPoints - m_pointsPerSync)
749 if (m_horizontalCount < (m_nbHorizPoints/2) - m_pointsPerSync)
753 else if (m_horizontalCount < (m_nbHorizPoints/2))
757 else if (m_horizontalCount < (m_nbHorizPoints/2) + m_pointsPerFSync)
769 if (m_lineCount < m_nbLines2 + 1)
773 if (fieldLine < m_nbLongSyncLines)
777 else if (fieldLine < m_nbLongSyncLines + m_nbHalfLongSync)
781 else if (fieldLine < m_nbLongSyncLines + m_nbHalfLongSync + m_nbWholeEqLines)
785 else if (fieldLine > m_nbLines2 - m_nbHalfLongSync)
789 else if (fieldLine > m_nbLines2 - m_nbHalfLongSync - m_nbWholeEqLines)
795 if (m_horizontalCount < m_pointsPerSync)
807 int fieldLine = m_lineCount - m_nbLines2 - 1;
809 if (fieldLine < m_nbLongSyncLines)
813 else if (fieldLine < m_nbLongSyncLines + m_nbWholeEqLines)
817 else if (fieldLine > m_nbLines2 - 1 - m_nbWholeEqLines - m_nbHalfLongSync)
823 if (m_horizontalCount < m_pointsPerSync)
uint32_t m_pointsPerFP
number of line points for the front porch
float m_videoFPSCount
camera FPS fractional counter
int getSampleRate() const
int getEffectiveSampleRate() const
virtual int webapiSettingsPutPatch(bool force, const QStringList &channelSettingsKeys, SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
float m_videoFPSqManual
camera FPS sacaling factor manually set
static const QString m_channelIdURI
uint32_t m_pointsPerLine
Number of points per full line.
cv::Mat m_videoFrame
displayable camera frame
float m_videoFPSq
camera FPS sacaling factor
uint32_t m_pointsPerTU
number of line points per time unit
std::vector< ATVCamera > m_cameras
vector of available cameras
virtual void getIdentifier(QString &id)
bool m_evenImage
in interlaced mode true if this is an even image
ATVMod(DeviceAPI *deviceAPI)
static MsgReportCameraData * create(int deviceNumber, float fps, float fpsManual, bool fpsManualEnable, int width, int height, int status)
int m_pointsPerSync
number of line points for the horizontal sync
int m_nbLines
number of lines per complete frame
int m_DSBFilterBufferIndex
float m_videoFPS
current video FPS rate
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
bool m_videoFPSManualEnable
Enable camera FPS rate manual set value.
void pullFinalize(Complex &ci, Sample &sample)
static MsgReportVideoFileSourceStreamData * create(int frameRate, quint32 recordLength)
int m_cameraIndex
curent camera index in list of available cameras
MsgReportCameraData(int deviceNumber, float fps, float fpsManual, bool fpsManualEnable, int width, int height, int status)
uint32_t m_linesPerVBar
number of lines for a bar of the bar chart
float m_videoFy
current video vertictal scaling factor
Complex & modulateVestigialSSB(Real &sample)
uint32_t gatNbPointsPerLine() const
quint32 getVideoLength() const
virtual int webapiReportGet(SWGSDRangel::SWGChannelReport &response, QString &errorMessage)
int m_nbWholeEqLines
number of whole equalizing lines
int m_videoLength
current video length in frames
float m_hBarIncrement
video level increment at each horizontal bar increment
int m_videoPrevFPSCount
current video FPS previous integer counter
static const int m_cameraFPSTestNbFrames
number of frames for camera FPS test
static const QString m_channelId
int m_pointsPerFSync
number of line points for the field first sync
std::string m_overlayText
float m_videoFx
camera horizontal scaling factor
int m_nbSyncLinesHeadO
number of header sync lines on odd frame
static const int m_ssbFftLen
qint64 m_inputFrequencyOffset
offset from baseband center frequency
int m_nbSyncLinesBottom
number of sync lines at bottom
void openImage(const QString &fileName)
int m_cameraNumber
camera device number
float m_videoFx
current video horizontal scaling factor
int m_nbHorizPoints
number of line points per horizontal line
static const int m_nbBars
number of bars in bar or chessboard patterns
void pullVSyncLineLongThenEqualizingPulses(Real &sample)
void applySettings(const ATVModSettings &settings, bool force=false)
virtual QByteArray serialize() const
int getFrameCount() const
virtual bool handleMessage(const Message &cmd)
Processing of a message. Returns true if message has actually been processed.
float m_modPhasor
For FM modulation.
MsgReportEffectiveSampleRate(int sampleRate, uint32_t nbPointsPerLine)
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples)
QNetworkAccessManager * m_networkManager
bool getFPSManualEnable() const
void calculateCamerasSizes()
void openVideo(const QString &fileName)
virtual void pullAudio(int nbSamples)
UpChannelizer * m_channelizer
int m_videoHeight
camera frame height
ThreadedBasebandSampleSource * m_threadedChannelizer
virtual void getTitle(QString &title)
uint32_t m_nbImageLines2
same number as above (non interlaced) or half the number above (interlaced)
static MsgReportVideoFileSourceStreamTiming * create(int frameCount)
float m_videoFy
camera vertictal scaling factor
void pullVSyncLine(Real &sample)
cv::Mat m_imageOriginal
original not resized image
#define MESSAGE_CLASS_DECLARATION
Complex * m_SSBFilterBuffer
cv::VideoCapture m_video
current video capture
float m_videoFPS
camera FPS rate
void pullVSyncLineLongPulses(Real &sample)
float m_vBarIncrement
video level increment at each vertical bar increment
QNetworkRequest m_networkRequest
void getCameraNumbers(std::vector< int > &numbers)
int m_videoHeight
current video frame height
void pullImageLine(Real &sample, bool noHSync=false)
ATVModSettings m_settings
uint32_t m_pointsPerHBar
number of line points for a bar of the bar chart
uint32_t m_nbPointsPerLine
int m_SSBFilterBufferIndex
int m_nbHalfLongSync
number of half long sync / equalization lines
int m_tvSampleRate
sample rate for generating signal
void pullVSyncLineEqualizingThenLongPulses(Real &sample)
static float getRFBandwidthDivisor(ATVModSettings::ATVModulation modulation)
Real m_interpolatorDistanceRemain
int m_videoPrevFPSCount
camera FPS previous integer counter
MovingAverageUtil< double, double, 16 > m_movingAverage
cv::Mat m_videoFrame
current displayable video frame
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport &response)
cv::Mat m_imageFromFile
original image not resized not overlaid by text
void networkManagerFinished(QNetworkReply *reply)
cv::Mat m_videoframeOriginal
camera non resized image
Real m_interpolatorDistance
ATVModInput m_atvModInput
Input source type.
int getdeviceNumber() const
virtual int webapiSettingsGet(SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
cv::Mat m_videoframeOriginal
current frame from video
virtual qint64 getCenterFrequency() const
Applies to a default stream.
int m_pointsPerImgLine
number of line points for the image line
float m_videoFPSCount
current video FPS fractional counter
int m_nbBlankLines
number of lines in a frame (full or half) that are blanked (black) at the top of the image ...
static const int m_levelNbSamples
cv::VideoCapture m_camera
camera object
bool m_videoEOF
current video has reached end of file
int m_videoWidth
current video frame width
Interpolator m_interpolator
void pullVSyncLineEqualizingPulses(Real &sample)
virtual int getNbSourceStreams() const
uint32_t m_nbImageLines
number of image lines excluding synchronization lines
bool m_interleaved
true if image is interlaced (2 half frames per frame)
Real m_uniformLevel
Percentage between black and white for uniform screen display.
static MsgReportEffectiveSampleRate * create(int sampleRate, uint32_t nbPointsPerLine)
int m_horizontalCount
current point index on line
float m_videoFPSManual
camera FPS rate manually set
MsgReportVideoFileSourceStreamTiming(int frameCount)
void webapiReverseSendSettings(QList< QString > &channelSettingsKeys, const ATVModSettings &settings, bool force)
virtual bool deserialize(const QByteArray &data)
void calculateVideoSizes()
Complex & modulateSSB(Real &sample)
virtual void pull(Sample &sample)
float m_blankLineLvel
video level of blank lines
cv::Mat m_image
resized image for transmission at given rate
int m_videoWidth
camera frame width
static void getBaseValues(int outputSampleRate, int linesPerSecond, int &sampleRateUnits, uint32_t &nbPointsPerRateUnit)
MsgReportVideoFileSourceStreamData(int frameRate, int videoLength)
float getFPSManual() const
float m_fps
resulting frames per second
static const float m_spanLevel
bool m_singleLongSync
single or double long sync per long sync line
int m_lineCount
current line index in frame
int m_videoLength
Video length in frames.
int m_pointsPerBP
number of line points for the back porch
std::complex< Real > Complex
int m_nbSyncLinesHeadE
number of header sync lines on even frame
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset, bool force=false)
void seekVideoFileStream(int seekPercentage)
void pullVideo(Real &sample)
void mixImageAndText(cv::Mat &image)
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const ATVModSettings &settings)
static const float m_blackLevel
float m_videoFPSq
current video FPS sacaling factor
int m_inputFrequencyOffset
int m_nbLines2
same number as above (non interlaced) or half the number above (interlaced)
Complex * m_DSBFilterBuffer
int m_nbLongSyncLines
number of whole long sync lines for vertical synchronization
virtual int getNbSinkStreams() const
void calculateLevel(Real &sample)