mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-24 11:12:27 -04:00
DATV demod: formatted code
This commit is contained in:
parent
18e20d36bf
commit
7b9cb0e9fe
@ -24,8 +24,7 @@
|
|||||||
#include "leansdr/framework.h"
|
#include "leansdr/framework.h"
|
||||||
#include "gui/tvscreen.h"
|
#include "gui/tvscreen.h"
|
||||||
|
|
||||||
namespace leansdr
|
namespace leansdr {
|
||||||
{
|
|
||||||
|
|
||||||
static const int DEFAULT_GUI_DECIMATION = 64;
|
static const int DEFAULT_GUI_DECIMATION = 64;
|
||||||
|
|
||||||
@ -41,7 +40,13 @@ template<typename T> struct datvconstellation: runnable
|
|||||||
std::vector<int> cstln_rows;
|
std::vector<int> cstln_rows;
|
||||||
std::vector<int> cstln_cols;
|
std::vector<int> cstln_cols;
|
||||||
|
|
||||||
datvconstellation(scheduler *sch, pipebuf<complex<T> > &_in, T _xymin, T _xymax, const char *_name = 0, TVScreen *objDATVScreen = 0) :
|
datvconstellation(
|
||||||
|
scheduler *sch,
|
||||||
|
pipebuf<complex<T> > &_in,
|
||||||
|
T _xymin,
|
||||||
|
T _xymax,
|
||||||
|
const char *_name = nullptr,
|
||||||
|
TVScreen *objDATVScreen = nullptr) :
|
||||||
runnable(sch, _name ? _name : _in.name),
|
runnable(sch, _name ? _name : _in.name),
|
||||||
xymin(_xymin),
|
xymin(_xymin),
|
||||||
xymax(_xymax),
|
xymax(_xymax),
|
||||||
@ -57,7 +62,6 @@ template<typename T> struct datvconstellation: runnable
|
|||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
//Symbols
|
//Symbols
|
||||||
|
|
||||||
while (in.readable() >= pixels_per_frame)
|
while (in.readable() >= pixels_per_frame)
|
||||||
{
|
{
|
||||||
if ((!phase) && m_objDATVScreen)
|
if ((!phase) && m_objDATVScreen)
|
||||||
@ -69,13 +73,14 @@ template<typename T> struct datvconstellation: runnable
|
|||||||
for (; p < pend; ++p)
|
for (; p < pend; ++p)
|
||||||
{
|
{
|
||||||
m_objDATVScreen->selectRow(256 * (p->re - xymin) / (xymax - xymin));
|
m_objDATVScreen->selectRow(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cstln && (*cstln))
|
if (cstln && (*cstln))
|
||||||
{
|
{
|
||||||
// Plot constellation points
|
// Plot constellation points
|
||||||
|
|
||||||
std::vector<int>::const_iterator row_it = cstln_rows.begin();
|
std::vector<int>::const_iterator row_it = cstln_rows.begin();
|
||||||
std::vector<int>::const_iterator col_it = cstln_cols.begin();
|
std::vector<int>::const_iterator col_it = cstln_cols.begin();
|
||||||
|
|
||||||
@ -91,8 +96,7 @@ template<typename T> struct datvconstellation: runnable
|
|||||||
|
|
||||||
in.read(pixels_per_frame);
|
in.read(pixels_per_frame);
|
||||||
|
|
||||||
if (++phase >= decimation)
|
if (++phase >= decimation) {
|
||||||
{
|
|
||||||
phase = 0;
|
phase = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,6 +132,6 @@ template<typename T> struct datvconstellation: runnable
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // leansdr
|
||||||
|
|
||||||
#endif // DATVCONSTELLATION_H
|
#endif // DATVCONSTELLATION_H
|
||||||
|
@ -41,8 +41,8 @@ DATVDemod::DATVDemod(DeviceSourceAPI *deviceAPI) :
|
|||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_objRegisteredTVScreen(0),
|
m_objRegisteredTVScreen(0),
|
||||||
m_objRegisteredVideoRender(0),
|
m_objRegisteredVideoRender(0),
|
||||||
m_objVideoStream(NULL),
|
m_objVideoStream(nullptr),
|
||||||
m_objRenderThread(NULL),
|
m_objRenderThread(nullptr),
|
||||||
m_blnRenderingVideo(false),
|
m_blnRenderingVideo(false),
|
||||||
m_blnStartStopVideo(false),
|
m_blnStartStopVideo(false),
|
||||||
m_enmModulation(BPSK /*DATV_FM1*/),
|
m_enmModulation(BPSK /*DATV_FM1*/),
|
||||||
@ -68,13 +68,13 @@ DATVDemod::~DATVDemod()
|
|||||||
{
|
{
|
||||||
m_blnInitialized=false;
|
m_blnInitialized=false;
|
||||||
|
|
||||||
if(m_objVideoStream!=NULL)
|
if(m_objVideoStream!=nullptr)
|
||||||
{
|
{
|
||||||
//Immediately exit from DATVideoStream if waiting for data before killing thread
|
//Immediately exit from DATVideoStream if waiting for data before killing thread
|
||||||
m_objVideoStream->ThreadTimeOut=0;
|
m_objVideoStream->ThreadTimeOut=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_objRenderThread!=NULL)
|
if(m_objRenderThread!=nullptr)
|
||||||
{
|
{
|
||||||
if(m_objRenderThread->isRunning())
|
if(m_objRenderThread->isRunning())
|
||||||
{
|
{
|
||||||
@ -113,35 +113,29 @@ DATVideostream * DATVDemod::SetVideoRender(DATVideoRender *objScreen)
|
|||||||
bool DATVDemod::PlayVideo(bool blnStartStop)
|
bool DATVDemod::PlayVideo(bool blnStartStop)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(m_objVideoStream==NULL)
|
if (m_objVideoStream == nullptr) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_objRegisteredVideoRender==NULL)
|
if (m_objRegisteredVideoRender == nullptr) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_objRenderThread==NULL)
|
if (m_objRenderThread == nullptr) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_blnStartStopVideo && !blnStartStop)
|
if (m_blnStartStopVideo && !blnStartStop) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blnStartStop==true)
|
if (blnStartStop == true) {
|
||||||
{
|
|
||||||
m_blnStartStopVideo = true;
|
m_blnStartStopVideo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_objRenderThread->isRunning())
|
if (m_objRenderThread->isRunning())
|
||||||
{
|
{
|
||||||
if(blnStartStop==true)
|
if (blnStartStop == true) {
|
||||||
{
|
|
||||||
m_objRenderThread->stopRendering();
|
m_objRenderThread->stopRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +234,7 @@ void DATVDemod::CleanUpDATVFramework(bool blnRelease)
|
|||||||
{
|
{
|
||||||
if (blnRelease == true)
|
if (blnRelease == true)
|
||||||
{
|
{
|
||||||
if(m_objScheduler!=NULL)
|
if (m_objScheduler != nullptr)
|
||||||
{
|
{
|
||||||
m_objScheduler->shutdown();
|
m_objScheduler->shutdown();
|
||||||
delete m_objScheduler;
|
delete m_objScheduler;
|
||||||
@ -248,175 +242,258 @@ void DATVDemod::CleanUpDATVFramework(bool blnRelease)
|
|||||||
|
|
||||||
// NOTCH FILTER
|
// NOTCH FILTER
|
||||||
|
|
||||||
if(r_auto_notch!=NULL) delete r_auto_notch;
|
if (r_auto_notch != nullptr) {
|
||||||
if(p_autonotched!=NULL) delete p_autonotched;
|
delete r_auto_notch;
|
||||||
|
}
|
||||||
// FREQUENCY CORRECTION : DEROTATOR
|
if (p_autonotched != nullptr) {
|
||||||
if(p_derot!=NULL) delete p_derot;
|
delete p_autonotched;
|
||||||
if(r_derot!=NULL) delete r_derot;
|
|
||||||
|
|
||||||
// CNR ESTIMATION
|
|
||||||
if(p_cnr!=NULL) delete p_cnr;
|
|
||||||
if(r_cnr!=NULL) delete r_cnr;
|
|
||||||
|
|
||||||
//FILTERING
|
|
||||||
if(r_resample!=NULL) delete r_resample;
|
|
||||||
if(p_resampled!=NULL) delete p_resampled;
|
|
||||||
if(coeffs!=NULL) delete coeffs;
|
|
||||||
|
|
||||||
// OUTPUT PREPROCESSED DATA
|
|
||||||
if(sampler!=NULL) delete sampler;
|
|
||||||
if(coeffs_sampler!=NULL) delete coeffs_sampler;
|
|
||||||
if(p_symbols!=NULL) delete p_symbols;
|
|
||||||
if(p_freq!=NULL) delete p_freq;
|
|
||||||
if(p_ss!=NULL) delete p_ss;
|
|
||||||
if(p_mer!=NULL) delete p_mer;
|
|
||||||
if(p_sampled!=NULL) delete p_sampled;
|
|
||||||
|
|
||||||
//DECIMATION
|
|
||||||
if(p_decimated!=NULL) delete p_decimated;
|
|
||||||
if(p_decim!=NULL) delete p_decim;
|
|
||||||
if(r_ppout!=NULL) delete r_ppout;
|
|
||||||
|
|
||||||
|
|
||||||
//GENERIC CONSTELLATION RECEIVER
|
|
||||||
if(m_objDemodulator!=NULL) delete m_objDemodulator;
|
|
||||||
|
|
||||||
//DECONVOLUTION AND SYNCHRONIZATION
|
|
||||||
if(p_bytes!=NULL) delete p_bytes;
|
|
||||||
if(r_deconv!=NULL) delete r_deconv;
|
|
||||||
if(r!=NULL) delete r;
|
|
||||||
if(p_descrambled!=NULL) delete p_descrambled;
|
|
||||||
if(p_frames!=NULL) delete p_frames;
|
|
||||||
if(r_etr192_descrambler!=NULL) delete r_etr192_descrambler;
|
|
||||||
if(r_sync!=NULL) delete r_sync;
|
|
||||||
if(p_mpegbytes!=NULL) delete p_mpegbytes;
|
|
||||||
if(p_lock!=NULL) delete p_lock;
|
|
||||||
if(p_locktime!=NULL) delete p_locktime;
|
|
||||||
if(r_sync_mpeg!=NULL) delete r_sync_mpeg;
|
|
||||||
|
|
||||||
|
|
||||||
// DEINTERLEAVING
|
|
||||||
if(p_rspackets!=NULL) delete p_rspackets;
|
|
||||||
if(r_deinter!=NULL) delete r_deinter;
|
|
||||||
if(p_vbitcount!=NULL) delete p_vbitcount;
|
|
||||||
if(p_verrcount!=NULL) delete p_verrcount;
|
|
||||||
if(p_rtspackets!=NULL) delete p_rtspackets;
|
|
||||||
if(r_rsdec!=NULL) delete r_rsdec;
|
|
||||||
|
|
||||||
//BER ESTIMATION
|
|
||||||
if(p_vber!=NULL) delete p_vber;
|
|
||||||
if(r_vber!=NULL) delete r_vber;
|
|
||||||
|
|
||||||
// DERANDOMIZATION
|
|
||||||
if(p_tspackets!=NULL) delete p_tspackets;
|
|
||||||
if(r_derand!=NULL) delete r_derand;
|
|
||||||
|
|
||||||
|
|
||||||
//OUTPUT : To remove
|
|
||||||
if(r_stdout!=NULL) delete r_stdout;
|
|
||||||
if(r_videoplayer!=NULL) delete r_videoplayer;
|
|
||||||
|
|
||||||
//CONSTELLATION
|
|
||||||
if(r_scope_symbols!=NULL) delete r_scope_symbols;
|
|
||||||
|
|
||||||
// INPUT
|
|
||||||
//if(p_rawiq!=NULL) delete p_rawiq;
|
|
||||||
//if(p_rawiq_writer!=NULL) delete p_rawiq_writer;
|
|
||||||
//if(p_preprocessed!=NULL) delete p_preprocessed;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objScheduler=NULL;
|
// FREQUENCY CORRECTION : DEROTATOR
|
||||||
|
if (p_derot != nullptr) {
|
||||||
|
delete p_derot;
|
||||||
|
}
|
||||||
|
if (r_derot != nullptr) {
|
||||||
|
delete r_derot;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CNR ESTIMATION
|
||||||
|
if (p_cnr != nullptr) {
|
||||||
|
delete p_cnr;
|
||||||
|
}
|
||||||
|
if (r_cnr != nullptr) {
|
||||||
|
delete r_cnr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//FILTERING
|
||||||
|
if (r_resample != nullptr) {
|
||||||
|
delete r_resample;
|
||||||
|
}
|
||||||
|
if (p_resampled != nullptr) {
|
||||||
|
delete p_resampled;
|
||||||
|
}
|
||||||
|
if (coeffs != nullptr) {
|
||||||
|
delete coeffs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OUTPUT PREPROCESSED DATA
|
||||||
|
if (sampler != nullptr) {
|
||||||
|
delete sampler;
|
||||||
|
}
|
||||||
|
if (coeffs_sampler != nullptr) {
|
||||||
|
delete coeffs_sampler;
|
||||||
|
}
|
||||||
|
if (p_symbols != nullptr) {
|
||||||
|
delete p_symbols;
|
||||||
|
}
|
||||||
|
if (p_freq != nullptr) {
|
||||||
|
delete p_freq;
|
||||||
|
}
|
||||||
|
if (p_ss != nullptr) {
|
||||||
|
delete p_ss;
|
||||||
|
}
|
||||||
|
if (p_mer != nullptr) {
|
||||||
|
delete p_mer;
|
||||||
|
}
|
||||||
|
if (p_sampled != nullptr) {
|
||||||
|
delete p_sampled;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DECIMATION
|
||||||
|
if (p_decimated != nullptr) {
|
||||||
|
delete p_decimated;
|
||||||
|
}
|
||||||
|
if (p_decim != nullptr) {
|
||||||
|
delete p_decim;
|
||||||
|
}
|
||||||
|
if (r_ppout != nullptr) {
|
||||||
|
delete r_ppout;
|
||||||
|
}
|
||||||
|
|
||||||
|
//GENERIC CONSTELLATION RECEIVER
|
||||||
|
if (m_objDemodulator != nullptr) {
|
||||||
|
delete m_objDemodulator;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DECONVOLUTION AND SYNCHRONIZATION
|
||||||
|
if (p_bytes != nullptr) {
|
||||||
|
delete p_bytes;
|
||||||
|
}
|
||||||
|
if (r_deconv != nullptr) {
|
||||||
|
delete r_deconv;
|
||||||
|
}
|
||||||
|
if (r != nullptr) {
|
||||||
|
delete r;
|
||||||
|
}
|
||||||
|
if (p_descrambled != nullptr) {
|
||||||
|
delete p_descrambled;
|
||||||
|
}
|
||||||
|
if (p_frames != nullptr) {
|
||||||
|
delete p_frames;
|
||||||
|
}
|
||||||
|
if (r_etr192_descrambler != nullptr) {
|
||||||
|
delete r_etr192_descrambler;
|
||||||
|
}
|
||||||
|
if (r_sync != nullptr) {
|
||||||
|
delete r_sync;
|
||||||
|
}
|
||||||
|
if (p_mpegbytes != nullptr) {
|
||||||
|
delete p_mpegbytes;
|
||||||
|
}
|
||||||
|
if (p_lock != nullptr) {
|
||||||
|
delete p_lock;
|
||||||
|
}
|
||||||
|
if (p_locktime != nullptr) {
|
||||||
|
delete p_locktime;
|
||||||
|
}
|
||||||
|
if (r_sync_mpeg != nullptr) {
|
||||||
|
delete r_sync_mpeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEINTERLEAVING
|
||||||
|
if (p_rspackets != nullptr) {
|
||||||
|
delete p_rspackets;
|
||||||
|
}
|
||||||
|
if (r_deinter != nullptr) {
|
||||||
|
delete r_deinter;
|
||||||
|
}
|
||||||
|
if (p_vbitcount != nullptr) {
|
||||||
|
delete p_vbitcount;
|
||||||
|
}
|
||||||
|
if (p_verrcount != nullptr) {
|
||||||
|
delete p_verrcount;
|
||||||
|
}
|
||||||
|
if (p_rtspackets != nullptr) {
|
||||||
|
delete p_rtspackets;
|
||||||
|
}
|
||||||
|
if (r_rsdec != nullptr) {
|
||||||
|
delete r_rsdec;
|
||||||
|
}
|
||||||
|
|
||||||
|
//BER ESTIMATION
|
||||||
|
if (p_vber != nullptr) {
|
||||||
|
delete p_vber;
|
||||||
|
}
|
||||||
|
if (r_vber != nullptr) {
|
||||||
|
delete r_vber;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DERANDOMIZATION
|
||||||
|
if (p_tspackets != nullptr) {
|
||||||
|
delete p_tspackets;
|
||||||
|
}
|
||||||
|
if (r_derand != nullptr) {
|
||||||
|
delete r_derand;
|
||||||
|
}
|
||||||
|
|
||||||
|
//OUTPUT : To remove
|
||||||
|
if (r_stdout != nullptr) {
|
||||||
|
delete r_stdout;
|
||||||
|
}
|
||||||
|
if (r_videoplayer != nullptr) {
|
||||||
|
delete r_videoplayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CONSTELLATION
|
||||||
|
if (r_scope_symbols != nullptr) {
|
||||||
|
delete r_scope_symbols;
|
||||||
|
}
|
||||||
|
|
||||||
|
// INPUT
|
||||||
|
//if(p_rawiq!=nullptr) delete p_rawiq;
|
||||||
|
//if(p_rawiq_writer!=nullptr) delete p_rawiq_writer;
|
||||||
|
//if(p_preprocessed!=nullptr) delete p_preprocessed;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_objScheduler=nullptr;
|
||||||
|
|
||||||
// INPUT
|
// INPUT
|
||||||
|
|
||||||
p_rawiq = NULL;
|
p_rawiq = nullptr;
|
||||||
p_rawiq_writer = NULL;
|
p_rawiq_writer = nullptr;
|
||||||
|
|
||||||
p_preprocessed = NULL;
|
p_preprocessed = nullptr;
|
||||||
|
|
||||||
// NOTCH FILTER
|
// NOTCH FILTER
|
||||||
r_auto_notch = NULL;
|
r_auto_notch = nullptr;
|
||||||
p_autonotched = NULL;
|
p_autonotched = nullptr;
|
||||||
|
|
||||||
// FREQUENCY CORRECTION : DEROTATOR
|
// FREQUENCY CORRECTION : DEROTATOR
|
||||||
p_derot = NULL;
|
p_derot = nullptr;
|
||||||
r_derot=NULL;
|
r_derot=nullptr;
|
||||||
|
|
||||||
// CNR ESTIMATION
|
// CNR ESTIMATION
|
||||||
p_cnr = NULL;
|
p_cnr = nullptr;
|
||||||
r_cnr = NULL;
|
r_cnr = nullptr;
|
||||||
|
|
||||||
//FILTERING
|
//FILTERING
|
||||||
r_resample = NULL;
|
r_resample = nullptr;
|
||||||
p_resampled = NULL;
|
p_resampled = nullptr;
|
||||||
coeffs = NULL;
|
coeffs = nullptr;
|
||||||
ncoeffs=0;
|
ncoeffs=0;
|
||||||
|
|
||||||
// OUTPUT PREPROCESSED DATA
|
// OUTPUT PREPROCESSED DATA
|
||||||
sampler = NULL;
|
sampler = nullptr;
|
||||||
coeffs_sampler=NULL;
|
coeffs_sampler=nullptr;
|
||||||
ncoeffs_sampler=0;
|
ncoeffs_sampler=0;
|
||||||
|
|
||||||
p_symbols = NULL;
|
p_symbols = nullptr;
|
||||||
p_freq = NULL;
|
p_freq = nullptr;
|
||||||
p_ss = NULL;
|
p_ss = nullptr;
|
||||||
p_mer = NULL;
|
p_mer = nullptr;
|
||||||
p_sampled = NULL;
|
p_sampled = nullptr;
|
||||||
|
|
||||||
//DECIMATION
|
//DECIMATION
|
||||||
p_decimated = NULL;
|
p_decimated = nullptr;
|
||||||
p_decim = NULL;
|
p_decim = nullptr;
|
||||||
r_ppout = NULL;
|
r_ppout = nullptr;
|
||||||
|
|
||||||
//GENERIC CONSTELLATION RECEIVER
|
//GENERIC CONSTELLATION RECEIVER
|
||||||
m_objDemodulator = NULL;
|
m_objDemodulator = nullptr;
|
||||||
|
|
||||||
//DECONVOLUTION AND SYNCHRONIZATION
|
//DECONVOLUTION AND SYNCHRONIZATION
|
||||||
p_bytes=NULL;
|
p_bytes=nullptr;
|
||||||
r_deconv=NULL;
|
r_deconv=nullptr;
|
||||||
r = NULL;
|
r = nullptr;
|
||||||
|
|
||||||
p_descrambled = NULL;
|
p_descrambled = nullptr;
|
||||||
p_frames = NULL;
|
p_frames = nullptr;
|
||||||
r_etr192_descrambler = NULL;
|
r_etr192_descrambler = nullptr;
|
||||||
r_sync = NULL;
|
r_sync = nullptr;
|
||||||
|
|
||||||
p_mpegbytes = NULL;
|
p_mpegbytes = nullptr;
|
||||||
p_lock = NULL;
|
p_lock = nullptr;
|
||||||
p_locktime = NULL;
|
p_locktime = nullptr;
|
||||||
r_sync_mpeg = NULL;
|
r_sync_mpeg = nullptr;
|
||||||
|
|
||||||
|
|
||||||
// DEINTERLEAVING
|
// DEINTERLEAVING
|
||||||
p_rspackets = NULL;
|
p_rspackets = nullptr;
|
||||||
r_deinter = NULL;
|
r_deinter = nullptr;
|
||||||
|
|
||||||
p_vbitcount = NULL;
|
p_vbitcount = nullptr;
|
||||||
p_verrcount = NULL;
|
p_verrcount = nullptr;
|
||||||
p_rtspackets = NULL;
|
p_rtspackets = nullptr;
|
||||||
r_rsdec = NULL;
|
r_rsdec = nullptr;
|
||||||
|
|
||||||
|
|
||||||
//BER ESTIMATION
|
//BER ESTIMATION
|
||||||
p_vber = NULL;
|
p_vber = nullptr;
|
||||||
r_vber = NULL;
|
r_vber = nullptr;
|
||||||
|
|
||||||
|
|
||||||
// DERANDOMIZATION
|
// DERANDOMIZATION
|
||||||
p_tspackets = NULL;
|
p_tspackets = nullptr;
|
||||||
r_derand = NULL;
|
r_derand = nullptr;
|
||||||
|
|
||||||
|
|
||||||
//OUTPUT : To remove
|
//OUTPUT : To remove
|
||||||
r_stdout = NULL;
|
r_stdout = nullptr;
|
||||||
r_videoplayer = NULL;
|
r_videoplayer = nullptr;
|
||||||
|
|
||||||
|
|
||||||
//CONSTELLATION
|
//CONSTELLATION
|
||||||
r_scope_symbols = NULL;
|
r_scope_symbols = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemod::InitDATVFramework()
|
void DATVDemod::InitDATVFramework()
|
||||||
@ -456,39 +533,30 @@ void DATVDemod::InitDATVFramework()
|
|||||||
case BPSK:
|
case BPSK:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::BPSK;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::BPSK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QPSK:
|
case QPSK:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::QPSK;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::QPSK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PSK8:
|
case PSK8:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::PSK8;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::PSK8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APSK16:
|
case APSK16:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::APSK16;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::APSK16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APSK32:
|
case APSK32:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::APSK32;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::APSK32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APSK64E:
|
case APSK64E:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::APSK64E;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::APSK64E;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QAM16:
|
case QAM16:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::QAM16;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::QAM16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QAM64:
|
case QAM64:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::QAM64;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::QAM64;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QAM256:
|
case QAM256:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::QAM256;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::QAM256;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<256>::BPSK;
|
m_objCfg.constellation = leansdr::cstln_lut<256>::BPSK;
|
||||||
break;
|
break;
|
||||||
@ -591,15 +659,11 @@ void DATVDemod::InitDATVFramework()
|
|||||||
case SAMP_NEAREST:
|
case SAMP_NEAREST:
|
||||||
sampler = new leansdr::nearest_sampler<float>();
|
sampler = new leansdr::nearest_sampler<float>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAMP_LINEAR:
|
case SAMP_LINEAR:
|
||||||
sampler = new leansdr::linear_sampler<float>();
|
sampler = new leansdr::linear_sampler<float>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAMP_RRC:
|
case SAMP_RRC:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (m_objCfg.rrc_steps == 0)
|
if (m_objCfg.rrc_steps == 0)
|
||||||
{
|
{
|
||||||
// At least 64 discrete sampling points between symbols
|
// At least 64 discrete sampling points between symbols
|
||||||
@ -610,23 +674,30 @@ void DATVDemod::InitDATVFramework()
|
|||||||
float transition = (m_objCfg.Fm/2) * m_objCfg.rolloff;
|
float transition = (m_objCfg.Fm/2) * m_objCfg.rolloff;
|
||||||
int order = m_objCfg.rrc_rej * Frrc / (22*transition);
|
int order = m_objCfg.rrc_rej * Frrc / (22*transition);
|
||||||
ncoeffs_sampler = leansdr::filtergen::root_raised_cosine(order, m_objCfg.Fm/Frrc, m_objCfg.rolloff, &coeffs_sampler);
|
ncoeffs_sampler = leansdr::filtergen::root_raised_cosine(order, m_objCfg.Fm/Frrc, m_objCfg.rolloff, &coeffs_sampler);
|
||||||
|
|
||||||
sampler = new leansdr::fir_sampler<float,float>(ncoeffs_sampler, coeffs_sampler, m_objCfg.rrc_steps);
|
sampler = new leansdr::fir_sampler<float,float>(ncoeffs_sampler, coeffs_sampler, m_objCfg.rrc_steps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
qCritical("DATVDemod::InitDATVFramework: Interpolator not implemented");
|
qCritical("DATVDemod::InitDATVFramework: Interpolator not implemented");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objDemodulator = new leansdr::cstln_receiver<leansdr::f32>(m_objScheduler, sampler, *p_preprocessed, *p_symbols, p_freq, p_ss, p_mer, p_sampled);
|
m_objDemodulator = new leansdr::cstln_receiver<leansdr::f32>(
|
||||||
|
m_objScheduler,
|
||||||
|
sampler,
|
||||||
|
*p_preprocessed,
|
||||||
|
*p_symbols,
|
||||||
|
p_freq,
|
||||||
|
p_ss,
|
||||||
|
p_mer,
|
||||||
|
p_sampled);
|
||||||
|
|
||||||
if (m_objCfg.standard == DVB_S)
|
if (m_objCfg.standard == DVB_S)
|
||||||
{
|
{
|
||||||
if ( m_objCfg.constellation != leansdr::cstln_lut<256>::QPSK && m_objCfg.constellation != leansdr::cstln_lut<256>::BPSK )
|
if ( m_objCfg.constellation != leansdr::cstln_lut<256>::QPSK
|
||||||
|
&& m_objCfg.constellation != leansdr::cstln_lut<256>::BPSK )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Warning: non-standard constellation for DVB-S\n");
|
qWarning("DATVDemod::InitDATVFramework: non-standard constellation for DVB-S");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,13 +705,12 @@ void DATVDemod::InitDATVFramework()
|
|||||||
{
|
{
|
||||||
// For DVB-S2 testing only.
|
// For DVB-S2 testing only.
|
||||||
// Constellation should be determined from PL signalling.
|
// Constellation should be determined from PL signalling.
|
||||||
fprintf(stderr, "DVB-S2: Testing symbol sampler only.\n");
|
qDebug("DATVDemod::InitDATVFramework: DVB-S2: Testing symbol sampler only.");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objDemodulator->cstln = make_dvbs2_constellation(m_objCfg.constellation, m_objCfg.fec);
|
m_objDemodulator->cstln = make_dvbs2_constellation(m_objCfg.constellation, m_objCfg.fec);
|
||||||
|
|
||||||
if ( m_objCfg.hard_metric )
|
if (m_objCfg.hard_metric) {
|
||||||
{
|
|
||||||
m_objDemodulator->cstln->harden();
|
m_objDemodulator->cstln->harden();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,23 +721,19 @@ void DATVDemod::InitDATVFramework()
|
|||||||
// m_objDemodulator->set_freq(m_objCfg.Ftune/m_objCfg.Fs);
|
// m_objDemodulator->set_freq(m_objCfg.Ftune/m_objCfg.Fs);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if ( m_objCfg.allow_drift )
|
if (m_objCfg.allow_drift) {
|
||||||
{
|
|
||||||
m_objDemodulator->set_allow_drift(true);
|
m_objDemodulator->set_allow_drift(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******** -> if ( m_objCfg.viterbi )
|
//******** -> if ( m_objCfg.viterbi )
|
||||||
if ( m_objCfg.viterbi )
|
if (m_objCfg.viterbi) {
|
||||||
{
|
|
||||||
m_objDemodulator->pll_adjustment /= 6;
|
m_objDemodulator->pll_adjustment /= 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_objDemodulator->meas_decimation = decimation(m_objCfg.Fs, m_objCfg.Finfo);
|
m_objDemodulator->meas_decimation = decimation(m_objCfg.Fs, m_objCfg.Finfo);
|
||||||
|
|
||||||
// TRACKING FILTERS
|
// TRACKING FILTERS
|
||||||
|
|
||||||
|
|
||||||
if (r_cnr)
|
if (r_cnr)
|
||||||
{
|
{
|
||||||
r_cnr->freq_tap = &m_objDemodulator->freq_tap;
|
r_cnr->freq_tap = &m_objDemodulator->freq_tap;
|
||||||
@ -679,8 +745,7 @@ void DATVDemod::InitDATVFramework()
|
|||||||
if (m_objRegisteredTVScreen)
|
if (m_objRegisteredTVScreen)
|
||||||
{
|
{
|
||||||
m_objRegisteredTVScreen->resizeTVScreen(256,256);
|
m_objRegisteredTVScreen->resizeTVScreen(256,256);
|
||||||
|
r_scope_symbols = new leansdr::datvconstellation<leansdr::f32>(m_objScheduler, *p_sampled, -128,128, nullptr, m_objRegisteredTVScreen);
|
||||||
r_scope_symbols = new leansdr::datvconstellation<leansdr::f32>(m_objScheduler, *p_sampled, -128,128, NULL, m_objRegisteredTVScreen);
|
|
||||||
r_scope_symbols->decimation = 1;
|
r_scope_symbols->decimation = 1;
|
||||||
r_scope_symbols->cstln = &m_objDemodulator->cstln;
|
r_scope_symbols->cstln = &m_objDemodulator->cstln;
|
||||||
r_scope_symbols->calculate_cstln_points();
|
r_scope_symbols->calculate_cstln_points();
|
||||||
@ -690,22 +755,20 @@ void DATVDemod::InitDATVFramework()
|
|||||||
|
|
||||||
p_bytes = new leansdr::pipebuf<leansdr::u8>(m_objScheduler, "bytes", BUF_BYTES);
|
p_bytes = new leansdr::pipebuf<leansdr::u8>(m_objScheduler, "bytes", BUF_BYTES);
|
||||||
|
|
||||||
r_deconv = NULL;
|
r_deconv = nullptr;
|
||||||
|
|
||||||
//******** -> if ( m_objCfg.viterbi )
|
//******** -> if ( m_objCfg.viterbi )
|
||||||
|
|
||||||
if (m_objCfg.viterbi)
|
if (m_objCfg.viterbi)
|
||||||
{
|
{
|
||||||
if ( m_objCfg.fec == leansdr::FEC23 && (m_objDemodulator->cstln->nsymbols == 4 || m_objDemodulator->cstln->nsymbols == 64) )
|
if (m_objCfg.fec == leansdr::FEC23 && (m_objDemodulator->cstln->nsymbols == 4 || m_objDemodulator->cstln->nsymbols == 64)) {
|
||||||
{
|
|
||||||
m_objCfg.fec = leansdr::FEC46;
|
m_objCfg.fec = leansdr::FEC46;
|
||||||
}
|
}
|
||||||
|
|
||||||
//To uncomment -> Linking Problem : undefined symbol: _ZN7leansdr21viterbi_dec_interfaceIhhiiE6updateEPiS2_
|
//To uncomment -> Linking Problem : undefined symbol: _ZN7leansdr21viterbi_dec_interfaceIhhiiE6updateEPiS2_
|
||||||
r = new leansdr::viterbi_sync(m_objScheduler, (*p_symbols), (*p_bytes), m_objDemodulator->cstln, m_objCfg.fec);
|
r = new leansdr::viterbi_sync(m_objScheduler, (*p_symbols), (*p_bytes), m_objDemodulator->cstln, m_objCfg.fec);
|
||||||
|
|
||||||
if ( m_objCfg.fastlock )
|
if (m_objCfg.fastlock) {
|
||||||
{
|
|
||||||
r->resync_period = 1;
|
r->resync_period = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -729,7 +792,6 @@ void DATVDemod::InitDATVFramework()
|
|||||||
p_rspackets = new leansdr::pipebuf<leansdr::rspacket<leansdr::u8> >(m_objScheduler, "RS-enc packets", BUF_PACKETS);
|
p_rspackets = new leansdr::pipebuf<leansdr::rspacket<leansdr::u8> >(m_objScheduler, "RS-enc packets", BUF_PACKETS);
|
||||||
r_deinter = new leansdr::deinterleaver<leansdr::u8>(m_objScheduler, *p_mpegbytes, *p_rspackets);
|
r_deinter = new leansdr::deinterleaver<leansdr::u8>(m_objScheduler, *p_mpegbytes, *p_rspackets);
|
||||||
|
|
||||||
|
|
||||||
// REED-SOLOMON
|
// REED-SOLOMON
|
||||||
|
|
||||||
p_vbitcount = new leansdr::pipebuf<int>(m_objScheduler, "Bits processed", BUF_PACKETS);
|
p_vbitcount = new leansdr::pipebuf<int>(m_objScheduler, "Bits processed", BUF_PACKETS);
|
||||||
@ -737,10 +799,8 @@ void DATVDemod::InitDATVFramework()
|
|||||||
p_rtspackets = new leansdr::pipebuf<leansdr::tspacket>(m_objScheduler, "rand TS packets", BUF_PACKETS);
|
p_rtspackets = new leansdr::pipebuf<leansdr::tspacket>(m_objScheduler, "rand TS packets", BUF_PACKETS);
|
||||||
r_rsdec = new leansdr::rs_decoder<leansdr::u8, 0>(m_objScheduler, *p_rspackets, *p_rtspackets, p_vbitcount, p_verrcount);
|
r_rsdec = new leansdr::rs_decoder<leansdr::u8, 0>(m_objScheduler, *p_rspackets, *p_rtspackets, p_vbitcount, p_verrcount);
|
||||||
|
|
||||||
|
|
||||||
// BER ESTIMATION
|
// BER ESTIMATION
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
p_vber = new pipebuf<float> (m_objScheduler, "VBER", BUF_SLOW);
|
p_vber = new pipebuf<float> (m_objScheduler, "VBER", BUF_SLOW);
|
||||||
r_vber = new rate_estimator<float> (m_objScheduler, *p_verrcount, *p_vbitcount, *p_vber);
|
r_vber = new rate_estimator<float> (m_objScheduler, *p_verrcount, *p_vbitcount, *p_vber);
|
||||||
@ -753,11 +813,9 @@ void DATVDemod::InitDATVFramework()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// DERANDOMIZATION
|
// DERANDOMIZATION
|
||||||
|
|
||||||
p_tspackets = new leansdr::pipebuf<leansdr::tspacket>(m_objScheduler, "TS packets", BUF_PACKETS);
|
p_tspackets = new leansdr::pipebuf<leansdr::tspacket>(m_objScheduler, "TS packets", BUF_PACKETS);
|
||||||
r_derand = new leansdr::derandomizer(m_objScheduler, *p_rtspackets, *p_tspackets);
|
r_derand = new leansdr::derandomizer(m_objScheduler, *p_rtspackets, *p_tspackets);
|
||||||
|
|
||||||
|
|
||||||
// OUTPUT
|
// OUTPUT
|
||||||
r_videoplayer = new leansdr::datvvideoplayer<leansdr::tspacket>(m_objScheduler, *p_tspackets, m_objVideoStream);
|
r_videoplayer = new leansdr::datvvideoplayer<leansdr::tspacket>(m_objScheduler, *p_tspackets, m_objVideoStream);
|
||||||
|
|
||||||
@ -812,15 +870,10 @@ void DATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
|
|||||||
|
|
||||||
if (m_blnNeedConfigUpdate)
|
if (m_blnNeedConfigUpdate)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_objSettingsMutex.lock();
|
m_objSettingsMutex.lock();
|
||||||
|
|
||||||
m_blnNeedConfigUpdate=false;
|
m_blnNeedConfigUpdate=false;
|
||||||
|
|
||||||
InitDATVFramework();
|
InitDATVFramework();
|
||||||
|
|
||||||
m_objSettingsMutex.unlock();
|
m_objSettingsMutex.unlock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -842,8 +895,8 @@ void DATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
|
|||||||
objRF ++;
|
objRF ++;
|
||||||
|
|
||||||
if (m_blnDVBInitialized
|
if (m_blnDVBInitialized
|
||||||
&& (p_rawiq_writer!=NULL)
|
&& (p_rawiq_writer!=nullptr)
|
||||||
&& (m_objScheduler!=NULL))
|
&& (m_objScheduler!=nullptr))
|
||||||
{
|
{
|
||||||
p_rawiq_writer->write(objIQ);
|
p_rawiq_writer->write(objIQ);
|
||||||
m_lngReadIQ++;
|
m_lngReadIQ++;
|
||||||
@ -865,12 +918,10 @@ void DATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
|
|||||||
|
|
||||||
void DATVDemod::start()
|
void DATVDemod::start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemod::stop()
|
void DATVDemod::stop()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DATVDemod::handleMessage(const Message& cmd)
|
bool DATVDemod::handleMessage(const Message& cmd)
|
||||||
@ -971,8 +1022,7 @@ bool DATVDemod::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
void DATVDemod::ApplySettings()
|
void DATVDemod::ApplySettings()
|
||||||
{
|
{
|
||||||
if(m_objRunning.intMsps==0)
|
if (m_objRunning.intMsps == 0) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,4 +1048,3 @@ int DATVDemod::GetSampleRate()
|
|||||||
{
|
{
|
||||||
return m_objRunning.intMsps;
|
return m_objRunning.intMsps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,6 @@ public:
|
|||||||
static const QString m_channelIdURI;
|
static const QString m_channelIdURI;
|
||||||
static const QString m_channelId;
|
static const QString m_channelId;
|
||||||
|
|
||||||
|
|
||||||
class MsgConfigureChannelizer : public Message
|
class MsgConfigureChannelizer : public Message
|
||||||
{
|
{
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
@ -248,8 +247,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
int getCenterFrequency() const { return m_centerFrequency; }
|
int getCenterFrequency() const { return m_centerFrequency; }
|
||||||
|
|
||||||
static MsgConfigureChannelizer* create(int centerFrequency)
|
static MsgConfigureChannelizer* create(int centerFrequency) {
|
||||||
{
|
|
||||||
return new MsgConfigureChannelizer(centerFrequency);
|
return new MsgConfigureChannelizer(centerFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,16 +309,13 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
|
|||||||
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
|
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
|
||||||
|
|
||||||
resetToDefaults(); // does applySettings()
|
resetToDefaults(); // does applySettings()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DATVDemodGUI::~DATVDemodGUI()
|
DATVDemodGUI::~DATVDemodGUI()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_deviceUISet->removeRxChannelInstance(this);
|
m_deviceUISet->removeRxChannelInstance(this);
|
||||||
delete m_objDATVDemod;
|
delete m_objDATVDemod;
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemodGUI::blockApplySettings(bool blnBlock)
|
void DATVDemodGUI::blockApplySettings(bool blnBlock)
|
||||||
@ -350,125 +347,83 @@ void DATVDemodGUI::applySettings()
|
|||||||
|
|
||||||
strStandard = ui->cmbStandard->currentText();
|
strStandard = ui->cmbStandard->currentText();
|
||||||
|
|
||||||
if(strStandard=="DVB-S")
|
if(strStandard=="DVB-S") {
|
||||||
{
|
|
||||||
enmVersion=DVB_S;
|
enmVersion=DVB_S;
|
||||||
}
|
} else if (strStandard=="DVB-S2") {
|
||||||
else if (strStandard=="DVB-S2")
|
|
||||||
{
|
|
||||||
enmVersion=DVB_S2;
|
enmVersion=DVB_S2;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
enmVersion=DVB_S;
|
enmVersion=DVB_S;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256
|
//BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256
|
||||||
|
|
||||||
strModulation = ui->cmbModulation->currentText();
|
strModulation = ui->cmbModulation->currentText();
|
||||||
|
|
||||||
if(strModulation=="BPSK")
|
if(strModulation=="BPSK") {
|
||||||
{
|
|
||||||
enmSelectedModulation=BPSK;
|
enmSelectedModulation=BPSK;
|
||||||
}
|
}
|
||||||
else if(strModulation=="QPSK")
|
else if(strModulation=="QPSK") {
|
||||||
{
|
|
||||||
enmSelectedModulation=QPSK;
|
enmSelectedModulation=QPSK;
|
||||||
}
|
}
|
||||||
else if(strModulation=="8PSK")
|
else if(strModulation=="8PSK") {
|
||||||
{
|
|
||||||
enmSelectedModulation=PSK8;
|
enmSelectedModulation=PSK8;
|
||||||
}
|
}
|
||||||
else if(strModulation=="16APSK")
|
else if(strModulation=="16APSK") {
|
||||||
{
|
|
||||||
enmSelectedModulation=APSK16;
|
enmSelectedModulation=APSK16;
|
||||||
}
|
}
|
||||||
else if(strModulation=="32APSK")
|
else if(strModulation=="32APSK") {
|
||||||
{
|
|
||||||
enmSelectedModulation=APSK32;
|
enmSelectedModulation=APSK32;
|
||||||
}
|
}
|
||||||
else if(strModulation=="64APSKE")
|
else if(strModulation=="64APSKE") {
|
||||||
{
|
|
||||||
enmSelectedModulation=APSK64E;
|
enmSelectedModulation=APSK64E;
|
||||||
}
|
}
|
||||||
else if(strModulation=="16QAM")
|
else if(strModulation=="16QAM") {
|
||||||
{
|
|
||||||
enmSelectedModulation=QAM16;
|
enmSelectedModulation=QAM16;
|
||||||
}
|
}
|
||||||
else if(strModulation=="64QAM")
|
else if(strModulation=="64QAM") {
|
||||||
{
|
|
||||||
enmSelectedModulation=QAM64;
|
enmSelectedModulation=QAM64;
|
||||||
}
|
}
|
||||||
else if(strModulation=="256QAM")
|
else if(strModulation=="256QAM") {
|
||||||
{
|
|
||||||
enmSelectedModulation=QAM256;
|
enmSelectedModulation=QAM256;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
enmSelectedModulation=BPSK;
|
enmSelectedModulation=BPSK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Viterbi only for BPSK et QPSK
|
//Viterbi only for BPSK et QPSK
|
||||||
if((enmSelectedModulation!=BPSK) && (enmSelectedModulation!=QPSK))
|
if ((enmSelectedModulation!=BPSK) && (enmSelectedModulation!=QPSK)) {
|
||||||
{
|
|
||||||
ui->chkViterbi->setChecked(false);
|
ui->chkViterbi->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
strFEC = ui->cmbFEC->currentText();
|
strFEC = ui->cmbFEC->currentText();
|
||||||
|
|
||||||
if(strFEC == "1/2")
|
if (strFEC == "1/2") {
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC12;
|
enmFEC = leansdr::FEC12;
|
||||||
}
|
} else if (strFEC == "2/3") {
|
||||||
else if(strFEC == "2/3")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC23;
|
enmFEC = leansdr::FEC23;
|
||||||
}
|
} else if (strFEC == "3/4") {
|
||||||
else if(strFEC == "3/4")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC34;
|
enmFEC = leansdr::FEC34;
|
||||||
}
|
} else if (strFEC == "5/6") {
|
||||||
else if(strFEC == "5/6")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC56;
|
enmFEC = leansdr::FEC56;
|
||||||
}
|
} else if (strFEC == "7/8") {
|
||||||
else if(strFEC == "7/8")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC78;
|
enmFEC = leansdr::FEC78;
|
||||||
}
|
} else if (strFEC == "4/5") {
|
||||||
else if(strFEC == "4/5")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC45;
|
enmFEC = leansdr::FEC45;
|
||||||
}
|
} else if (strFEC == "8/9") {
|
||||||
else if(strFEC == "8/9")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC89;
|
enmFEC = leansdr::FEC89;
|
||||||
}
|
} else if (strFEC == "9/10") {
|
||||||
else if(strFEC == "9/10")
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC910;
|
enmFEC = leansdr::FEC910;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
enmFEC = leansdr::FEC12;
|
enmFEC = leansdr::FEC12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui->cmbFilter->currentIndex()==0)
|
if (ui->cmbFilter->currentIndex() == 0) {
|
||||||
{
|
|
||||||
enmSampler = SAMP_LINEAR;
|
enmSampler = SAMP_LINEAR;
|
||||||
}
|
} else if (ui->cmbFilter->currentIndex() == 1) {
|
||||||
else if(ui->cmbFilter->currentIndex()==1)
|
|
||||||
{
|
|
||||||
enmSampler = SAMP_NEAREST;
|
enmSampler = SAMP_NEAREST;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
enmSampler = SAMP_RRC;
|
enmSampler = SAMP_RRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_objDATVDemod->configure(
|
m_objDATVDemod->configure(
|
||||||
m_objDATVDemod->getInputMessageQueue(),
|
m_objDATVDemod->getInputMessageQueue(),
|
||||||
m_objChannelMarker.getBandwidth(),
|
m_objChannelMarker.getBandwidth(),
|
||||||
@ -675,7 +630,7 @@ void DATVDemodGUI::on_pushButton_3_clicked()
|
|||||||
|
|
||||||
m_blnButtonPlayClicked=true;
|
m_blnButtonPlayClicked=true;
|
||||||
|
|
||||||
if(m_objDATVDemod!=NULL)
|
if(m_objDATVDemod!=nullptr)
|
||||||
{
|
{
|
||||||
m_objDATVDemod->PlayVideo(true);
|
m_objDATVDemod->PlayVideo(true);
|
||||||
}
|
}
|
||||||
@ -695,16 +650,11 @@ void DATVDemodGUI::on_mouseEvent(QMouseEvent* obj)
|
|||||||
|
|
||||||
QString DATVDemodGUI::formatBytes(qint64 intBytes)
|
QString DATVDemodGUI::formatBytes(qint64 intBytes)
|
||||||
{
|
{
|
||||||
if(intBytes<1024)
|
if(intBytes<1024) {
|
||||||
{
|
|
||||||
return QString("%1").arg(intBytes);
|
return QString("%1").arg(intBytes);
|
||||||
}
|
} else if(intBytes<1024*1024) {
|
||||||
else if(intBytes<1024*1024)
|
|
||||||
{
|
|
||||||
return QString("%1 K").arg((float)(10*intBytes/1024)/10.0f);
|
return QString("%1 K").arg((float)(10*intBytes/1024)/10.0f);
|
||||||
}
|
} else if(intBytes<1024*1024*1024) {
|
||||||
else if(intBytes<1024*1024*1024)
|
|
||||||
{
|
|
||||||
return QString("%1 M").arg((float)(10*intBytes/(1024*1024))/10.0f);
|
return QString("%1 M").arg((float)(10*intBytes/(1024*1024))/10.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,17 +668,13 @@ void DATVDemodGUI::on_StreamDataAvailable(int *intPackets, int *intBytes, int *i
|
|||||||
ui->lblStatus->setText(QString("Data: %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) {
|
||||||
{
|
|
||||||
ui->prgSynchro->setValue(*intPercent);
|
ui->prgSynchro->setValue(*intPercent);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->prgSynchro->setValue(100);
|
ui->prgSynchro->setValue(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_intReadyDecodedData = *intBytes;
|
m_intReadyDecodedData = *intBytes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemodGUI::on_spiBandwidth_valueChanged(int arg1)
|
void DATVDemodGUI::on_spiBandwidth_valueChanged(int arg1)
|
||||||
@ -758,9 +704,8 @@ void DATVDemodGUI::on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData)
|
|||||||
{
|
{
|
||||||
QString strMetaData="";
|
QString strMetaData="";
|
||||||
|
|
||||||
if(objMetaData!=NULL)
|
if (objMetaData != nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (objMetaData->OK_TransportStream == true)
|
if (objMetaData->OK_TransportStream == true)
|
||||||
{
|
{
|
||||||
strMetaData.sprintf("PID: %d - Width: %d - Height: %d\r\n%s%s\r\nCodec: %s\r\n",
|
strMetaData.sprintf("PID: %d - Width: %d - Height: %d\r\n%s%s\r\nCodec: %s\r\n",
|
||||||
@ -771,24 +716,20 @@ void DATVDemodGUI::on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData)
|
|||||||
objMetaData->Stream.toStdString().c_str(),
|
objMetaData->Stream.toStdString().c_str(),
|
||||||
objMetaData->CodecDescription.toStdString().c_str());
|
objMetaData->CodecDescription.toStdString().c_str());
|
||||||
}
|
}
|
||||||
ui->textEdit->setText(strMetaData);
|
|
||||||
|
|
||||||
|
ui->textEdit->setText(strMetaData);
|
||||||
ui->chkData->setChecked(objMetaData->OK_Data);
|
ui->chkData->setChecked(objMetaData->OK_Data);
|
||||||
ui->chkTS->setChecked(objMetaData->OK_TransportStream);
|
ui->chkTS->setChecked(objMetaData->OK_TransportStream);
|
||||||
ui->chkVS->setChecked(objMetaData->OK_VideoStream);
|
ui->chkVS->setChecked(objMetaData->OK_VideoStream);
|
||||||
ui->chkDecoding->setChecked(objMetaData->OK_Decoding);
|
ui->chkDecoding->setChecked(objMetaData->OK_Decoding);
|
||||||
|
|
||||||
if(objMetaData->OK_Decoding==true)
|
if (objMetaData->OK_Decoding == true) {
|
||||||
{
|
|
||||||
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
|
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
|
ui->pushButton_3->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(objMetaData->Height>0)
|
if (objMetaData->Height > 0) {
|
||||||
{
|
|
||||||
ui->screenTV_2->setFixedWidth((int)objMetaData->Width*(270.0f/(float)objMetaData->Height));
|
ui->screenTV_2->setFixedWidth((int)objMetaData->Width*(270.0f/(float)objMetaData->Height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -806,7 +747,6 @@ void DATVDemodGUI::on_cmbFilter_currentIndexChanged(int index)
|
|||||||
{
|
{
|
||||||
(void) index;
|
(void) index;
|
||||||
displayRRCParameters((ui->cmbFilter->currentIndex()==2));
|
displayRRCParameters((ui->cmbFilter->currentIndex()==2));
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor =
|
const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor =
|
||||||
{
|
{
|
||||||
QString("DATV Demodulator"),
|
QString("DATV Demodulator"),
|
||||||
QString("4.3.1"),
|
QString("4.5.1"),
|
||||||
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,
|
||||||
@ -36,7 +36,7 @@ const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor =
|
|||||||
|
|
||||||
DATVDemodPlugin::DATVDemodPlugin(QObject* ptrParent) :
|
DATVDemodPlugin::DATVDemodPlugin(QObject* ptrParent) :
|
||||||
QObject(ptrParent),
|
QObject(ptrParent),
|
||||||
m_ptrPluginAPI(NULL)
|
m_ptrPluginAPI(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class DATVDemodPlugin : public QObject, PluginInterface
|
|||||||
Q_PLUGIN_METADATA(IID "sdrangel.channel.demoddatv")
|
Q_PLUGIN_METADATA(IID "sdrangel.channel.demoddatv")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DATVDemodPlugin(QObject* ptrParent = NULL);
|
explicit DATVDemodPlugin(QObject* ptrParent = nullptr);
|
||||||
|
|
||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
void initPlugin(PluginAPI* ptrPluginAPI);
|
void initPlugin(PluginAPI* ptrPluginAPI);
|
||||||
|
@ -26,15 +26,15 @@ DATVideoRender::DATVideoRender(QWidget * parent):
|
|||||||
|
|
||||||
m_blnIsFFMPEGInitialized=false;
|
m_blnIsFFMPEGInitialized=false;
|
||||||
m_blnIsOpen=false;
|
m_blnIsOpen=false;
|
||||||
m_objFormatCtx=NULL;
|
m_objFormatCtx=nullptr;
|
||||||
m_objDecoderCtx=NULL;
|
m_objDecoderCtx=nullptr;
|
||||||
m_objSwsCtx=NULL;
|
m_objSwsCtx=nullptr;
|
||||||
m_intVideoStreamIndex=-1;
|
m_intVideoStreamIndex=-1;
|
||||||
|
|
||||||
m_intCurrentRenderWidth=-1;
|
m_intCurrentRenderWidth=-1;
|
||||||
m_intCurrentRenderHeight=-1;
|
m_intCurrentRenderHeight=-1;
|
||||||
|
|
||||||
m_objFrame=NULL;
|
m_objFrame=nullptr;
|
||||||
m_intFrameCount=-1;
|
m_intFrameCount=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +55,7 @@ bool DATVideoRender::eventFilter(QObject *obj, QEvent *event)
|
|||||||
|
|
||||||
void DATVideoRender::SetFullScreen(bool blnFullScreen)
|
void DATVideoRender::SetFullScreen(bool blnFullScreen)
|
||||||
{
|
{
|
||||||
if(m_blnIsFullScreen==blnFullScreen)
|
if (m_blnIsFullScreen == blnFullScreen) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +64,6 @@ void DATVideoRender::SetFullScreen(bool blnFullScreen)
|
|||||||
setWindowFlags(Qt::Window);
|
setWindowFlags(Qt::Window);
|
||||||
setWindowState(Qt::WindowFullScreen);
|
setWindowState(Qt::WindowFullScreen);
|
||||||
show();
|
show();
|
||||||
|
|
||||||
m_blnIsFullScreen=true;
|
m_blnIsFullScreen=true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -73,7 +71,6 @@ void DATVideoRender::SetFullScreen(bool blnFullScreen)
|
|||||||
setWindowFlags(Qt::Widget);
|
setWindowFlags(Qt::Widget);
|
||||||
setWindowState(Qt::WindowNoState);
|
setWindowState(Qt::WindowNoState);
|
||||||
show();
|
show();
|
||||||
|
|
||||||
m_blnIsFullScreen=false;
|
m_blnIsFullScreen=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,18 +87,15 @@ static int64_t SeekFunction(void* opaque, int64_t offset, int whence)
|
|||||||
{
|
{
|
||||||
QIODevice* objStream = reinterpret_cast<QIODevice*>(opaque);
|
QIODevice* objStream = reinterpret_cast<QIODevice*>(opaque);
|
||||||
|
|
||||||
if (whence == AVSEEK_SIZE)
|
if (whence == AVSEEK_SIZE) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objStream->isSequential())
|
if (objStream->isSequential()) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objStream->seek(offset)==false)
|
if (objStream->seek(offset) == false) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,14 +125,12 @@ bool DATVideoRender::InitializeFFMPEG()
|
|||||||
{
|
{
|
||||||
ResetMetaData();
|
ResetMetaData();
|
||||||
|
|
||||||
if(m_blnIsFFMPEGInitialized)
|
if (m_blnIsFFMPEGInitialized) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
avcodec_register_all();
|
avcodec_register_all();
|
||||||
av_register_all();
|
av_register_all();
|
||||||
|
|
||||||
av_log_set_level(AV_LOG_FATAL);
|
av_log_set_level(AV_LOG_FATAL);
|
||||||
//av_log_set_level(AV_LOG_ERROR);
|
//av_log_set_level(AV_LOG_ERROR);
|
||||||
|
|
||||||
@ -149,25 +141,25 @@ bool DATVideoRender::InitializeFFMPEG()
|
|||||||
|
|
||||||
bool DATVideoRender::PreprocessStream()
|
bool DATVideoRender::PreprocessStream()
|
||||||
{
|
{
|
||||||
AVDictionary *objOpts = NULL;
|
AVDictionary *objOpts = nullptr;
|
||||||
AVCodec *objCodec = NULL;
|
AVCodec *objCodec = nullptr;
|
||||||
|
|
||||||
int intRet=-1;
|
int intRet=-1;
|
||||||
char *objBuffer=NULL;
|
char *objBuffer=nullptr;
|
||||||
|
|
||||||
//Identify stream
|
//Identify stream
|
||||||
|
|
||||||
if (avformat_find_stream_info(m_objFormatCtx, NULL) < 0)
|
if (avformat_find_stream_info(m_objFormatCtx, nullptr) < 0)
|
||||||
{
|
{
|
||||||
avformat_close_input(&m_objFormatCtx);
|
avformat_close_input(&m_objFormatCtx);
|
||||||
m_objFormatCtx=NULL;
|
m_objFormatCtx=nullptr;
|
||||||
|
|
||||||
qDebug() << "DATVideoProcess::PreprocessStream cannot find stream info";
|
qDebug() << "DATVideoProcess::PreprocessStream cannot find stream info";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Find video stream
|
//Find video stream
|
||||||
intRet = av_find_best_stream(m_objFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
|
intRet = av_find_best_stream(m_objFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);
|
||||||
|
|
||||||
if (intRet < 0)
|
if (intRet < 0)
|
||||||
{
|
{
|
||||||
@ -191,28 +183,24 @@ 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.OK_TransportStream = true;
|
||||||
|
|
||||||
|
|
||||||
MetaData.Program="";
|
MetaData.Program="";
|
||||||
MetaData.Stream="";
|
MetaData.Stream="";
|
||||||
|
|
||||||
if(m_objFormatCtx->programs)
|
if(m_objFormatCtx->programs)
|
||||||
{
|
{
|
||||||
objBuffer=NULL;
|
objBuffer=nullptr;
|
||||||
|
|
||||||
av_dict_get_string(m_objFormatCtx->programs[m_intVideoStreamIndex]->metadata,&objBuffer,':','\n');
|
av_dict_get_string(m_objFormatCtx->programs[m_intVideoStreamIndex]->metadata,&objBuffer,':','\n');
|
||||||
if(objBuffer!=NULL)
|
|
||||||
{
|
if(objBuffer!=nullptr) {
|
||||||
MetaData.Program = QString("%1").arg(objBuffer);
|
MetaData.Program = QString("%1").arg(objBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objBuffer=NULL;
|
objBuffer=nullptr;
|
||||||
|
|
||||||
av_dict_get_string(m_objFormatCtx->streams[m_intVideoStreamIndex]->metadata,&objBuffer,':','\n');
|
av_dict_get_string(m_objFormatCtx->streams[m_intVideoStreamIndex]->metadata,&objBuffer,':','\n');
|
||||||
|
|
||||||
if(objBuffer!=NULL)
|
if (objBuffer != nullptr) {
|
||||||
{
|
|
||||||
MetaData.Stream = QString("%1").arg(objBuffer);
|
MetaData.Stream = QString("%1").arg(objBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,10 +208,11 @@ bool DATVideoRender::PreprocessStream()
|
|||||||
|
|
||||||
//Decoder
|
//Decoder
|
||||||
objCodec = avcodec_find_decoder(m_objDecoderCtx->codec_id);
|
objCodec = avcodec_find_decoder(m_objDecoderCtx->codec_id);
|
||||||
if(objCodec==NULL)
|
|
||||||
|
if (objCodec == nullptr)
|
||||||
{
|
{
|
||||||
avformat_close_input(&m_objFormatCtx);
|
avformat_close_input(&m_objFormatCtx);
|
||||||
m_objFormatCtx=NULL;
|
m_objFormatCtx=nullptr;
|
||||||
|
|
||||||
qDebug() << "DATVideoProcess::PreprocessStream cannot find associated CODEC";
|
qDebug() << "DATVideoProcess::PreprocessStream cannot find associated CODEC";
|
||||||
return false;
|
return false;
|
||||||
@ -234,7 +223,7 @@ bool DATVideoRender::PreprocessStream()
|
|||||||
if (avcodec_open2(m_objDecoderCtx, objCodec, &objOpts) < 0)
|
if (avcodec_open2(m_objDecoderCtx, objCodec, &objOpts) < 0)
|
||||||
{
|
{
|
||||||
avformat_close_input(&m_objFormatCtx);
|
avformat_close_input(&m_objFormatCtx);
|
||||||
m_objFormatCtx=NULL;
|
m_objFormatCtx=nullptr;
|
||||||
|
|
||||||
qDebug() << "DATVideoProcess::PreprocessStream cannot open associated CODEC";
|
qDebug() << "DATVideoProcess::PreprocessStream cannot open associated CODEC";
|
||||||
return false;
|
return false;
|
||||||
@ -246,21 +235,18 @@ bool DATVideoRender::PreprocessStream()
|
|||||||
if (!m_objFrame)
|
if (!m_objFrame)
|
||||||
{
|
{
|
||||||
avformat_close_input(&m_objFormatCtx);
|
avformat_close_input(&m_objFormatCtx);
|
||||||
m_objFormatCtx=NULL;
|
m_objFormatCtx=nullptr;
|
||||||
|
|
||||||
qDebug() << "DATVideoProcess::PreprocessStream cannot allocate frame";
|
qDebug() << "DATVideoProcess::PreprocessStream cannot allocate frame";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_intFrameCount=0;
|
m_intFrameCount=0;
|
||||||
|
|
||||||
|
|
||||||
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;
|
MetaData.OK_VideoStream = true;
|
||||||
|
|
||||||
emit onMetaDataChanged(&MetaData);
|
emit onMetaDataChanged(&MetaData);
|
||||||
@ -271,38 +257,30 @@ bool DATVideoRender::PreprocessStream()
|
|||||||
bool DATVideoRender::OpenStream(DATVideostream *objDevice)
|
bool DATVideoRender::OpenStream(DATVideostream *objDevice)
|
||||||
{
|
{
|
||||||
int intIOBufferSize = 32768;
|
int intIOBufferSize = 32768;
|
||||||
unsigned char * ptrIOBuffer = NULL;
|
unsigned char * ptrIOBuffer = nullptr;
|
||||||
AVIOContext * objIOCtx = NULL;
|
AVIOContext * objIOCtx = nullptr;
|
||||||
|
|
||||||
if(m_blnRunning)
|
if(m_blnRunning) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (objDevice == nullptr)
|
||||||
if(objDevice==NULL)
|
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::OpenStream QIODevice is NULL";
|
qDebug() << "DATVideoProcess::OpenStream QIODevice is nullptr";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_blnIsOpen)
|
if (m_blnIsOpen)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::OpenStream already open";
|
qDebug() << "DATVideoProcess::OpenStream already open";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objDevice->bytesAvailable() <= 0)
|
if (objDevice->bytesAvailable() <= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
qDebug() << "DATVideoProcess::OpenStream no data available";
|
qDebug() << "DATVideoProcess::OpenStream no data available";
|
||||||
|
|
||||||
MetaData.OK_Data = false;
|
MetaData.OK_Data = false;
|
||||||
emit onMetaDataChanged(&MetaData);
|
emit onMetaDataChanged(&MetaData);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,14 +290,11 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
|
|||||||
MetaData.OK_Data = true;
|
MetaData.OK_Data = true;
|
||||||
emit onMetaDataChanged(&MetaData);
|
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;
|
m_blnRunning = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -327,20 +302,17 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
|
|||||||
if (!objDevice->open(QIODevice::ReadOnly))
|
if (!objDevice->open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::OpenStream cannot open QIODevice";
|
qDebug() << "DATVideoProcess::OpenStream cannot open QIODevice";
|
||||||
|
|
||||||
m_blnRunning = false;
|
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();
|
||||||
|
|
||||||
if(m_objFormatCtx==NULL)
|
if (m_objFormatCtx == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::OpenStream cannot alloc format FFMPEG context";
|
qDebug() << "DATVideoProcess::OpenStream cannot alloc format FFMPEG context";
|
||||||
|
|
||||||
m_blnRunning = false;
|
m_blnRunning = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -352,17 +324,15 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
|
|||||||
0,
|
0,
|
||||||
reinterpret_cast<void *>(objDevice),
|
reinterpret_cast<void *>(objDevice),
|
||||||
&ReadFunction,
|
&ReadFunction,
|
||||||
NULL,
|
nullptr,
|
||||||
&SeekFunction);
|
&SeekFunction);
|
||||||
|
|
||||||
m_objFormatCtx->pb = objIOCtx;
|
m_objFormatCtx->pb = objIOCtx;
|
||||||
m_objFormatCtx->flags |= AVFMT_FLAG_CUSTOM_IO;
|
m_objFormatCtx->flags |= AVFMT_FLAG_CUSTOM_IO;
|
||||||
|
|
||||||
|
if (avformat_open_input(&m_objFormatCtx, nullptr , nullptr, nullptr) < 0)
|
||||||
if (avformat_open_input(&m_objFormatCtx, NULL , NULL, NULL) < 0)
|
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::OpenStream cannot open stream";
|
qDebug() << "DATVideoProcess::OpenStream cannot open stream";
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -373,9 +343,7 @@ bool DATVideoRender::OpenStream(DATVideostream *objDevice)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_blnIsOpen=true;
|
m_blnIsOpen=true;
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -390,12 +358,10 @@ bool DATVideoRender::RenderStream()
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,7 +373,6 @@ bool DATVideoRender::RenderStream()
|
|||||||
if (av_read_frame(m_objFormatCtx, &objPacket) < 0)
|
if (av_read_frame(m_objFormatCtx, &objPacket) < 0)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::RenderStream reading packet error";
|
qDebug() << "DATVideoProcess::RenderStream reading packet error";
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -423,7 +388,6 @@ bool DATVideoRender::RenderStream()
|
|||||||
if (new_decode( m_objDecoderCtx, m_objFrame, &intGotFrame, &objPacket)<0)
|
if (new_decode( m_objDecoderCtx, m_objFrame, &intGotFrame, &objPacket)<0)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::RenderStream decoding packet error";
|
qDebug() << "DATVideoProcess::RenderStream decoding packet error";
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -431,21 +395,19 @@ bool DATVideoRender::RenderStream()
|
|||||||
if (intGotFrame)
|
if (intGotFrame)
|
||||||
{
|
{
|
||||||
//Rendering and RGB Converter setup
|
//Rendering and RGB Converter setup
|
||||||
|
|
||||||
blnNeedRenderingSetup=(m_intFrameCount==0);
|
blnNeedRenderingSetup=(m_intFrameCount==0);
|
||||||
blnNeedRenderingSetup|=(m_objSwsCtx==NULL);
|
blnNeedRenderingSetup|=(m_objSwsCtx==nullptr);
|
||||||
|
|
||||||
if((m_intCurrentRenderWidth!=m_objFrame->width) || (m_intCurrentRenderHeight!=m_objFrame->height))
|
if ((m_intCurrentRenderWidth!=m_objFrame->width) || (m_intCurrentRenderHeight!=m_objFrame->height)) {
|
||||||
{
|
|
||||||
blnNeedRenderingSetup=true;
|
blnNeedRenderingSetup=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blnNeedRenderingSetup)
|
if (blnNeedRenderingSetup)
|
||||||
{
|
{
|
||||||
if(m_objSwsCtx!=NULL)
|
if (m_objSwsCtx != nullptr)
|
||||||
{
|
{
|
||||||
sws_freeContext(m_objSwsCtx);
|
sws_freeContext(m_objSwsCtx);
|
||||||
m_objSwsCtx=NULL;
|
m_objSwsCtx=nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Convertisseur YUV -> RGB
|
//Convertisseur YUV -> RGB
|
||||||
@ -461,15 +423,12 @@ bool DATVideoRender::RenderStream()
|
|||||||
|
|
||||||
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, nullptr, nullptr) < 0)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::RenderStream cannont init video data converter";
|
qDebug() << "DATVideoProcess::RenderStream cannont init video data converter";
|
||||||
|
m_objSwsCtx=nullptr;
|
||||||
m_objSwsCtx=NULL;
|
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_intCurrentRenderHeight>0) && (m_intCurrentRenderWidth>0))
|
if ((m_intCurrentRenderHeight>0) && (m_intCurrentRenderWidth>0))
|
||||||
@ -481,13 +440,10 @@ bool DATVideoRender::RenderStream()
|
|||||||
if (av_image_alloc(m_pbytDecodedData, m_pintDecodedLineSize,m_objFrame->width, m_objFrame->height, AV_PIX_FMT_RGB24, 1)<0)
|
if (av_image_alloc(m_pbytDecodedData, m_pintDecodedLineSize,m_objFrame->width, m_objFrame->height, AV_PIX_FMT_RGB24, 1)<0)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::RenderStream cannont init video image buffer";
|
qDebug() << "DATVideoProcess::RenderStream cannont init video image buffer";
|
||||||
|
|
||||||
sws_freeContext(m_objSwsCtx);
|
sws_freeContext(m_objSwsCtx);
|
||||||
m_objSwsCtx=NULL;
|
m_objSwsCtx=nullptr;
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rendering device setup
|
//Rendering device setup
|
||||||
@ -510,18 +466,14 @@ bool DATVideoRender::RenderStream()
|
|||||||
if (sws_scale(m_objSwsCtx, m_objFrame->data, m_objFrame->linesize, 0, m_objFrame->height, m_pbytDecodedData, m_pintDecodedLineSize)<0)
|
if (sws_scale(m_objSwsCtx, m_objFrame->data, m_objFrame->linesize, 0, m_objFrame->height, m_pbytDecodedData, m_pintDecodedLineSize)<0)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::RenderStream error converting video frame to RGB";
|
qDebug() << "DATVideoProcess::RenderStream error converting video frame to RGB";
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderImage(m_pbytDecodedData[0]);
|
renderImage(m_pbytDecodedData[0]);
|
||||||
|
|
||||||
av_frame_unref(m_objFrame);
|
av_frame_unref(m_objFrame);
|
||||||
|
|
||||||
m_intFrameCount ++;
|
m_intFrameCount ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
av_packet_unref(&objPacket);
|
av_packet_unref(&objPacket);
|
||||||
@ -536,29 +488,25 @@ bool DATVideoRender::RenderStream()
|
|||||||
bool DATVideoRender::CloseStream(QIODevice *objDevice)
|
bool DATVideoRender::CloseStream(QIODevice *objDevice)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(m_blnRunning)
|
if (m_blnRunning) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!objDevice)
|
if (!objDevice)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::CloseStream QIODevice is NULL";
|
qDebug() << "DATVideoProcess::CloseStream QIODevice is nullptr";
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_objFormatCtx)
|
if (!m_objFormatCtx)
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoProcess::CloseStream FFMEG Context is not initialized";
|
qDebug() << "DATVideoProcess::CloseStream FFMEG Context is not initialized";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,12 +515,12 @@ bool DATVideoRender::CloseStream(QIODevice *objDevice)
|
|||||||
|
|
||||||
// maybe done in the avcodec_close
|
// maybe done in the avcodec_close
|
||||||
// avformat_close_input(&m_objFormatCtx);
|
// avformat_close_input(&m_objFormatCtx);
|
||||||
// m_objFormatCtx=NULL;
|
// m_objFormatCtx=nullptr;
|
||||||
|
|
||||||
if (m_objDecoderCtx)
|
if (m_objDecoderCtx)
|
||||||
{
|
{
|
||||||
avcodec_close(m_objDecoderCtx);
|
avcodec_close(m_objDecoderCtx);
|
||||||
m_objDecoderCtx=NULL;
|
m_objDecoderCtx = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_objFrame)
|
if (m_objFrame)
|
||||||
@ -581,18 +529,15 @@ bool DATVideoRender::CloseStream(QIODevice *objDevice)
|
|||||||
av_frame_free(&m_objFrame);
|
av_frame_free(&m_objFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_objSwsCtx!=NULL)
|
if (m_objSwsCtx != nullptr)
|
||||||
{
|
{
|
||||||
sws_freeContext(m_objSwsCtx);
|
sws_freeContext(m_objSwsCtx);
|
||||||
m_objSwsCtx=NULL;
|
m_objSwsCtx = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
objDevice->close();
|
objDevice->close();
|
||||||
|
|
||||||
m_blnIsOpen=false;
|
m_blnIsOpen=false;
|
||||||
|
|
||||||
m_blnRunning=false;
|
m_blnRunning=false;
|
||||||
|
|
||||||
m_intCurrentRenderWidth=-1;
|
m_intCurrentRenderWidth=-1;
|
||||||
m_intCurrentRenderHeight=-1;
|
m_intCurrentRenderHeight=-1;
|
||||||
|
|
||||||
@ -612,19 +557,25 @@ int DATVideoRender::new_decode(AVCodecContext *avctx, AVFrame *frame, int *got_f
|
|||||||
|
|
||||||
*got_frame = 0;
|
*got_frame = 0;
|
||||||
|
|
||||||
if (pkt) {
|
if (pkt)
|
||||||
|
{
|
||||||
ret = avcodec_send_packet(avctx, pkt);
|
ret = avcodec_send_packet(avctx, pkt);
|
||||||
// In particular, we don't expect AVERROR(EAGAIN), because we read all
|
// In particular, we don't expect AVERROR(EAGAIN), because we read all
|
||||||
// decoded frames with avcodec_receive_frame() until done.
|
// decoded frames with avcodec_receive_frame() until done.
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
return ret == AVERROR_EOF ? 0 : ret;
|
return ret == AVERROR_EOF ? 0 : ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = avcodec_receive_frame(avctx, frame);
|
ret = avcodec_receive_frame(avctx, frame);
|
||||||
if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
|
|
||||||
|
if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
|
||||||
return ret;
|
return ret;
|
||||||
if (ret >= 0)
|
}
|
||||||
|
|
||||||
|
if (ret >= 0) {
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -66,22 +66,17 @@ struct DataTSMetaData2
|
|||||||
{
|
{
|
||||||
PID=-1;
|
PID=-1;
|
||||||
CodecID=-1;
|
CodecID=-1;
|
||||||
|
|
||||||
|
|
||||||
Program="";
|
Program="";
|
||||||
Stream="";
|
Stream="";
|
||||||
|
|
||||||
Width=-1;
|
Width=-1;
|
||||||
Height=-1;
|
Height=-1;
|
||||||
BitRate=-1;
|
BitRate=-1;
|
||||||
Channels=-1;
|
Channels=-1;
|
||||||
CodecDescription="";
|
CodecDescription="";
|
||||||
|
|
||||||
OK_Data=false;
|
OK_Data=false;
|
||||||
OK_Decoding=false;
|
OK_Decoding=false;
|
||||||
OK_TransportStream=false;
|
OK_TransportStream=false;
|
||||||
OK_VideoStream=false;
|
OK_VideoStream=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,18 +126,16 @@ protected:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onMetaDataChanged(DataTSMetaData2 *objMetaData);
|
void onMetaDataChanged(DataTSMetaData2 *objMetaData);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//To run Video Rendering with a dedicated thread
|
//To run Video Rendering with a dedicated thread
|
||||||
class DATVideoRenderThread: public QThread
|
class DATVideoRenderThread: public QThread
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DATVideoRenderThread()
|
DATVideoRenderThread()
|
||||||
{
|
{
|
||||||
m_objRenderer = NULL;
|
m_objRenderer = nullptr;
|
||||||
m_objStream = NULL;
|
m_objStream = nullptr;
|
||||||
m_blnRenderingVideo=false;
|
m_blnRenderingVideo=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,31 +155,25 @@ class DATVideoRenderThread: public QThread
|
|||||||
|
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
if(m_blnRenderingVideo)
|
if (m_blnRenderingVideo) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_objRenderer==NULL) || (m_objStream==NULL))
|
if ((m_objRenderer==nullptr) || (m_objStream==nullptr)) {
|
||||||
{
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_blnRenderingVideo = m_objRenderer->OpenStream(m_objStream);
|
m_blnRenderingVideo = m_objRenderer->OpenStream(m_objStream);
|
||||||
|
|
||||||
if(!m_blnRenderingVideo)
|
if (!m_blnRenderingVideo) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while((m_objRenderer->RenderStream()) && (m_blnRenderingVideo==true))
|
while ((m_objRenderer->RenderStream()) && (m_blnRenderingVideo == true)) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objRenderer->CloseStream(m_objStream);
|
m_objRenderer->CloseStream(m_objStream);
|
||||||
|
|
||||||
m_blnRenderingVideo=false;
|
m_blnRenderingVideo=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopRendering()
|
void stopRendering()
|
||||||
|
@ -39,13 +39,11 @@ DATVideostream::~DATVideostream()
|
|||||||
|
|
||||||
void DATVideostream::cleanUp()
|
void DATVideostream::cleanUp()
|
||||||
{
|
{
|
||||||
if(m_objFIFO.size()>0)
|
if (m_objFIFO.size() > 0) {
|
||||||
{
|
|
||||||
m_objFIFO.clear();
|
m_objFIFO.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_objeventLoop.isRunning())
|
if (m_objeventLoop.isRunning()) {
|
||||||
{
|
|
||||||
m_objeventLoop.exit();
|
m_objeventLoop.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +55,7 @@ void DATVideostream::cleanUp()
|
|||||||
|
|
||||||
bool DATVideostream::setMemoryLimit(int intMemoryLimit)
|
bool DATVideostream::setMemoryLimit(int intMemoryLimit)
|
||||||
{
|
{
|
||||||
if(intMemoryLimit<=0)
|
if (intMemoryLimit <= 0) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,25 +66,22 @@ bool DATVideostream::setMemoryLimit(int intMemoryLimit)
|
|||||||
|
|
||||||
int DATVideostream::pushData(const char * chrData, int intSize)
|
int DATVideostream::pushData(const char * chrData, int intSize)
|
||||||
{
|
{
|
||||||
if(intSize<=0)
|
if (intSize <= 0) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objMutex.lock();
|
m_objMutex.lock();
|
||||||
|
|
||||||
m_intPacketReceived++;
|
m_intPacketReceived++;
|
||||||
|
|
||||||
m_intBytesWaiting += intSize;
|
m_intBytesWaiting += intSize;
|
||||||
if(m_intBytesWaiting>m_intMemoryLimit)
|
|
||||||
{
|
if (m_intBytesWaiting > m_intMemoryLimit) {
|
||||||
m_intBytesWaiting -= m_objFIFO.dequeue().size();
|
m_intBytesWaiting -= m_objFIFO.dequeue().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objFIFO.enqueue(QByteArray(chrData,intSize));
|
m_objFIFO.enqueue(QByteArray(chrData,intSize));
|
||||||
m_intBytesAvailable = m_objFIFO.head().size();
|
m_intBytesAvailable = m_objFIFO.head().size();
|
||||||
m_intTotalReceived += intSize;
|
m_intTotalReceived += intSize;
|
||||||
|
|
||||||
m_intQueueWaiting=m_objFIFO.count();
|
m_intQueueWaiting=m_objFIFO.count();
|
||||||
|
|
||||||
m_objMutex.unlock();
|
m_objMutex.unlock();
|
||||||
@ -100,10 +94,9 @@ int DATVideostream::pushData(const char * chrData, int intSize)
|
|||||||
|
|
||||||
if (m_intPacketReceived % MinStackSize == 1)
|
if (m_intPacketReceived % MinStackSize == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_intPercentBuffer = (100*m_intBytesWaiting)/m_intMemoryLimit;
|
m_intPercentBuffer = (100*m_intBytesWaiting)/m_intMemoryLimit;
|
||||||
if(m_intPercentBuffer>100)
|
|
||||||
{
|
if (m_intPercentBuffer > 100) {
|
||||||
m_intPercentBuffer = 100;
|
m_intPercentBuffer = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,13 +139,11 @@ qint64 DATVideostream::readData(char *data, qint64 len)
|
|||||||
|
|
||||||
intExpectedLen = (int) len;
|
intExpectedLen = (int) len;
|
||||||
|
|
||||||
if(intExpectedLen<=0)
|
if (intExpectedLen <= 0) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_objeventLoop.isRunning())
|
if (m_objeventLoop.isRunning()) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +156,8 @@ qint64 DATVideostream::readData(char *data, qint64 len)
|
|||||||
|
|
||||||
if (MultiThreaded == true)
|
if (MultiThreaded == true)
|
||||||
{
|
{
|
||||||
|
|
||||||
intThreadLoop=0;
|
intThreadLoop=0;
|
||||||
|
|
||||||
while ((m_objFIFO.isEmpty()) || (m_objFIFO.count() < MinStackSize))
|
while ((m_objFIFO.isEmpty()) || (m_objFIFO.count() < MinStackSize))
|
||||||
{
|
{
|
||||||
QThread::msleep(5);
|
QThread::msleep(5);
|
||||||
@ -174,8 +165,7 @@ qint64 DATVideostream::readData(char *data, qint64 len)
|
|||||||
|
|
||||||
if (ThreadTimeOut >= 0)
|
if (ThreadTimeOut >= 0)
|
||||||
{
|
{
|
||||||
if(intThreadLoop*5>ThreadTimeOut)
|
if (intThreadLoop*5 > ThreadTimeOut) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace leansdr
|
namespace leansdr
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename T> struct datvvideoplayer: runnable
|
template<typename T> struct datvvideoplayer: runnable
|
||||||
{
|
{
|
||||||
datvvideoplayer(scheduler *sch, pipebuf<T> &_in, DATVideostream * objVideoStream) :
|
datvvideoplayer(scheduler *sch, pipebuf<T> &_in, DATVideostream * objVideoStream) :
|
||||||
@ -33,8 +34,10 @@ template<typename T> struct datvvideoplayer: runnable
|
|||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
int size = in.readable() * sizeof(T);
|
int size = in.readable() * sizeof(T);
|
||||||
if (!size)
|
|
||||||
|
if (!size) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int nw = m_objVideoStream->pushData((const char *) in.rd(), size);
|
int nw = m_objVideoStream->pushData((const char *) in.rd(), size);
|
||||||
|
|
||||||
@ -43,18 +46,22 @@ template<typename T> struct datvvideoplayer: runnable
|
|||||||
fatal("leansdr::datvvideoplayer::run: pipe");
|
fatal("leansdr::datvvideoplayer::run: pipe");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nw < 0)
|
if (nw < 0)
|
||||||
{
|
{
|
||||||
fatal("leansdr::datvvideoplayer::run: write");
|
fatal("leansdr::datvvideoplayer::run: write");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nw % sizeof(T))
|
if (nw % sizeof(T))
|
||||||
{
|
{
|
||||||
fatal("leansdr::datvvideoplayer::run: partial write");
|
fatal("leansdr::datvvideoplayer::run: partial write");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
in.read(nw / sizeof(T));
|
in.read(nw / sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pipereader<T> in;
|
pipereader<T> in;
|
||||||
DATVideostream * m_objVideoStream;
|
DATVideostream * m_objVideoStream;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user