1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-12 11:26:11 -05:00

DATV demodulator: improvements

This commit is contained in:
f4exb 2018-02-26 01:04:45 +01:00
parent a483b58028
commit 1436844fb3
15 changed files with 1285 additions and 1141 deletions

View File

@ -31,31 +31,24 @@ static const int DEFAULT_GUI_DECIMATION = 64;
template<typename T> struct datvconstellation: runnable template<typename T> struct datvconstellation: runnable
{ {
T xymin; T xymin, xymax;
T xymax;
unsigned long decimation; unsigned long decimation;
unsigned long pixels_per_frame; unsigned long pixels_per_frame;
cstln_lut<256> **cstln; // Optional ptr to optional constellation cstln_lut<256> **cstln; // Optional ptr to optional constellation
DATVScreen *m_objDATVScreen;
pipereader<complex<T> > in; pipereader<complex<T> > in;
unsigned long phase; unsigned long phase;
DATVScreen *m_objDATVScreen;
datvconstellation( datvconstellation(scheduler *sch, pipebuf<complex<T> > &_in, T _xymin, T _xymax, const char *_name = NULL, DATVScreen * objDATVScreen = NULL) :
scheduler *sch, runnable(sch, _name ? _name : _in.name),
pipebuf<complex<T> > &_in, xymin(_xymin),
T _xymin, xymax(_xymax),
T _xymax, decimation(DEFAULT_GUI_DECIMATION),
const char *_name = 0, pixels_per_frame(1024),
DATVScreen * objDATVScreen = 0) : cstln(NULL),
runnable(sch, _name ? _name : _in.name), m_objDATVScreen(objDATVScreen),
xymin(_xymin), in(_in),
xymax(_xymax), phase(0)
decimation(DEFAULT_GUI_DECIMATION),
pixels_per_frame(1024),
cstln(0),
in(_in),
phase(0),
m_objDATVScreen(objDATVScreen)
{ {
} }
@ -76,11 +69,8 @@ template<typename T> struct datvconstellation: runnable
if (m_objDATVScreen != NULL) if (m_objDATVScreen != NULL)
{ {
m_objDATVScreen->selectRow( m_objDATVScreen->selectRow(256 * (p->re - xymin) / (xymax - xymin));
256 * (p->re - xymin) / (xymax - xymin)); m_objDATVScreen->setDataColor(256 - 256 * ((p->im - xymin) / (xymax - xymin)), 255, 0, 255);
m_objDATVScreen->setDataColor(
256 - 256 * ((p->im - xymin) / (xymax - xymin)),
255, 0, 255);
} }
} }
@ -106,7 +96,6 @@ template<typename T> struct datvconstellation: runnable
} }
m_objDATVScreen->renderImage(NULL); m_objDATVScreen->renderImage(NULL);
} }
in.read(pixels_per_frame); in.read(pixels_per_frame);
@ -118,15 +107,8 @@ template<typename T> struct datvconstellation: runnable
} }
} }
//private:
//gfx g;
void draw_begin() void draw_begin()
{ {
//g.clear();
//g.setfg(0, 255, 0);
//g.line(g.w/2,0, g.w/2, g.h);
//g.line(0,g.h/2, g.w,g.h/2);
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@ -68,82 +68,70 @@ class DownChannelizer;
using namespace leansdr; using namespace leansdr;
enum DATVModulation enum DATVModulation { BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256 };
{ enum dvb_version { DVB_S, DVB_S2 };
BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256 enum dvb_sampler { SAMP_NEAREST, SAMP_LINEAR, SAMP_RRC };
};
enum dvb_version
{
DVB_S, DVB_S2
};
enum dvb_sampler
{
SAMP_NEAREST, SAMP_LINEAR, SAMP_RRC
};
inline int decimation(float Fin, float Fout) inline int decimation(float Fin, float Fout) { int d = Fin / Fout; return max(d, 1); }
{
int d = Fin / Fout;
return max(d, 1);
}
struct config struct config
{ {
dvb_version standard; dvb_version standard;
dvb_sampler sampler; dvb_sampler sampler;
int buf_factor; // Buffer sizing int buf_factor; // Buffer sizing
float Fs; // Sampling frequency (Hz) float Fs; // Sampling frequency (Hz)
float Fderot; // Shift the signal (Hz). Note: Ftune is faster float Fderot; // Shift the signal (Hz). Note: Ftune is faster
int anf; // Number of auto notch filters int anf; // Number of auto notch filters
bool cnr; // Measure CNR bool cnr; // Measure CNR
unsigned int decim; // Decimation, 0=auto unsigned int decim; // Decimation, 0=auto
float Fm; // QPSK symbol rate (Hz) float Fm; // QPSK symbol rate (Hz)
cstln_lut<256>::predef constellation; cstln_lut<256>::predef constellation;
code_rate fec; code_rate fec;
float Ftune; // Bias frequency for the QPSK demodulator (Hz) float Ftune; // Bias frequency for the QPSK demodulator (Hz)
bool allow_drift; bool allow_drift;
bool fastlock; bool fastlock;
bool viterbi; bool viterbi;
bool hard_metric; bool hard_metric;
bool resample; bool resample;
float resample_rej; // Approx. filter rejection in dB float resample_rej; // Approx. filter rejection in dB
int rrc_steps; // Discrete steps between symbols, 0=auto int rrc_steps; // Discrete steps between symbols, 0=auto
float rrc_rej; // Approx. RRC filter rejection in dB float rrc_rej; // Approx. RRC filter rejection in dB
float rolloff; // Roll-off 0..1 float rolloff; // Roll-off 0..1
bool hdlc; // Expect HDLC frames instead of MPEG packets bool hdlc; // Expect HDLC frames instead of MPEG packets
bool packetized; // Output frames with 16-bit BE length bool packetized; // Output frames with 16-bit BE length
float Finfo; // Desired refresh rate on fd_info (Hz) float Finfo; // Desired refresh rate on fd_info (Hz)
config() : config() :
standard(DVB_S), standard(DVB_S),
sampler(SAMP_LINEAR), sampler(SAMP_LINEAR),
buf_factor(4), buf_factor(4),
Fs(2.4e6), Fs(2.4e6),
Fderot(0), Fderot(0),
anf(1), anf(1),
cnr(false), cnr(false),
decim(0), decim(0),
Fm(2e6), Fm(2e6),
constellation(cstln_lut<256>::QPSK), constellation(cstln_lut<256>::QPSK),
fec(FEC12), fec(FEC12),
Ftune(0), Ftune(0),
allow_drift(false), allow_drift(false),
fastlock(true), fastlock(true),
viterbi(false), viterbi(false),
hard_metric(false), hard_metric(false),
resample(false), resample(false),
resample_rej(10), resample_rej(10),
rrc_steps(0), rrc_steps(0),
rrc_rej(10), rrc_rej(10),
rolloff(0.35), rolloff(0.35),
hdlc(false), hdlc(false),
packetized(false), packetized(false),
Finfo(5) Finfo(5)
{ {
} }
}; };
struct DATVConfig struct DATVConfig
{ {
int intMsps; int intMsps;
@ -157,110 +145,72 @@ struct DATVConfig
int intNotchFilters; int intNotchFilters;
bool blnAllowDrift; bool blnAllowDrift;
bool blnFastLock; bool blnFastLock;
bool blnHDLC; dvb_sampler enmFilter;
bool blnHardMetric; bool blnHardMetric;
bool blnResample; float fltRollOff;
bool blnViterbi; bool blnViterbi;
int intExcursion;
DATVConfig() : DATVConfig() :
intMsps(1024000), intMsps(1024000),
intRFBandwidth(1024000), intRFBandwidth(1024000),
intCenterFrequency(0), intCenterFrequency(0),
enmStandard(DVB_S), enmStandard(DVB_S),
enmModulation(BPSK), enmModulation(BPSK),
enmFEC(FEC12), enmFEC(FEC12),
intSampleRate(1024000), intSampleRate(1024000),
intSymbolRate(250000), intSymbolRate(250000),
intNotchFilters(1), intNotchFilters(1),
blnAllowDrift(false), blnAllowDrift(false),
blnFastLock(false), blnFastLock(false),
blnHDLC(false), enmFilter(SAMP_LINEAR),
blnHardMetric(false), blnHardMetric(false),
blnResample(false), fltRollOff(0.35),
blnViterbi(false) blnViterbi(false),
intExcursion(10)
{ {
} }
}; };
class DATVDemod: public BasebandSampleSink, public ChannelSinkAPI
class DATVDemod : public BasebandSampleSink, public ChannelSinkAPI
{ {
Q_OBJECT Q_OBJECT
public: public:
class MsgConfigureChannelizer: public Message
{
MESSAGE_CLASS_DECLARATION
public:
int getCenterFrequency() const
{
return m_centerFrequency;
}
static MsgConfigureChannelizer* create(int centerFrequency)
{
return new MsgConfigureChannelizer(centerFrequency);
}
private:
int m_centerFrequency;
MsgConfigureChannelizer(int centerFrequency) :
Message(), m_centerFrequency(centerFrequency)
{
}
};
DATVDemod(DeviceSourceAPI *); DATVDemod(DeviceSourceAPI *);
~DATVDemod(); ~DATVDemod();
virtual void destroy() virtual void destroy() { delete this; }
{ virtual void getIdentifier(QString& id) { id = objectName(); }
delete this; virtual void getTitle(QString& title) { title = objectName(); }
} virtual qint64 getCenterFrequency() const { return m_objRunning.intCenterFrequency; }
virtual void getIdentifier(QString& id)
{
id = objectName();
}
virtual void getTitle(QString& title)
{
title = objectName();
}
virtual qint64 getCenterFrequency() const
{
return m_objRunning.intCenterFrequency;
}
virtual QByteArray serialize() const virtual QByteArray serialize() const { return QByteArray(); }
{ virtual bool deserialize(const QByteArray& data __attribute__((unused))) { return false; }
return QByteArray();
}
virtual bool deserialize(const QByteArray& data __attribute__((unused)))
{
return false;
}
void configure( void configure(
MessageQueue* objMessageQueue, MessageQueue* objMessageQueue,
int intRFBandwidth, int intRFBandwidth,
int intCenterFrequency, int intCenterFrequency,
dvb_version enmStandard, dvb_version enmStandard,
DATVModulation enmModulation, DATVModulation enmModulation,
code_rate enmFEC, code_rate enmFEC,
int intSymbolRate, int intSymbolRate,
int intNotchFilters, int intNotchFilters,
bool blnAllowDrift, bool blnAllowDrift,
bool blnFastLock, bool blnFastLock,
bool blnHDLC, dvb_sampler enmFilter,
bool blnHardMetric, bool blnHardMetric,
bool blnResample, float fltRollOff,
bool blnViterbi); bool blnViterbi,
int intfltExcursion);
virtual void feed(const SampleVector::const_iterator& begin, virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
const SampleVector::const_iterator& end, bool po); virtual void start();
virtual void start(); virtual void stop();
virtual void stop(); virtual bool handleMessage(const Message& cmd);
virtual bool handleMessage(const Message& cmd);
bool SetDATVScreen(DATVScreen *objScreen); bool SetDATVScreen(DATVScreen *objScreen);
DATVideostream * SetVideoRender(DATVideoRender *objScreen); DATVideostream * SetVideoRender(DATVideoRender *objScreen);
@ -268,36 +218,62 @@ public:
bool PlayVideo(bool blnStartStop); bool PlayVideo(bool blnStartStop);
void InitDATVParameters( void InitDATVParameters(
int intMsps, int intMsps,
int intRFBandwidth, int intRFBandwidth,
int intCenterFrequency, int intCenterFrequency,
dvb_version enmStandard, dvb_version enmStandard,
DATVModulation enmModulation, DATVModulation enmModulation,
code_rate enmFEC, code_rate enmFEC,
int intSampleRate, int intSampleRate,
int intSymbolRate, int intSymbolRate,
int intNotchFilters, int intNotchFilters,
bool blnAllowDrift, bool blnAllowDrift,
bool blnFastLock, bool blnFastLock,
bool blnHDLC, dvb_sampler enmFilter,
bool blnHardMetric, bool blnHardMetric,
bool blnResample, float fltRollOff,
bool blnViterbi); bool blnViterbi,
int intEExcursion);
void CleanUpDATVFramework(); void CleanUpDATVFramework(bool blnRelease);
int GetSampleRate(); int GetSampleRate();
void InitDATVFramework(); void InitDATVFramework();
static const QString m_channelIdURI; static const QString m_channelIdURI;
static const QString m_channelId; static const QString m_channelId;
private:
class MsgConfigureDATVDemod: public Message class MsgConfigureChannelizer : public Message
{ {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
static MsgConfigureDATVDemod* create( int getCenterFrequency() const { return m_centerFrequency; }
static MsgConfigureChannelizer* create(int centerFrequency)
{
return new MsgConfigureChannelizer(centerFrequency);
}
private:
int m_centerFrequency;
MsgConfigureChannelizer(int centerFrequency) :
Message(),
m_centerFrequency(centerFrequency)
{ }
};
private slots:
void channelSampleRateChanged();
private:
class MsgConfigureDATVDemod : public Message
{
MESSAGE_CLASS_DECLARATION
public:
static MsgConfigureDATVDemod* create(
int intRFBandwidth, int intRFBandwidth,
int intCenterFrequency, int intCenterFrequency,
dvb_version enmStandard, dvb_version enmStandard,
@ -307,60 +283,50 @@ private:
int intNotchFilters, int intNotchFilters,
bool blnAllowDrift, bool blnAllowDrift,
bool blnFastLock, bool blnFastLock,
bool blnHDLC, dvb_sampler enmFilter,
bool blnHardMetric, bool blnHardMetric,
bool blnResample, float fltRollOff,
bool blnViterbi) bool blnViterbi,
{ int intExcursion)
return new MsgConfigureDATVDemod( {
intRFBandwidth, return new MsgConfigureDATVDemod(intRFBandwidth,intCenterFrequency,enmStandard, enmModulation, enmFEC, intSymbolRate, intNotchFilters, blnAllowDrift,blnFastLock,enmFilter,blnHardMetric,fltRollOff, blnViterbi, intExcursion);
intCenterFrequency, }
enmStandard,
enmModulation,
enmFEC,
intSymbolRate,
intNotchFilters,
blnAllowDrift,
blnFastLock,
blnHDLC,
blnHardMetric,
blnResample,
blnViterbi);
}
DATVConfig m_objMsgConfig; DATVConfig m_objMsgConfig;
private: private:
MsgConfigureDATVDemod( MsgConfigureDATVDemod(
int intRFBandwidth, int intRFBandwidth,
int intCenterFrequency, int intCenterFrequency,
dvb_version enmStandard, dvb_version enmStandard,
DATVModulation enmModulation, DATVModulation enmModulation,
code_rate enmFEC, code_rate enmFEC,
int intSymbolRate, int intSymbolRate,
int intNotchFilters, int intNotchFilters,
bool blnAllowDrift, bool blnAllowDrift,
bool blnFastLock, bool blnFastLock,
bool blnHDLC, dvb_sampler enmFilter,
bool blnHardMetric, bool blnHardMetric,
bool blnResample, float fltRollOff,
bool blnViterbi) : bool blnViterbi,
int intExcursion) :
Message() Message()
{ {
m_objMsgConfig.intRFBandwidth = intRFBandwidth; m_objMsgConfig.intRFBandwidth = intRFBandwidth;
m_objMsgConfig.intCenterFrequency = intCenterFrequency; m_objMsgConfig.intCenterFrequency = intCenterFrequency;
m_objMsgConfig.enmStandard = enmStandard; m_objMsgConfig.enmStandard = enmStandard;
m_objMsgConfig.enmModulation = enmModulation; m_objMsgConfig.enmModulation = enmModulation;
m_objMsgConfig.enmFEC = enmFEC; m_objMsgConfig.enmFEC = enmFEC;
m_objMsgConfig.intSymbolRate = intSymbolRate; m_objMsgConfig.intSymbolRate = intSymbolRate;
m_objMsgConfig.intNotchFilters = intNotchFilters; m_objMsgConfig.intNotchFilters = intNotchFilters;
m_objMsgConfig.blnAllowDrift = blnAllowDrift; m_objMsgConfig.blnAllowDrift = blnAllowDrift;
m_objMsgConfig.blnFastLock = blnFastLock; m_objMsgConfig.blnFastLock = blnFastLock;
m_objMsgConfig.blnHDLC = blnHDLC; m_objMsgConfig.enmFilter= enmFilter;
m_objMsgConfig.blnHardMetric = blnHardMetric; m_objMsgConfig.blnHardMetric = blnHardMetric;
m_objMsgConfig.blnResample = blnResample; m_objMsgConfig.fltRollOff = fltRollOff;
m_objMsgConfig.blnViterbi = blnViterbi; m_objMsgConfig.blnViterbi = blnViterbi;
} m_objMsgConfig.intExcursion = intExcursion;
}
}; };
unsigned long m_lngExpectedReadIQ; unsigned long m_lngExpectedReadIQ;
@ -403,7 +369,7 @@ private:
cnr_fft<f32> *r_cnr; cnr_fft<f32> *r_cnr;
//FILTERING //FILTERING
fir_filter<cf32, float> *r_resample; fir_filter<cf32,float> *r_resample;
pipebuf<cf32> *p_resampled; pipebuf<cf32> *p_resampled;
float *coeffs; float *coeffs;
int ncoeffs; int ncoeffs;
@ -442,17 +408,18 @@ private:
pipebuf<u8> *p_mpegbytes; pipebuf<u8> *p_mpegbytes;
pipebuf<int> *p_lock; pipebuf<int> *p_lock;
pipebuf<u32> *p_locktime; pipebuf<u32> *p_locktime;
mpeg_sync<u8, 0> *r_sync_mpeg; mpeg_sync<u8,0> *r_sync_mpeg;
// DEINTERLEAVING // DEINTERLEAVING
pipebuf<rspacket<u8> > *p_rspackets; pipebuf< rspacket<u8> > *p_rspackets;
deinterleaver<u8> *r_deinter; deinterleaver<u8> *r_deinter;
// REED-SOLOMON // REED-SOLOMON
pipebuf<int> *p_vbitcount; pipebuf<int> *p_vbitcount;
pipebuf<int> *p_verrcount; pipebuf<int> *p_verrcount;
pipebuf<tspacket> *p_rtspackets; pipebuf<tspacket> *p_rtspackets;
rs_decoder<u8, 0> *r_rsdec; rs_decoder<u8,0> *r_rsdec;
// BER ESTIMATION // BER ESTIMATION
pipebuf<float> *p_vber; pipebuf<float> *p_vber;
@ -462,6 +429,7 @@ private:
pipebuf<tspacket> *p_tspackets; pipebuf<tspacket> *p_tspackets;
derandomizer *r_derand; derandomizer *r_derand;
//OUTPUT //OUTPUT
file_writer<tspacket> *r_stdout; file_writer<tspacket> *r_stdout;
datvvideoplayer<tspacket> *r_videoplayer; datvvideoplayer<tspacket> *r_videoplayer;
@ -485,6 +453,7 @@ private:
bool m_blnInitialized; bool m_blnInitialized;
bool m_blnRenderingVideo; bool m_blnRenderingVideo;
bool m_blnStartStopVideo;
DATVModulation m_enmModulation; DATVModulation m_enmModulation;
@ -495,9 +464,6 @@ private:
QMutex m_objSettingsMutex; QMutex m_objSettingsMutex;
void ApplySettings(); void ApplySettings();
private slots:
void channelSampleRateChanged();
}; };
#endif // INCLUDE_DATVDEMOD_H #endif // INCLUDE_DATVDEMOD_H

View File

@ -78,14 +78,14 @@ void DATVDemodGUI::resetToDefaults()
ui->chkAllowDrift->setChecked(false); ui->chkAllowDrift->setChecked(false);
ui->chkFastlock->setChecked(true); ui->chkFastlock->setChecked(true);
ui->chkHDLC->setChecked(false);
ui->chkHardMetric->setChecked(false); ui->chkHardMetric->setChecked(false);
ui->chkResample->setChecked(false);
ui->chkViterbi->setChecked(false); ui->chkViterbi->setChecked(false);
ui->cmbFEC->setCurrentIndex(0); ui->cmbFEC->setCurrentIndex(0);
ui->cmbModulation->setCurrentIndex(0); ui->cmbModulation->setCurrentIndex(0);
ui->cmbStandard->setCurrentIndex(0); ui->cmbStandard->setCurrentIndex(0);
ui->cmbFilter->setCurrentIndex(0);
displayRRCParameters(false);
ui->spiNotchFilters->setValue(1); ui->spiNotchFilters->setValue(1);
ui->prgSynchro->setValue(0); ui->prgSynchro->setValue(0);
@ -94,6 +94,9 @@ void DATVDemodGUI::resetToDefaults()
ui->spiBandwidth->setValue(512000); ui->spiBandwidth->setValue(512000);
ui->spiSymbolRate->setValue(250000); ui->spiSymbolRate->setValue(250000);
ui->spiRollOff->setValue(35);
ui->spiExcursion->setValue(10);
blockApplySettings(false); blockApplySettings(false);
@ -109,9 +112,9 @@ QByteArray DATVDemodGUI::serialize() const
s.writeBool(3, ui->chkAllowDrift->isChecked()); s.writeBool(3, ui->chkAllowDrift->isChecked());
s.writeBool(4, ui->chkFastlock->isChecked()); s.writeBool(4, ui->chkFastlock->isChecked());
s.writeBool(5, ui->chkHDLC->isChecked()); s.writeS32(5, ui->cmbFilter->currentIndex());
s.writeBool(6, ui->chkHardMetric->isChecked()); s.writeBool(6, ui->chkHardMetric->isChecked());
s.writeBool(7, ui->chkResample->isChecked()); s.writeS32(7, ui->spiRollOff->value());
s.writeBool(8, ui->chkViterbi->isChecked()); s.writeBool(8, ui->chkViterbi->isChecked());
s.writeS32(9, ui->cmbFEC->currentIndex()); s.writeS32(9, ui->cmbFEC->currentIndex());
@ -121,6 +124,7 @@ QByteArray DATVDemodGUI::serialize() const
s.writeS32(12, ui->spiNotchFilters->value()); s.writeS32(12, ui->spiNotchFilters->value());
s.writeS32(13, ui->spiBandwidth->value()); s.writeS32(13, ui->spiBandwidth->value());
s.writeS32(14, ui->spiSymbolRate->value()); s.writeS32(14, ui->spiSymbolRate->value());
s.writeS32(15, ui->spiExcursion->value());
return s.final(); return s.final();
} }
@ -163,14 +167,16 @@ bool DATVDemodGUI::deserialize(const QByteArray& arrData)
d.readBool(4, &booltmp, false); d.readBool(4, &booltmp, false);
ui->chkFastlock->setChecked(booltmp); ui->chkFastlock->setChecked(booltmp);
d.readBool(5, &booltmp, false); d.readS32(5, &tmp, false);
ui->chkHDLC->setChecked(booltmp); ui->cmbFilter->setCurrentIndex(tmp);
displayRRCParameters((tmp==2));
d.readBool(6, &booltmp, false); d.readBool(6, &booltmp, false);
ui->chkHardMetric->setChecked(booltmp); ui->chkHardMetric->setChecked(booltmp);
d.readBool(7, &booltmp, false); d.readS32(7, &tmp, false);
ui->chkResample->setChecked(booltmp); ui->spiRollOff->setValue(tmp);
d.readBool(8, &booltmp, false); d.readBool(8, &booltmp, false);
ui->chkViterbi->setChecked(booltmp); ui->chkViterbi->setChecked(booltmp);
@ -194,6 +200,9 @@ bool DATVDemodGUI::deserialize(const QByteArray& arrData)
d.readS32(14, &tmp, 250000); d.readS32(14, &tmp, 250000);
ui->spiSymbolRate->setValue(tmp); ui->spiSymbolRate->setValue(tmp);
d.readS32(15, &tmp, false);
ui->spiExcursion->setValue(tmp);
blockApplySettings(false); blockApplySettings(false);
m_objChannelMarker.blockSignals(false); m_objChannelMarker.blockSignals(false);
@ -227,11 +236,6 @@ void DATVDemodGUI::channelMarkerHighlightedByCursor()
setHighlighted(m_objChannelMarker.getHighlighted()); setHighlighted(m_objChannelMarker.getHighlighted());
} }
void DATVDemodGUI::channelSampleRateChanged()
{
qDebug("DATVDemodGUI::channelSampleRateChanged");
applySettings();
}
void DATVDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused))) void DATVDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused)))
{ {
@ -239,14 +243,6 @@ void DATVDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool
void DATVDemodGUI::onMenuDoubleClicked() void DATVDemodGUI::onMenuDoubleClicked()
{ {
/*
if (!m_blnBasicSettingsShown)
{
m_blnBasicSettingsShown = true;
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_objChannelMarker, this);
bcsw->show();
}
*/
} }
//DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, QWidget* objParent) : //DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, QWidget* objParent) :
@ -262,9 +258,7 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
//connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
//m_objDATVDemod = new DATVDemod();
m_objDATVDemod = (DATVDemod*) rxChannel; m_objDATVDemod = (DATVDemod*) rxChannel;
m_objDATVDemod->setMessageQueueToGUI(getInputMessageQueue()); m_objDATVDemod->setMessageQueueToGUI(getInputMessageQueue());
@ -272,12 +266,7 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
connect(m_objDATVDemod->SetVideoRender(ui->screenTV_2),&DATVideostream::onDataPackets,this,&DATVDemodGUI::on_StreamDataAvailable); connect(m_objDATVDemod->SetVideoRender(ui->screenTV_2),&DATVideostream::onDataPackets,this,&DATVDemodGUI::on_StreamDataAvailable);
connect(ui->screenTV_2,&DATVideoRender::onMetaDataChanged,this,&DATVDemodGUI::on_StreamMetaDataChanged);
//connect(m_objChannelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
//m_objPluginAPI->addThreadedSink(m_objThreadedChannelizer);
//connect(&m_objPluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
m_intPreviousDecodedData=0; m_intPreviousDecodedData=0;
m_intLastDecodedData=0; m_intLastDecodedData=0;
@ -295,7 +284,6 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
m_objChannelMarker.setCenterFrequency(0); m_objChannelMarker.setCenterFrequency(0);
m_objChannelMarker.blockSignals(false); m_objChannelMarker.blockSignals(false);
m_objChannelMarker.setVisible(true); m_objChannelMarker.setVisible(true);
//connect(&m_objChannelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
connect(&m_objChannelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); connect(&m_objChannelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
connect(&m_objChannelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor())); connect(&m_objChannelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
@ -304,8 +292,6 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
m_deviceUISet->addChannelMarker(&m_objChannelMarker); m_deviceUISet->addChannelMarker(&m_objChannelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);
//ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer());
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
resetToDefaults(); // does applySettings() resetToDefaults(); // does applySettings()
@ -335,22 +321,18 @@ void DATVDemodGUI::applySettings()
DATVModulation enmSelectedModulation; DATVModulation enmSelectedModulation;
dvb_version enmVersion; dvb_version enmVersion;
code_rate enmFEC; code_rate enmFEC;
dvb_sampler enmSampler;
if (m_blnDoApplySettings) if (m_blnDoApplySettings)
{ {
DATVDemod::MsgConfigureChannelizer *msgChan = DATVDemod::MsgConfigureChannelizer::create(m_objChannelMarker.getCenterFrequency()); DATVDemod::MsgConfigureChannelizer *msgChan = DATVDemod::MsgConfigureChannelizer::create(m_objChannelMarker.getCenterFrequency());
m_objDATVDemod->getInputMessageQueue()->push(msgChan); m_objDATVDemod->getInputMessageQueue()->push(msgChan);
//Bandwidth and center frequency //Bandwidth and center frequency
m_objChannelMarker.setBandwidth(ui->spiBandwidth->value()); m_objChannelMarker.setBandwidth(ui->spiBandwidth->value());
//m_objChannelizer->configure(m_objChannelizer->getInputMessageQueue(), m_objChannelizer->getInputSampleRate(), m_objChannelMarker.getCenterFrequency());
setTitleColor(m_objChannelMarker.getColor()); setTitleColor(m_objChannelMarker.getColor());
//DATV parameters: cmbStandard cmbModulation cmbFEC spiBandwidth spiSymbolRate spiNotchFilters chkAllowDrift chkFastlock chkHDLC chkHardMetric chkResample chkViterbi
strStandard = ui->cmbStandard->currentText(); strStandard = ui->cmbStandard->currentText();
if(strStandard=="DVB-S") if(strStandard=="DVB-S")
@ -412,6 +394,12 @@ void DATVDemodGUI::applySettings()
enmSelectedModulation=BPSK; enmSelectedModulation=BPSK;
} }
//Viterbi only for BPSK et QPSK
if((enmSelectedModulation!=BPSK) && (enmSelectedModulation!=QPSK))
{
ui->chkViterbi->setChecked(false);
}
strFEC = ui->cmbFEC->currentText(); strFEC = ui->cmbFEC->currentText();
@ -452,21 +440,36 @@ void DATVDemodGUI::applySettings()
enmFEC=FEC12; enmFEC=FEC12;
} }
if (ui->cmbFilter->currentIndex()==0)
{
enmSampler = SAMP_LINEAR;
}
else if(ui->cmbFilter->currentIndex()==1)
{
enmSampler = SAMP_NEAREST;
}
else
{
enmSampler = SAMP_RRC;
}
m_objDATVDemod->configure(m_objDATVDemod->getInputMessageQueue(),
m_objChannelMarker.getBandwidth(), m_objDATVDemod->configure(
m_objChannelMarker.getCenterFrequency(), m_objDATVDemod->getInputMessageQueue(),
enmVersion, m_objChannelMarker.getBandwidth(),
enmSelectedModulation, m_objChannelMarker.getCenterFrequency(),
enmFEC, enmVersion,
ui->spiSymbolRate->value(), enmSelectedModulation,
ui->spiNotchFilters->value(), enmFEC,
ui->chkAllowDrift->isChecked(), ui->spiSymbolRate->value(),
ui->chkFastlock->isChecked(), ui->spiNotchFilters->value(),
ui->chkHDLC->isChecked(), ui->chkAllowDrift->isChecked(),
ui->chkHardMetric->isChecked(), ui->chkFastlock->isChecked(),
ui->chkResample->isChecked(), enmSampler,
ui->chkViterbi->isChecked()); ui->chkHardMetric->isChecked(),
((float)ui->spiRollOff->value())/100.0f,
ui->chkViterbi->isChecked(),
ui->spiExcursion->value());
qDebug() << "DATVDemodGUI::applySettings:" qDebug() << "DATVDemodGUI::applySettings:"
<< " .inputSampleRate: " << 0 /*m_objChannelizer->getInputSampleRate()*/ << " .inputSampleRate: " << 0 /*m_objChannelizer->getInputSampleRate()*/
@ -622,25 +625,11 @@ void DATVDemodGUI::on_chkHardMetric_clicked()
applySettings(); applySettings();
} }
/*
void DATVDemodGUI::on_pushButton_clicked()
{
applySettings();
}
*/
void DATVDemodGUI::on_pushButton_2_clicked() void DATVDemodGUI::on_pushButton_2_clicked()
{ {
resetToDefaults(); resetToDefaults();
} }
/*
void DATVDemodGUI::on_spiSampleRate_valueChanged(int arg1)
{
applySettings();
}
*/
void DATVDemodGUI::on_spiSymbolRate_valueChanged(int arg1 __attribute__((unused))) void DATVDemodGUI::on_spiSymbolRate_valueChanged(int arg1 __attribute__((unused)))
{ {
applySettings(); applySettings();
@ -651,21 +640,11 @@ void DATVDemodGUI::on_spiNotchFilters_valueChanged(int arg1 __attribute__((unuse
applySettings(); applySettings();
} }
void DATVDemodGUI::on_chkHDLC_clicked()
{
applySettings();
}
void DATVDemodGUI::on_chkAllowDrift_clicked() void DATVDemodGUI::on_chkAllowDrift_clicked()
{ {
applySettings(); applySettings();
} }
void DATVDemodGUI::on_chkResample_clicked()
{
applySettings();
}
void DATVDemodGUI::on_pushButton_3_clicked() void DATVDemodGUI::on_pushButton_3_clicked()
{ {
@ -677,23 +656,6 @@ void DATVDemodGUI::on_pushButton_3_clicked()
} }
} }
/*
void DATVDemodGUI::on_mediaStateChanged(QMediaPlayer::State state)
{
switch(state)
{
case QMediaPlayer::PlayingState:
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
break;
default:
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
break;
}
ui->lblReadStatus->setText(QString("%1").arg(strLitteralState));
}
*/
void DATVDemodGUI::on_pushButton_4_clicked() void DATVDemodGUI::on_pushButton_4_clicked()
{ {
@ -726,7 +688,7 @@ QString DATVDemodGUI::formatBytes(qint64 intBytes)
void DATVDemodGUI::on_StreamDataAvailable(int *intPackets __attribute__((unused)), int *intBytes, int *intPercent, qint64 *intTotalReceived) void DATVDemodGUI::on_StreamDataAvailable(int *intPackets __attribute__((unused)), int *intBytes, int *intPercent, qint64 *intTotalReceived)
{ {
ui->lblStatus->setText(QString("Decod: %1B").arg(formatBytes(*intTotalReceived))); ui->lblStatus->setText(QString("Data: %1B").arg(formatBytes(*intTotalReceived)));
m_intLastDecodedData = *intTotalReceived; m_intLastDecodedData = *intTotalReceived;
if((*intPercent)<100) if((*intPercent)<100)
@ -752,3 +714,68 @@ void DATVDemodGUI::on_chkFastlock_clicked()
{ {
applySettings(); applySettings();
} }
void DATVDemodGUI::on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData)
{
QString strMetaData="";
if(objMetaData!=NULL)
{
if(objMetaData->OK_TransportStream==true)
{
strMetaData.sprintf("PID: %d - Width: %d - Height: %d\r\n%s%s\r\nCodec: %s\r\n",objMetaData->PID
,objMetaData->Width
,objMetaData->Height
,objMetaData->Program.toStdString().c_str()
,objMetaData->Stream.toStdString().c_str()
,objMetaData->CodecDescription.toStdString().c_str());
}
ui->textEdit->setText(strMetaData);
ui->chkData->setChecked(objMetaData->OK_Data);
ui->chkTS->setChecked(objMetaData->OK_TransportStream);
ui->chkVS->setChecked(objMetaData->OK_VideoStream);
ui->chkDecoding->setChecked(objMetaData->OK_Decoding);
if(objMetaData->OK_Decoding==true)
{
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
}
else
{
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
}
if(objMetaData->Height>0)
{
ui->screenTV_2->setFixedWidth((int)objMetaData->Width*(270.0f/(float)objMetaData->Height));
}
}
}
void DATVDemodGUI::displayRRCParameters(bool blnVisible)
{
ui->spiRollOff->setVisible(blnVisible);
ui->spiExcursion->setVisible(blnVisible);
ui->label_5->setVisible(blnVisible);
ui->label_6->setVisible(blnVisible);
}
void DATVDemodGUI::on_cmbFilter_currentIndexChanged(int index __attribute__((unused)))
{
displayRRCParameters((ui->cmbFilter->currentIndex()==2));
applySettings();
}
void DATVDemodGUI::on_spiRollOff_valueChanged(int arg1 __attribute__((unused)))
{
applySettings();
}
void DATVDemodGUI::on_spiExcursion_valueChanged(int arg1 __attribute__((unused)))
{
applySettings();
}

View File

@ -81,40 +81,38 @@ private slots:
void on_cmbFEC_currentIndexChanged(const QString &arg1); void on_cmbFEC_currentIndexChanged(const QString &arg1);
void on_chkViterbi_clicked(); void on_chkViterbi_clicked();
void on_chkHardMetric_clicked(); void on_chkHardMetric_clicked();
//void on_pushButton_clicked();
void on_pushButton_2_clicked(); void on_pushButton_2_clicked();
//void on_spiSampleRate_valueChanged(int arg1);
void on_spiSymbolRate_valueChanged(int arg1); void on_spiSymbolRate_valueChanged(int arg1);
void on_spiNotchFilters_valueChanged(int arg1); void on_spiNotchFilters_valueChanged(int arg1);
void on_chkHDLC_clicked();
void on_chkAllowDrift_clicked(); void on_chkAllowDrift_clicked();
void on_chkResample_clicked();
void on_pushButton_3_clicked(); void on_pushButton_3_clicked();
void on_pushButton_4_clicked(); void on_pushButton_4_clicked();
void on_mouseEvent(QMouseEvent* obj); void on_mouseEvent(QMouseEvent* obj);
void on_StreamDataAvailable(int *intPackets, int *intBytes, int *intPercent, qint64 *intTotalReceived); void on_StreamDataAvailable(int *intPackets, int *intBytes, int *intPercent, qint64 *intTotalReceived);
void on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData);
void on_spiBandwidth_valueChanged(int arg1); void on_spiBandwidth_valueChanged(int arg1);
void on_chkFastlock_clicked(); void on_chkFastlock_clicked();
void on_cmbFilter_currentIndexChanged(int index);
void on_spiRollOff_valueChanged(int arg1);
void on_spiExcursion_valueChanged(int arg1);
private: private:
Ui::DATVDemodGUI* ui; Ui::DATVDemodGUI* ui;
PluginAPI* m_objPluginAPI; PluginAPI* m_objPluginAPI;
DeviceUISet* m_deviceUISet; DeviceUISet* m_deviceUISet;
//DeviceSourceAPI* m_objDeviceAPI;
ChannelMarker m_objChannelMarker; ChannelMarker m_objChannelMarker;
ThreadedBasebandSampleSink* m_objThreadedChannelizer; ThreadedBasebandSampleSink* m_objThreadedChannelizer;
DownChannelizer* m_objChannelizer; DownChannelizer* m_objChannelizer;
@ -132,7 +130,6 @@ private:
bool m_blnDoApplySettings; bool m_blnDoApplySettings;
bool m_blnButtonPlayClicked; bool m_blnButtonPlayClicked;
//explicit DATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, QWidget* objParent = NULL);
explicit DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* objParent = 0); explicit DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* objParent = 0);
virtual ~DATVDemodGUI(); virtual ~DATVDemodGUI();
@ -140,6 +137,8 @@ private:
void applySettings(); void applySettings();
QString formatBytes(qint64 intBytes); QString formatBytes(qint64 intBytes);
void displayRRCParameters(bool blnVisible);
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(QEvent*); void enterEvent(QEvent*);
}; };

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>512</width> <width>512</width>
<height>520</height> <height>640</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,13 +19,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>512</width> <width>512</width>
<height>520</height> <height>640</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>512</width> <width>512</width>
<height>520</height> <height>640</height>
</size> </size>
</property> </property>
<property name="font"> <property name="font">
@ -97,6 +97,9 @@
<height>220</height> <height>220</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Signal constellation</string>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
@ -128,16 +131,14 @@
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>DVB Standard</string>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>DVB-S</string> <string>DVB-S</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>DVB-S2</string>
</property>
</item>
</widget> </widget>
<widget class="QComboBox" name="cmbModulation"> <widget class="QComboBox" name="cmbModulation">
<property name="geometry"> <property name="geometry">
@ -148,6 +149,9 @@
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Modulation scheme</string>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>BPSK</string> <string>BPSK</string>
@ -203,6 +207,9 @@
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>FEC ratio</string>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>1/2</string> <string>1/2</string>
@ -228,21 +235,6 @@
<string>7/8</string> <string>7/8</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>4/5</string>
</property>
</item>
<item>
<property name="text">
<string>8/9</string>
</property>
</item>
<item>
<property name="text">
<string>9/10</string>
</property>
</item>
</widget> </widget>
<widget class="QCheckBox" name="chkFastlock"> <widget class="QCheckBox" name="chkFastlock">
<property name="geometry"> <property name="geometry">
@ -253,6 +245,9 @@
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Fast signal decode</string>
</property>
<property name="text"> <property name="text">
<string>FAST LOCK</string> <string>FAST LOCK</string>
</property> </property>
@ -261,11 +256,14 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>140</x>
<y>140</y> <y>120</y>
<width>81</width> <width>81</width>
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Viterbi algorithm (CPU intensive)</string>
</property>
<property name="text"> <property name="text">
<string>VITERBI</string> <string>VITERBI</string>
</property> </property>
@ -279,6 +277,9 @@
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Constellation hardening</string>
</property>
<property name="text"> <property name="text">
<string>HARD METRIC</string> <string>HARD METRIC</string>
</property> </property>
@ -309,19 +310,6 @@
<string>Bandwidth</string> <string>Bandwidth</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="chkHDLC">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>HDLC</string>
</property>
</widget>
<widget class="QCheckBox" name="chkAllowDrift"> <widget class="QCheckBox" name="chkAllowDrift">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -331,6 +319,9 @@
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Small frequency drift compensation</string>
</property>
<property name="text"> <property name="text">
<string>ALLOW DRIFT</string> <string>ALLOW DRIFT</string>
</property> </property>
@ -344,6 +335,9 @@
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Number of stray peaks to suppress</string>
</property>
<property name="maximum"> <property name="maximum">
<number>32</number> <number>32</number>
</property> </property>
@ -361,28 +355,18 @@
<string>Notch filter</string> <string>Notch filter</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="chkResample">
<property name="geometry">
<rect>
<x>140</x>
<y>120</y>
<width>85</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>RESAMPLE</string>
</property>
</widget>
<widget class="QProgressBar" name="prgSynchro"> <widget class="QProgressBar" name="prgSynchro">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>70</x>
<y>190</y> <y>200</y>
<width>181</width> <width>181</width>
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Video buffer fill</string>
</property>
<property name="value"> <property name="value">
<number>0</number> <number>0</number>
</property> </property>
@ -391,11 +375,14 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>170</y> <y>180</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Total number of bytes decoded</string>
</property>
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
</property> </property>
@ -404,7 +391,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>230</x> <x>230</x>
<y>140</y> <y>120</y>
<width>21</width> <width>21</width>
<height>22</height> <height>22</height>
</rect> </rect>
@ -422,6 +409,9 @@
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Symbol rate</string>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>
@ -441,6 +431,9 @@
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>RF filter bandwidth</string>
</property>
<property name="minimum"> <property name="minimum">
<number>1000</number> <number>1000</number>
</property> </property>
@ -455,11 +448,14 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>130</x> <x>130</x>
<y>170</y> <y>180</y>
<width>121</width> <width>121</width>
<height>16</height> <height>16</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Stream speed</string>
</property>
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
</property> </property>
@ -468,7 +464,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>190</y> <y>200</y>
<width>61</width> <width>61</width>
<height>15</height> <height>15</height>
</rect> </rect>
@ -477,46 +473,189 @@
<string>Buffer:</string> <string>Buffer:</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="cmbFilter">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>91</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Filter</string>
</property>
<item>
<property name="text">
<string>FIR LINEAR</string>
</property>
</item>
<item>
<property name="text">
<string>FIR NEAREST</string>
</property>
</item>
<item>
<property name="text">
<string>FIR RRC</string>
</property>
</item>
</widget>
<widget class="QSpinBox" name="spiRollOff">
<property name="geometry">
<rect>
<x>140</x>
<y>150</y>
<width>41</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>RRC filter roll off factor </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>35</number>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>106</x>
<y>150</y>
<width>28</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>R.off</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>180</x>
<y>150</y>
<width>28</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Exc</string>
</property>
</widget>
<widget class="QSpinBox" name="spiExcursion">
<property name="geometry">
<rect>
<x>210</x>
<y>150</y>
<width>41</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>Filter excursion (dB)</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</widget> </widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>260</y> <y>250</y>
<width>496</width> <width>496</width>
<height>240</height> <height>385</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>496</width> <width>496</width>
<height>240</height> <height>385</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>496</width> <width>496</width>
<height>240</height> <height>385</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
<string>VIDEO Stream</string> <string>VIDEO Stream</string>
</property> </property>
<widget class="QWidget" name="layoutWidget_2"> <widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>300</y>
<width>281</width>
<height>81</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>400</x>
<y>350</y>
<width>91</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Full screen video (click in the image to return)</string>
</property>
<property name="text">
<string>Full Screen</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>400</x>
<y>300</y>
<width>91</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Start/Stop video streaming</string>
</property>
<property name="text">
<string> Video</string>
</property>
</widget>
<widget class="QWidget" name="formLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>20</y> <y>20</y>
<width>358</width> <width>488</width>
<height>211</height> <height>272</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="screenTVLayout_2"> <layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint"> <item row="0" column="0">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="DATVideoRender" name="screenTV_2" native="true"> <widget class="DATVideoRender" name="screenTV_2" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -526,16 +665,19 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>356</width> <width>480</width>
<height>200</height> <height>270</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>356</width> <width>355</width>
<height>200</height> <height>270</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Video</string>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
@ -543,73 +685,93 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QFrame" name="lblState"> <widget class="QCheckBox" name="chkTS">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>360</x> <x>300</x>
<y>20</y> <y>320</y>
<width>131</width> <width>85</width>
<height>211</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="frameShape"> <property name="toolTip">
<enum>QFrame::StyledPanel</enum> <string>Transport stream detected</string>
</property> </property>
<property name="frameShadow"> <property name="text">
<enum>QFrame::Raised</enum> <string>Transport</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="chkVS">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>300</x>
<y>340</y>
<width>85</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Video data detected</string>
</property>
<property name="text">
<string>Video </string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="chkDecoding">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>300</x>
<y>360</y>
<width>85</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Video being decoded</string>
</property>
<property name="text">
<string>Decoding</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="chkData">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>300</x>
<y>300</y>
<width>85</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>Data being received</string>
</property>
<property name="text">
<string>Data</string>
</property>
<property name="checkable">
<bool>true</bool>
</property> </property>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>111</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string> Video</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>111</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Full Screen</string>
</property>
</widget>
<widget class="QLabel" name="lblRead">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
<widget class="QLabel" name="lblReadStatus">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>

