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

Unify TV screen (3)

This commit is contained in:
f4exb 2018-03-11 16:39:02 +01:00
parent def91c4019
commit 707ce197cd
14 changed files with 78 additions and 69 deletions

View File

@ -171,6 +171,14 @@ void ATVScreen::tick()
} }
} }
void ATVScreen::connectTimer(const QTimer& objTimer)
{
qDebug() << "ATVScreen::connectTimer";
disconnect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
connect(&objTimer, SIGNAL(timeout()), this, SLOT(tick()));
m_objTimer.stop();
}
void ATVScreen::cleanup() void ATVScreen::cleanup()
{ {
if (m_blnGLContextInitialized) if (m_blnGLContextInitialized)

View File

@ -28,8 +28,8 @@
#include <QFont> #include <QFont>
#include <QMatrix4x4> #include <QMatrix4x4>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "gui/glshadertvarray.h"
#include "gui/glshadertextured.h" #include "gui/glshadertextured.h"
#include "gui/glshadertvarray.h"
#include "util/export.h" #include "util/export.h"
#include "util/bitfieldindex.h" #include "util/bitfieldindex.h"
@ -50,9 +50,18 @@ public:
virtual void resizeATVScreen(int intCols, int intRows); virtual void resizeATVScreen(int intCols, int intRows);
virtual void renderImage(unsigned char * objData); virtual void renderImage(unsigned char * objData);
QRgb* getRowBuffer(int intRow);
void resetImage();
virtual bool selectRow(int intLine); virtual bool selectRow(int intLine);
virtual bool setDataColor(int intCol,int intRed, int intGreen, int intBlue); virtual bool setDataColor(int intCol,int intRed, int intGreen, int intBlue);
void connectTimer(const QTimer& timer);
//Valeurs par défaut
static const int ATV_COLS=192;
static const int ATV_ROWS=625;
signals: signals:
void traceSizeChanged(int); void traceSizeChanged(int);
void sampleRateChanged(int); void sampleRateChanged(int);
@ -71,20 +80,13 @@ private:
GLShaderTVArray m_objGLShaderArray; GLShaderTVArray m_objGLShaderArray;
unsigned char *m_chrLastData;
//Valeurs par défaut
static const int ATV_COLS=192;
static const int ATV_ROWS=625;
void initializeGL(); void initializeGL();
void resizeGL(int width, int height); void resizeGL(int width, int height);
void paintGL(); void paintGL();
void mousePressEvent(QMouseEvent*); void mousePressEvent(QMouseEvent*);
QRgb* getRowBuffer(int intRow); unsigned char *m_chrLastData;
void resetImage();
protected slots: protected slots:
void cleanup(); void cleanup();

View File

@ -4,7 +4,6 @@ set(datv_SOURCES
datvdemod.cpp datvdemod.cpp
datvdemodgui.cpp datvdemodgui.cpp
datvdemodplugin.cpp datvdemodplugin.cpp
datvscreen.cpp
datvideostream.cpp datvideostream.cpp
datvideorender.cpp datvideorender.cpp
) )
@ -13,7 +12,6 @@ set(datv_HEADERS
datvdemod.h datvdemod.h
datvdemodgui.h datvdemodgui.h
datvdemodplugin.h datvdemodplugin.h
datvscreen.h
datvideostream.h datvideostream.h
datvideorender.h datvideorender.h
) )

View File

