1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -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()
{
if (m_blnGLContextInitialized)

View File

@ -28,8 +28,8 @@
#include <QFont>
#include <QMatrix4x4>
#include "dsp/dsptypes.h"
#include "gui/glshadertvarray.h"
#include "gui/glshadertextured.h"
#include "gui/glshadertvarray.h"
#include "util/export.h"
#include "util/bitfieldindex.h"
@ -50,9 +50,18 @@ public:
virtual void resizeATVScreen(int intCols, int intRows);
virtual void renderImage(unsigned char * objData);
QRgb* getRowBuffer(int intRow);
void resetImage();
virtual bool selectRow(int intLine);
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:
void traceSizeChanged(int);
void sampleRateChanged(int);
@ -71,20 +80,13 @@ private:
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 resizeGL(int width, int height);
void paintGL();
void mousePressEvent(QMouseEvent*);
QRgb* getRowBuffer(int intRow);
void resetImage();
unsigned char *m_chrLastData;
protected slots:
void cleanup();

View File

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

View File

@ -22,7 +22,7 @@
#include <sys/time.h>
#include "leansdr/framework.h"
#include "datvscreen.h"
#include "gui/tvscreen.h"
namespace leansdr
{
@ -35,11 +35,11 @@ template<typename T> struct datvconstellation: runnable
unsigned long decimation;
unsigned long pixels_per_frame;
cstln_lut<256> **cstln; // Optional ptr to optional constellation
DATVScreen *m_objDATVScreen;
TVScreen *m_objDATVScreen;
pipereader<complex<T> > in;
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),
xymin(_xymin),
xymax(_xymax),

View File

@ -39,8 +39,8 @@ DATVDemod::DATVDemod(DeviceSourceAPI *deviceAPI) :
ChannelSinkAPI(m_channelIdURI),
m_blnNeedConfigUpdate(false),
m_deviceAPI(deviceAPI),
m_objRegisteredDATVScreen(NULL),
m_objRegisteredVideoRender(NULL),
m_objRegisteredTVScreen(0),
m_objRegisteredVideoRender(0),
m_objVideoStream(NULL),
m_objRenderThread(NULL),
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;
}
@ -694,11 +694,11 @@ void DATVDemod::InitDATVFramework()
//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->cstln = &m_objDemodulator->cstln;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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