View File

@ -27,7 +27,7 @@
const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor = const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor =
{ {
QString("DATV Demodulator"), QString("DATV Demodulator"),
QString("3.13.0"), QString("3.2.0"),
QString("(c) F4HKW for SDRAngel using LeanSDR framework (c) F4DAV"), QString("(c) F4HKW for SDRAngel using LeanSDR framework (c) F4DAV"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,
@ -52,8 +52,7 @@ void DATVDemodPlugin::initPlugin(PluginAPI* ptrPluginAPI)
m_ptrPluginAPI = ptrPluginAPI; m_ptrPluginAPI = ptrPluginAPI;
// register DATV demodulator // register DATV demodulator
m_ptrPluginAPI->registerRxChannel(DATVDemod::m_channelIdURI, DATVDemod::m_channelId, this); m_ptrPluginAPI->registerRxChannel(DATVDemod::m_channelIdURI, DATVDemod::m_channelId, this);
} }
PluginInstanceGUI* DATVDemodPlugin::createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) PluginInstanceGUI* DATVDemodPlugin::createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)

View File

@ -108,7 +108,7 @@ static int64_t SeekFunction(void* opaque, int64_t offset, int whence)
return objStream->pos(); return objStream->pos();
} }
bool DATVideoRender::InitializeFFMPEG() void DATVideoRender::ResetMetaData()
{ {
MetaData.CodecID=-1; MetaData.CodecID=-1;
MetaData.PID=-1; MetaData.PID=-1;
@ -120,7 +120,18 @@ bool DATVideoRender::InitializeFFMPEG()
MetaData.Channels=-1; MetaData.Channels=-1;
MetaData.CodecDescription= ""; MetaData.CodecDescription= "";
if(m_blnIsFFMPEGInitialized==true) MetaData.OK_Decoding=false;
MetaData.OK_TransportStream=false;
MetaData.OK_VideoStream=false;
emit onMetaDataChanged(&MetaData);
}
bool DATVideoRender::InitializeFFMPEG()
{
ResetMetaData();
if(m_blnIsFFMPEGInitialized)
{ {
return false; return false;
} }
@ -175,6 +186,8 @@ bool DATVideoRender::PreprocessStream()
MetaData.PID = m_objFormatCtx->streams[m_intVideoStreamIndex]->id; MetaData.PID = m_objFormatCtx->streams[m_intVideoStreamIndex]->id;
MetaData.CodecID = m_objDecoderCtx->codec_id; MetaData.CodecID = m_objDecoderCtx->codec_id;
MetaData.OK_TransportStream = true;
MetaData.Program=""; MetaData.Program="";
MetaData.Stream=""; MetaData.Stream="";
@ -199,6 +212,8 @@ bool DATVideoRender::PreprocessStream()
MetaData.Stream = QString("%1").arg(objBuffer); MetaData.Stream = QString("%1").arg(objBuffer);
} }
emit onMetaDataChanged(&MetaData);
//Decoder //Decoder
objCodec = avcodec_find_decoder(m_objDecoderCtx->codec_id); objCodec = avcodec_find_decoder(m_objDecoderCtx->codec_id);
if(objCodec==NULL) if(objCodec==NULL)
@ -238,10 +253,14 @@ bool DATVideoRender::PreprocessStream()
MetaData.Width=m_objDecoderCtx->width; MetaData.Width=m_objDecoderCtx->width;
MetaData.Height=m_objDecoderCtx->height; MetaData.Height=m_objDecoderCtx->height;
MetaData.BitRate=m_objDecoderCtx->bit_rate; MetaData.BitRate= m_objDecoderCtx->bit_rate;
MetaData.Channels=m_objDecoderCtx->channels; MetaData.Channels=m_objDecoderCtx->channels;
MetaData.CodecDescription= QString("%1").arg(objCodec->long_name); MetaData.CodecDescription= QString("%1").arg(objCodec->long_name);
MetaData.OK_VideoStream = true;
emit onMetaDataChanged(&MetaData);
return true; return true;
} }
@ -251,13 +270,11 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
unsigned char * ptrIOBuffer = NULL; unsigned char * ptrIOBuffer = NULL;
AVIOContext * objIOCtx = NULL; AVIOContext * objIOCtx = NULL;
if(m_blnRunning==true) if(m_blnRunning)
{ {
return false; return false;
} }
//Only once execution
m_blnRunning=true;
if(objDevice==NULL) if(objDevice==NULL)
{ {
@ -266,19 +283,40 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
return false; return false;
} }
if(m_blnIsOpen==true)
if(m_blnIsOpen)
{ {
qDebug() << "DATVideoProcess::OpenStream already open"; qDebug() << "DATVideoProcess::OpenStream already open";
return false; return false;
} }
if(objDevice->bytesAvailable()<=0)
{
qDebug() << "DATVideoProcess::OpenStream no data available";
MetaData.OK_Data=false;
emit onMetaDataChanged(&MetaData);
return false;
}
//Only once execution
m_blnRunning=true;
MetaData.OK_Data=true;
emit onMetaDataChanged(&MetaData);
InitializeFFMPEG(); InitializeFFMPEG();
if(!m_blnIsFFMPEGInitialized) if(!m_blnIsFFMPEGInitialized)
{ {
qDebug() << "DATVideoProcess::OpenStream FFMPEG not initialized"; qDebug() << "DATVideoProcess::OpenStream FFMPEG not initialized";
m_blnRunning=false;
return false; return false;
} }
@ -286,9 +324,11 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
{ {
qDebug() << "DATVideoProcess::OpenStream cannot open QIODevice"; qDebug() << "DATVideoProcess::OpenStream cannot open QIODevice";
m_blnRunning=false;
return false; return false;
} }
//Connect QIODevice to FFMPEG Reader //Connect QIODevice to FFMPEG Reader
m_objFormatCtx = avformat_alloc_context(); m_objFormatCtx = avformat_alloc_context();
@ -297,6 +337,7 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
{ {
qDebug() << "DATVideoProcess::OpenStream cannot alloc format FFMPEG context"; qDebug() << "DATVideoProcess::OpenStream cannot alloc format FFMPEG context";
m_blnRunning=false;
return false; return false;
} }
@ -318,12 +359,13 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
{ {
qDebug() << "DATVideoProcess::OpenStream cannot open stream"; qDebug() << "DATVideoProcess::OpenStream cannot open stream";
m_blnRunning=false;
return false; return false;
} }
if(!PreprocessStream()) if(!PreprocessStream())
{ {
m_blnRunning=false;
return false; return false;
} }
@ -341,14 +383,14 @@ bool DATVideoRender::RenderStream()
int intGotFrame; int intGotFrame;
bool blnNeedRenderingSetup; bool blnNeedRenderingSetup;
if (!m_blnIsOpen) if(!m_blnIsOpen)
{ {
qDebug() << "DATVideoProcess::RenderStream: Stream not open"; qDebug() << "DATVideoProcess::RenderStream Stream not open";
return false; return false;
} }
if (m_blnRunning) if(m_blnRunning)
{ {
return false; return false;
} }
@ -413,7 +455,7 @@ bool DATVideoRender::RenderStream()
av_opt_set_int(m_objSwsCtx,"dsth",m_objFrame->height,0); av_opt_set_int(m_objSwsCtx,"dsth",m_objFrame->height,0);
av_opt_set_int(m_objSwsCtx,"dst_format",AV_PIX_FMT_RGB24 ,0); av_opt_set_int(m_objSwsCtx,"dst_format",AV_PIX_FMT_RGB24 ,0);
av_opt_set_int(m_objSwsCtx,"sws_flag",SWS_FAST_BILINEAR /* SWS_BICUBIC*/,0); av_opt_set_int(m_objSwsCtx,"sws_flag", SWS_FAST_BILINEAR /* SWS_BICUBIC*/,0);
if(sws_init_context(m_objSwsCtx, NULL, NULL)<0) if(sws_init_context(m_objSwsCtx, NULL, NULL)<0)
{ {
@ -455,6 +497,8 @@ bool DATVideoRender::RenderStream()
MetaData.Width = m_objFrame->width; MetaData.Width = m_objFrame->width;
MetaData.Height = m_objFrame->height; MetaData.Height = m_objFrame->height;
MetaData.OK_Decoding = true;
emit onMetaDataChanged(&MetaData);
} }
//Frame rendering //Frame rendering
@ -482,25 +526,17 @@ bool DATVideoRender::RenderStream()
m_blnRunning=false; m_blnRunning=false;
//AVDictionaryEntry *objRslt= av_dict_get(fmt_ctx->programs[video_stream_index]->metadata,"service_provider",NULL,0);
//char objErrBuf[1024];
//memset(objErrBuf,0,1024);
//av_strerror(ret,objErrBuf,1024);
return true; return true;
} }
bool DATVideoRender::CloseStream(QIODevice *objDevice) bool DATVideoRender::CloseStream(QIODevice *objDevice)
{ {
if(m_blnRunning==true) if(m_blnRunning)
{ {
return false; return false;
} }
//Only once execution
m_blnRunning=true;
if(!objDevice) if(!objDevice)
{ {
qDebug() << "DATVideoProcess::CloseStream QIODevice is NULL"; qDebug() << "DATVideoProcess::CloseStream QIODevice is NULL";
@ -508,9 +544,9 @@ bool DATVideoRender::CloseStream(QIODevice *objDevice)
return false; return false;
} }
if (!m_blnIsOpen) if(!m_blnIsOpen)
{ {
qDebug() << "DATVideoProcess::CloseStream: Stream not open"; qDebug() << "DATVideoProcess::CloseStream Stream not open";
return false; return false;
} }
@ -522,6 +558,9 @@ bool DATVideoRender::CloseStream(QIODevice *objDevice)
return false; return false;
} }
//Only once execution
m_blnRunning=true;
avformat_close_input(&m_objFormatCtx); avformat_close_input(&m_objFormatCtx);
m_objFormatCtx=NULL; m_objFormatCtx=NULL;
@ -531,7 +570,6 @@ bool DATVideoRender::CloseStream(QIODevice *objDevice)
m_objDecoderCtx=NULL; m_objDecoderCtx=NULL;
} }
if(m_objFrame) if(m_objFrame)
{ {
av_frame_unref(m_objFrame); av_frame_unref(m_objFrame);
@ -553,5 +591,8 @@ bool DATVideoRender::CloseStream(QIODevice *objDevice)
m_intCurrentRenderWidth=-1; m_intCurrentRenderWidth=-1;
m_intCurrentRenderHeight=-1; m_intCurrentRenderHeight=-1;
ResetMetaData();
emit onMetaDataChanged(&MetaData);
return true; return true;
} }