@ -22,7 +22,7 @@
#include <sys/time.h> #include <sys/time.h>
#include "leansdr/framework.h" #include "leansdr/framework.h"
#include "datvscreen.h" #include "gui/tvscreen.h"
namespace leansdr namespace leansdr
{ {
@ -35,11 +35,11 @@ template<typename T> struct datvconstellation: runnable
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; TVScreen *m_objDATVScreen;
pipereader<complex<T> > in; pipereader<complex<T> > in;
unsigned long phase; unsigned long phase;
datvconstellation(scheduler *sch, pipebuf<complex<T> > &_in, T _xymin, T _xymax, const char *_name = NULL, DATVScreen * objDATVScreen = NULL) : datvconstellation(scheduler *sch, pipebuf<complex<T> > &_in, T _xymin, T _xymax, const char *_name = 0, TVScreen *objDATVScreen = 0) :
runnable(sch, _name ? _name : _in.name), runnable(sch, _name ? _name : _in.name),
xymin(_xymin), xymin(_xymin),
xymax(_xymax), xymax(_xymax),

View File

@ -39,8 +39,8 @@ DATVDemod::DATVDemod(DeviceSourceAPI *deviceAPI) :
ChannelSinkAPI(m_channelIdURI), ChannelSinkAPI(m_channelIdURI),
m_blnNeedConfigUpdate(false), m_blnNeedConfigUpdate(false),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_objRegisteredDATVScreen(NULL), m_objRegisteredTVScreen(0),
m_objRegisteredVideoRender(NULL), m_objRegisteredVideoRender(0),
m_objVideoStream(NULL), m_objVideoStream(NULL),
m_objRenderThread(NULL), m_objRenderThread(NULL),
m_blnRenderingVideo(false), m_blnRenderingVideo(false),
@ -112,9 +112,9 @@ void DATVDemod::channelSampleRateChanged()
} }
} }
bool DATVDemod::SetDATVScreen(DATVScreen *objScreen) bool DATVDemod::SetTVScreen(TVScreen *objScreen)
{ {
m_objRegisteredDATVScreen = objScreen; m_objRegisteredTVScreen = objScreen;
return true; return true;
} }
@ -694,11 +694,11 @@ void DATVDemod::InitDATVFramework()
//constellation //constellation
if (m_objRegisteredDATVScreen) if (m_objRegisteredTVScreen)
{ {
m_objRegisteredDATVScreen->resizeDATVScreen(256,256); m_objRegisteredTVScreen->resizeTVScreen(256,256);
r_scope_symbols = new leansdr::datvconstellation<leansdr::f32>(m_objScheduler, *p_sampled, -128,128, NULL, m_objRegisteredDATVScreen); 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;
} }

View File

@ -209,7 +209,7 @@ public:
virtual void stop(); virtual void stop();
virtual bool handleMessage(const Message& cmd); virtual bool handleMessage(const Message& cmd);
bool SetDATVScreen(DATVScreen *objScreen); bool SetTVScreen(TVScreen *objScreen);
DATVideostream * SetVideoRender(DATVideoRender *objScreen); DATVideostream * SetVideoRender(DATVideoRender *objScreen);
bool PlayVideo(bool blnStartStop); bool PlayVideo(bool blnStartStop);
@ -441,7 +441,7 @@ private:
DownChannelizer* m_channelizer; DownChannelizer* m_channelizer;
//*************** DATV PARAMETERS *************** //*************** DATV PARAMETERS ***************
DATVScreen * m_objRegisteredDATVScreen; TVScreen * m_objRegisteredTVScreen;
DATVideoRender * m_objRegisteredVideoRender; DATVideoRender * m_objRegisteredVideoRender;
DATVideostream * m_objVideoStream; DATVideostream * m_objVideoStream;
DATVideoRenderThread * m_objRenderThread; DATVideoRenderThread * m_objRenderThread;

View File

@ -266,7 +266,7 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
m_objDATVDemod = (DATVDemod*) rxChannel; m_objDATVDemod = (DATVDemod*) rxChannel;
m_objDATVDemod->setMessageQueueToGUI(getInputMessageQueue()); m_objDATVDemod->setMessageQueueToGUI(getInputMessageQueue());
m_objDATVDemod->SetDATVScreen(ui->screenTV); m_objDATVDemod->SetTVScreen(ui->screenTV);
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);

View File