View File

@ -39,13 +39,18 @@ extern "C"
#include <libavutil/samplefmt.h> #include <libavutil/samplefmt.h>
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
} }
struct DataTSMetaData2 struct DataTSMetaData2
{ {
int PID; int PID;
int CodecID; int CodecID;
bool OK_Data;
bool OK_Decoding;
bool OK_TransportStream;
bool OK_VideoStream;
QString Program; QString Program;
QString Stream; QString Stream;
@ -53,12 +58,16 @@ struct DataTSMetaData2
int Height; int Height;
int BitRate; int BitRate;
int Channels; int Channels;
QString CodecDescription; QString CodecDescription;
DataTSMetaData2() DataTSMetaData2()
{ {
PID=-1; PID=-1;
CodecID=-1; CodecID=-1;
Program=""; Program="";
Stream=""; Stream="";
@ -67,12 +76,19 @@ struct DataTSMetaData2
BitRate=-1; BitRate=-1;
Channels=-1; Channels=-1;
CodecDescription=""; CodecDescription="";
OK_Data=false;
OK_Decoding=false;
OK_TransportStream=false;
OK_VideoStream=false;
} }
}; };
class DATVideoRender : public DATVScreen class DATVideoRender : public DATVScreen
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DATVideoRender(QWidget * parent); explicit DATVideoRender(QWidget * parent);
void SetFullScreen(bool blnFullScreen); void SetFullScreen(bool blnFullScreen);
@ -106,18 +122,17 @@ private:
bool InitializeFFMPEG(); bool InitializeFFMPEG();
bool PreprocessStream(); bool PreprocessStream();
void ResetMetaData();
protected: protected:
virtual bool eventFilter(QObject *obj, QEvent *event); virtual bool eventFilter(QObject *obj, QEvent *event);
signals: signals:
void onMetaDataChanged(DataTSMetaData2 *objMetaData);
public slots:
}; };
//To run Video Rendering with a dedicated thread
class DATVideoRenderThread: public QThread class DATVideoRenderThread: public QThread
{ {
@ -141,12 +156,11 @@ class DATVideoRenderThread: public QThread
m_objRenderer = objRenderer; m_objRenderer = objRenderer;
m_objStream = objStream; m_objStream = objStream;
m_blnRenderingVideo=false; m_blnRenderingVideo=false;
} }
void run() void run()
{ {
if(m_blnRenderingVideo==true) if(m_blnRenderingVideo)
{ {
return; return;
} }
@ -156,19 +170,11 @@ class DATVideoRenderThread: public QThread
return ; return ;
} }
m_blnRenderingVideo=false; m_blnRenderingVideo = m_objRenderer->OpenStream(m_objStream);
if(m_objRenderer->OpenStream(m_objStream)) if(!m_blnRenderingVideo)
{ {
qInfo("DATVideoRenderThread::run: PID: %d W: %d H: %d Codec: %s Data: %s Service: %s", return;
m_objRenderer->MetaData.PID,
m_objRenderer->MetaData.Width,
m_objRenderer->MetaData.Height,
m_objRenderer->MetaData.CodecDescription.toStdString().c_str(),
m_objRenderer->MetaData.Program.toStdString().c_str(),
m_objRenderer->MetaData.Stream.toStdString().c_str());
m_blnRenderingVideo=true;
} }
while((m_objRenderer->RenderStream()) && (m_blnRenderingVideo==true)) while((m_objRenderer->RenderStream()) && (m_blnRenderingVideo==true))
@ -177,6 +183,8 @@ class DATVideoRenderThread: public QThread
m_objRenderer->CloseStream(m_objStream); m_objRenderer->CloseStream(m_objStream);
m_blnRenderingVideo=false;
} }
void stopRendering() void stopRendering()
@ -186,7 +194,6 @@ class DATVideoRenderThread: public QThread
private: private:
DATVideoRender *m_objRenderer; DATVideoRender *m_objRenderer;
DATVideostream *m_objStream; DATVideostream *m_objStream;
bool m_blnRenderingVideo; bool m_blnRenderingVideo;