@ -248,7 +248,7 @@
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
<item> <item>
<widget class="DATVScreen" name="screenTV" native="true"> <widget class="TVScreen" name="screenTV" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -927,11 +927,6 @@
<header>gui/rollupwidget.h</header> <header>gui/rollupwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>DATVScreen</class>
<extends>QWidget</extends>
<header>datvscreen.h</header>
</customwidget>
<customwidget> <customwidget>
<class>DATVideoRender</class> <class>DATVideoRender</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -944,6 +939,12 @@
<header>gui/valuedialz.h</header> <header>gui/valuedialz.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>TVScreen</class>
<extends>QWidget</extends>
<header>gui/tvscreen.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -18,7 +18,7 @@
#include "datvideorender.h" #include "datvideorender.h"
DATVideoRender::DATVideoRender(QWidget * parent): DATVideoRender::DATVideoRender(QWidget * parent):
DATVScreen(parent) TVScreen(true, parent)
{ {
installEventFilter(this); installEventFilter(this);
m_blnIsFullScreen=false; m_blnIsFullScreen=false;
@ -488,7 +488,7 @@ bool DATVideoRender::RenderStream()
//Rendering device setup //Rendering device setup
resizeDATVScreen(m_objFrame->width,m_objFrame->height); resizeTVScreen(m_objFrame->width,m_objFrame->height);
update(); update();
resetImage(); resetImage();

View File

@ -23,7 +23,7 @@
#include <QIODevice> #include <QIODevice>
#include <QThread> #include <QThread>
#include "datvscreen.h" #include "gui/tvscreen.h"
#include "datvideostream.h" #include "datvideostream.h"
extern "C" extern "C"
@ -85,7 +85,7 @@ struct DataTSMetaData2
} }
}; };
class DATVideoRender : public DATVScreen class DATVideoRender : public TVScreen
{ {
Q_OBJECT Q_OBJECT

View File

@ -31,14 +31,12 @@ CONFIG(macx):INCLUDEPATH += "../../../../../boost_1_64_0"
SOURCES += datvdemod.cpp\ SOURCES += datvdemod.cpp\
datvdemodgui.cpp\ datvdemodgui.cpp\
datvdemodplugin.cpp\ datvdemodplugin.cpp\
datvscreen.cpp \
datvideostream.cpp \ datvideostream.cpp \
datvideorender.cpp datvideorender.cpp
HEADERS += datvdemod.h\ HEADERS += datvdemod.h\
datvdemodgui.h\ datvdemodgui.h\
datvdemodplugin.h\ datvdemodplugin.h\
datvscreen.h \
leansdr/convolutional.h \ leansdr/convolutional.h \
leansdr/dsp.h \ leansdr/dsp.h \
leansdr/dvb.h \ leansdr/dvb.h \

View File

@ -41,6 +41,7 @@ set(sdrgui_SOURCES
gui/tickedslider.cpp gui/tickedslider.cpp
gui/transverterbutton.cpp gui/transverterbutton.cpp
gui/transverterdialog.cpp gui/transverterdialog.cpp
gui/tvscreen.cpp
gui/valuedial.cpp gui/valuedial.cpp
gui/valuedialz.cpp gui/valuedialz.cpp
@ -97,6 +98,7 @@ set(sdrgui_HEADERS
gui/tickedslider.h gui/tickedslider.h
gui/transverterbutton.h gui/transverterbutton.h
gui/transverterdialog.h gui/transverterdialog.h
gui/tvscreen.h
gui/valuedial.h gui/valuedial.h
gui/valuedialz.h gui/valuedialz.h

View File

@ -22,13 +22,13 @@
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QSurface> #include <QSurface>
#include "datvscreen.h" #include "tvscreen.h"
#include <algorithm> #include <algorithm>
#include <QDebug> #include <QDebug>
DATVScreen::DATVScreen(QWidget* parent) : TVScreen::TVScreen(bool blnColor, QWidget* parent) :
QGLWidget(parent), m_objMutex(QMutex::NonRecursive), m_objGLShaderArray(true) QGLWidget(parent), m_objMutex(QMutex::NonRecursive), m_objGLShaderArray(blnColor)
{ {
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
@ -40,17 +40,17 @@ DATVScreen::DATVScreen(QWidget* parent) :
m_blnGLContextInitialized = false; m_blnGLContextInitialized = false;
//Par défaut //Par défaut
m_intAskedCols = DATV_COLS; m_intAskedCols = TV_COLS;
m_intAskedRows = DATV_ROWS; m_intAskedRows = TV_ROWS;
} }
DATVScreen::~DATVScreen() TVScreen::~TVScreen()
{ {
cleanup(); cleanup();
} }
QRgb* DATVScreen::getRowBuffer(int intRow) QRgb* TVScreen::getRowBuffer(int intRow)
{ {
if (!m_blnGLContextInitialized) if (!m_blnGLContextInitialized)
{ {
@ -60,25 +60,25 @@ QRgb* DATVScreen::getRowBuffer(int intRow)
return m_objGLShaderArray.GetRowBuffer(intRow); return m_objGLShaderArray.GetRowBuffer(intRow);
} }
void DATVScreen::renderImage(unsigned char * objData) void TVScreen::renderImage(unsigned char * objData)
{ {
m_chrLastData = objData; m_chrLastData = objData;
m_blnDataChanged = true; m_blnDataChanged = true;
//update(); //update();
} }
void DATVScreen::resetImage() void TVScreen::resetImage()
{ {
m_objGLShaderArray.ResetPixels(); m_objGLShaderArray.ResetPixels();
} }
void DATVScreen::resizeDATVScreen(int intCols, int intRows) void TVScreen::resizeTVScreen(int intCols, int intRows)
{ {
m_intAskedCols = intCols; m_intAskedCols = intCols;
m_intAskedRows = intRows; m_intAskedRows = intRows;
} }
void DATVScreen::initializeGL() void TVScreen::initializeGL()
{ {
m_objMutex.lock(); m_objMutex.lock();
@ -128,21 +128,21 @@ void DATVScreen::initializeGL()
} }
connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this,
&DATVScreen::cleanup); // TODO: when migrating to QOpenGLWidget &TVScreen::cleanup); // TODO: when migrating to QOpenGLWidget
m_blnGLContextInitialized = true; m_blnGLContextInitialized = true;
m_objMutex.unlock(); m_objMutex.unlock();
} }
void DATVScreen::resizeGL(int intWidth, int intHeight) void TVScreen::resizeGL(int intWidth, int intHeight)
{ {
QOpenGLFunctions *ptrF = QOpenGLContext::currentContext()->functions(); QOpenGLFunctions *ptrF = QOpenGLContext::currentContext()->functions();
ptrF->glViewport(0, 0, intWidth, intHeight); ptrF->glViewport(0, 0, intWidth, intHeight);
m_blnConfigChanged = true; m_blnConfigChanged = true;
} }
void DATVScreen::paintGL() void TVScreen::paintGL()
{ {
if (!m_objMutex.tryLock(2)) if (!m_objMutex.tryLock(2))
return; return;
@ -161,18 +161,18 @@ void DATVScreen::paintGL()
m_objMutex.unlock(); m_objMutex.unlock();
} }
void DATVScreen::mousePressEvent(QMouseEvent* event __attribute__((unused))) void TVScreen::mousePressEvent(QMouseEvent* event __attribute__((unused)))
{ {
} }
void DATVScreen::tick() void TVScreen::tick()
{ {
if (m_blnDataChanged) { if (m_blnDataChanged) {
update(); update();
} }
} }
void DATVScreen::connectTimer(const QTimer& objTimer) void TVScreen::connectTimer(const QTimer& objTimer)
{ {
qDebug() << "DATVScreen::connectTimer"; qDebug() << "DATVScreen::connectTimer";
disconnect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); disconnect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
@ -180,7 +180,7 @@ void DATVScreen::connectTimer(const QTimer& objTimer)
m_objTimer.stop(); m_objTimer.stop();
} }
void DATVScreen::cleanup() void TVScreen::cleanup()
{ {
if (m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
@ -188,7 +188,7 @@ void DATVScreen::cleanup()
} }
} }
bool DATVScreen::selectRow(int intLine) bool TVScreen::selectRow(int intLine)
{ {
if (m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
@ -200,7 +200,7 @@ bool DATVScreen::selectRow(int intLine)
} }
} }
bool DATVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue) bool TVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue)
{ {
if (m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {

View File

@ -18,8 +18,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_DATVSCREEN_H #ifndef INCLUDE_TVSCREEN_H
#define INCLUDE_DATVSCREEN_H #define INCLUDE_TVSCREEN_H
#include <QGLWidget> #include <QGLWidget>
#include <QPen> #include <QPen>
@ -28,23 +28,23 @@
#include <QFont> #include <QFont>
#include <QMatrix4x4> #include <QMatrix4x4>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "gui/glshadertextured.h" #include "glshadertextured.h"
#include "gui/glshadertvarray.h" #include "glshadertvarray.h"
#include "util/export.h" #include "util/export.h"
#include "util/bitfieldindex.h" #include "util/bitfieldindex.h"
class QPainter; class QPainter;
class DATVScreen: public QGLWidget class TVScreen: public QGLWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
DATVScreen(QWidget* parent = NULL); TVScreen(bool blnColor, QWidget* parent = 0);
~DATVScreen(); ~TVScreen();
void resizeDATVScreen(int intCols, int intRows); void resizeTVScreen(int intCols, int intRows);
void renderImage(unsigned char * objData); void renderImage(unsigned char * objData);
QRgb* getRowBuffer(int intRow); QRgb* getRowBuffer(int intRow);
void resetImage(); void resetImage();
@ -55,8 +55,8 @@ public:
void connectTimer(const QTimer& timer); void connectTimer(const QTimer& timer);
//Valeurs par défaut //Valeurs par défaut
static const int DATV_COLS=256; static const int TV_COLS=256;
static const int DATV_ROWS=256; static const int TV_ROWS=256;
signals: signals:
void traceSizeChanged(int); void traceSizeChanged(int);
@ -82,11 +82,11 @@ private:
void mousePressEvent(QMouseEvent*); void mousePressEvent(QMouseEvent*);
unsigned char *m_chrLastData; unsigned char *m_chrLastData;
protected slots: protected slots:
void cleanup(); void cleanup();
void tick(); void tick();
}; };
#endif // INCLUDE_DATVSCREEN_H #endif // INCLUDE_TVSCREEN_H