View File

@ -26,6 +26,7 @@ DATVideostream::DATVideostream():
m_intPacketReceived=0; m_intPacketReceived=0;
m_intMemoryLimit = DefaultMemoryLimit; m_intMemoryLimit = DefaultMemoryLimit;
MultiThreaded=false; MultiThreaded=false;
ThreadTimeOut=-1;
m_objeventLoop.connect(this,SIGNAL(onDataAvailable()), &m_objeventLoop, SLOT(quit()),Qt::QueuedConnection); m_objeventLoop.connect(this,SIGNAL(onDataAvailable()), &m_objeventLoop, SLOT(quit()),Qt::QueuedConnection);
} }
@ -115,7 +116,7 @@ int DATVideostream::pushData(const char * chrData, int intSize)
} }
bool DATVideostream::isSequential() const bool DATVideostream::isSequential() const
{ {
return true; return true;
} }
@ -139,10 +140,11 @@ bool DATVideostream::open(OpenMode mode)
//PROTECTED //PROTECTED
qint64 DATVideostream::readData(char *data, qint64 len) qint64 DATVideostream::readData(char *data, qint64 len)
{ {
QByteArray objCurrentArray; QByteArray objCurrentArray;
int intEffectiveLen=0; int intEffectiveLen=0;
int intExpectedLen=0; int intExpectedLen=0;
int intThreadLoop=0;
intExpectedLen = (int) len; intExpectedLen = (int) len;
@ -160,15 +162,25 @@ qint64 DATVideostream::readData(char *data, qint64 len)
//DATA in FIFO ? -> Waiting for DATA //DATA in FIFO ? -> Waiting for DATA
if((m_objFIFO.isEmpty()) || (m_objFIFO.count()<MinStackSize)) if((m_objFIFO.isEmpty()) || (m_objFIFO.count()<MinStackSize))
//|| (m_intBytesWaiting<10*len))
{ {
m_objMutex.unlock(); m_objMutex.unlock();
if(MultiThreaded==true) if(MultiThreaded==true)
{ {
intThreadLoop=0;
while((m_objFIFO.isEmpty()) || (m_objFIFO.count()<MinStackSize)) while((m_objFIFO.isEmpty()) || (m_objFIFO.count()<MinStackSize))
{ {
QThread::msleep(5); QThread::msleep(5);
intThreadLoop ++;
if(ThreadTimeOut>=0)
{
if(intThreadLoop*5>ThreadTimeOut)
{
return -1;
}
}
} }
} }
else else
@ -212,12 +224,12 @@ qint64 DATVideostream::readData(char *data, qint64 len)
return (qint64)intEffectiveLen; return (qint64)intEffectiveLen;
} }
qint64 DATVideostream::writeData(const char *data, qint64 len) qint64 DATVideostream::writeData(const char *data __attribute__((unused)), qint64 len __attribute__((unused)))
{ {
return 0; return 0;
} }
qint64 DATVideostream::readLineData(char *data, qint64 maxSize) qint64 DATVideostream::readLineData(char *data __attribute__((unused)), qint64 maxSize __attribute__((unused)))
{ {
return 0; return 0;
} }

View File

@ -37,6 +37,7 @@ public:
~DATVideostream(); ~DATVideostream();
bool MultiThreaded; bool MultiThreaded;
int ThreadTimeOut;
int pushData(const char * chrData, int intSize); int pushData(const char * chrData, int intSize);
bool setMemoryLimit(int intMemoryLimit); bool setMemoryLimit(int intMemoryLimit);

View File

@ -52,7 +52,7 @@ DATVScreen::~DATVScreen()
QRgb* DATVScreen::getRowBuffer(int intRow) QRgb* DATVScreen::getRowBuffer(int intRow)
{ {
if (m_blnGLContextInitialized == false) if (!m_blnGLContextInitialized)
{ {
return NULL; return NULL;
} }
@ -161,7 +161,7 @@ void DATVScreen::paintGL()
m_objMutex.unlock(); m_objMutex.unlock();
} }
void DATVScreen::mousePressEvent(QMouseEvent* event) void DATVScreen::mousePressEvent(QMouseEvent* event __attribute__((unused)))
{ {
} }
@ -194,13 +194,20 @@ bool DATVScreen::selectRow(int intLine)
{ {
return m_objGLShaderArray.SelectRow(intLine); return m_objGLShaderArray.SelectRow(intLine);
} }
else
{
return false;
}
} }
bool DATVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue) bool DATVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue)
{ {
if (m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
return m_objGLShaderArray.SetDataColor(intCol, return m_objGLShaderArray.SetDataColor(intCol, qRgb(intRed, intGreen, intBlue));
qRgb(intRed, intGreen, intBlue)); }
} else
{
return false;
}
} }

View File

@ -33,12 +33,8 @@
#include "util/export.h" #include "util/export.h"
#include "util/bitfieldindex.h" #include "util/bitfieldindex.h"
class QPainter; class QPainter;
class SDRANGEL_API DATVScreen: public QGLWidget class SDRANGEL_API DATVScreen: public QGLWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -23,32 +23,42 @@
namespace leansdr namespace leansdr
{ {
template<typename T> struct datvvideoplayer : runnable template<typename T> struct datvvideoplayer: runnable
{
datvvideoplayer(scheduler *sch, pipebuf<T> &_in, DATVideostream * objVideoStream) :
runnable(sch, _in.name), in(_in), m_objVideoStream(objVideoStream)
{ {
datvvideoplayer(scheduler *sch, pipebuf<T> &_in, DATVideostream * objVideoStream) : }
runnable(sch, _in.name),
in(_in),
m_objVideoStream(objVideoStream)
{
}
void run() void run()
{ {
int size = in.readable() * sizeof(T); int size = in.readable() * sizeof(T);
if ( ! size ) return; if (!size)
return;
int nw = m_objVideoStream->pushData((const char *)in.rd(),size); int nw = m_objVideoStream->pushData((const char *) in.rd(), size);
if ( ! nw ) fatal("pipe"); if (!nw)
if ( nw < 0 ) fatal("write"); {
if ( nw % sizeof(T) ) fatal("partial write"); fatal("leansdr::datvvideoplayer::run: pipe");
in.read(nw/sizeof(T)); return;
}
} if (nw < 0)
private: {
pipereader<T> in; fatal("leansdr::datvvideoplayer::run: write");
DATVideostream * m_objVideoStream; return;
}; }
if (nw % sizeof(T))
{
fatal("leansdr::datvvideoplayer::run: partial write");
return;
}
in.read(nw / sizeof(T));
}
private:
pipereader<T> in;
DATVideostream * m_objVideoStream;
};
} }

View File

@ -126,7 +126,7 @@ void GLShaderArray::InitializeGL(int intCols, int intRows)
QRgb * GLShaderArray::GetRowBuffer(int intRow) QRgb * GLShaderArray::GetRowBuffer(int intRow)
{ {
if (m_blnInitialized == false) if (!m_blnInitialized)
{ {
return 0; return 0;
} }
@ -167,7 +167,7 @@ void GLShaderArray::RenderPixels(unsigned char *chrData)
QRgb *ptrLine; QRgb *ptrLine;
if (m_blnInitialized == false) if (!m_blnInitialized)
{ {
return; return;
} }