1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-24 21:15:24 -04:00

ATV Demod: use a UI agnostic interface for the ATV screen

This commit is contained in:
f4exb 2017-11-07 01:04:43 +01:00
parent f2fe5753b1
commit db57a4b1e1
7 changed files with 67 additions and 18 deletions

View File

@ -13,6 +13,7 @@ set(atv_HEADERS
atvdemodgui.h atvdemodgui.h
atvdemodplugin.h atvdemodplugin.h
atvscreen.h atvscreen.h
atvscreeninterface.h
glshaderarray.h glshaderarray.h
) )

View File

@ -101,7 +101,7 @@ ATVDemod::~ATVDemod()
delete m_channelizer; delete m_channelizer;
} }
void ATVDemod::setATVScreen(ATVScreen *objScreen) void ATVDemod::setATVScreen(ATVScreenInterface *objScreen)
{ {
m_registeredATVScreen = objScreen; m_registeredATVScreen = objScreen;
} }

View File

@ -36,7 +36,7 @@
#include "dsp/phasediscri.h" #include "dsp/phasediscri.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
#include "util/message.h" #include "util/message.h"
#include "atvscreen.h" #include "atvscreeninterface.h"
class DeviceSourceAPI; class DeviceSourceAPI;
class ThreadedBasebandSampleSink; class ThreadedBasebandSampleSink;
@ -221,7 +221,7 @@ public:
virtual void stop(); virtual void stop();
virtual bool handleMessage(const Message& cmd); virtual bool handleMessage(const Message& cmd);
void setATVScreen(ATVScreen *objScreen); void setATVScreen(ATVScreenInterface *objScreen);
int getSampleRate(); int getSampleRate();
int getEffectiveSampleRate(); int getEffectiveSampleRate();
double getMagSq() const { return m_objMagSqAverage.average(); } //!< Beware this is scaled to 2^30 double getMagSq() const { return m_objMagSqAverage.average(); } //!< Beware this is scaled to 2^30
@ -396,7 +396,7 @@ private:
SampleVector m_scopeSampleBuffer; SampleVector m_scopeSampleBuffer;
//*************** ATV PARAMETERS *************** //*************** ATV PARAMETERS ***************
ATVScreen * m_registeredATVScreen; ATVScreenInterface * m_registeredATVScreen;
//int m_intNumberSamplePerLine; //int m_intNumberSamplePerLine;
int m_intNumberSamplePerTop; int m_intNumberSamplePerTop;

View File

@ -28,7 +28,7 @@
#include <QDebug> #include <QDebug>
ATVScreen::ATVScreen(QWidget* parent) : ATVScreen::ATVScreen(QWidget* parent) :
QGLWidget(parent), m_objMutex(QMutex::NonRecursive) QGLWidget(parent), ATVScreenInterface(), m_objMutex(QMutex::NonRecursive)
{ {
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
@ -37,7 +37,7 @@ ATVScreen::ATVScreen(QWidget* parent) :
m_chrLastData = NULL; m_chrLastData = NULL;
m_blnConfigChanged = false; m_blnConfigChanged = false;
m_blnDataChanged = false; m_blnDataChanged = false;
m_blnRenderImmediate = false; //m_blnRenderImmediate = false;
m_blnGLContextInitialized = false; m_blnGLContextInitialized = false;
//Par défaut //Par défaut

View File

@ -33,28 +33,29 @@
#include "util/export.h" #include "util/export.h"
#include "util/bitfieldindex.h" #include "util/bitfieldindex.h"
#include "atvscreeninterface.h"
class QPainter; class QPainter;
class SDRANGEL_API ATVScreen: public QGLWidget class SDRANGEL_API ATVScreen: public QGLWidget, public ATVScreenInterface
{ {
Q_OBJECT Q_OBJECT
public: public:
ATVScreen(QWidget* parent = NULL); ATVScreen(QWidget* parent = NULL);
~ATVScreen(); virtual ~ATVScreen();
void resizeATVScreen(int intCols, int intRows); virtual void resizeATVScreen(int intCols, int intRows);
void renderImage(unsigned char * objData); virtual void renderImage(unsigned char * objData);
QRgb* getRowBuffer(int intRow); QRgb* getRowBuffer(int intRow);
void resetImage(); void resetImage();
bool selectRow(int intLine); virtual bool selectRow(int intLine);
bool setDataColor(int intCol,int intRed, int intGreen, int intBlue); virtual bool setDataColor(int intCol,int intRed, int intGreen, int intBlue);
void setRenderImmediate(bool blnRenderImmediate) { m_blnRenderImmediate = blnRenderImmediate; } //void setRenderImmediate(bool blnRenderImmediate) { m_blnRenderImmediate = blnRenderImmediate; }
void connectTimer(const QTimer& timer); void connectTimer(const QTimer& timer);
@ -76,7 +77,7 @@ private:
QTimer m_objTimer; QTimer m_objTimer;
QMutex m_objMutex; QMutex m_objMutex;
bool m_blnDataChanged; bool m_blnDataChanged;
bool m_blnRenderImmediate; //bool m_blnRenderImmediate;
bool m_blnConfigChanged; bool m_blnConfigChanged;
GLShaderArray m_objGLShaderArray; GLShaderArray m_objGLShaderArray;

View File

@ -0,0 +1,46 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 F4HKW //
// for F4EXB / SDRAngel //
// //
// OpenGL interface modernization. //
// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_CHANNELRX_DEMODATV_ATVSCREENINTERFACE_H_
#define PLUGINS_CHANNELRX_DEMODATV_ATVSCREENINTERFACE_H_
class ATVScreenInterface
{
public:
ATVScreenInterface() :
m_blnRenderImmediate(false)
{}
virtual ~ATVScreenInterface() {}
virtual void resizeATVScreen(int intCols __attribute__((unused)), int intRows __attribute__((unused))) {}
virtual void renderImage(unsigned char * objData __attribute__((unused))) {}
virtual bool selectRow(int intLine __attribute__((unused))) { return false; }
virtual bool setDataColor(int intCol __attribute__((unused)), int intRed __attribute__((unused)), int intGreen __attribute__((unused)), int intBlue __attribute__((unused))) { return false; }
void setRenderImmediate(bool blnRenderImmediate) { m_blnRenderImmediate = blnRenderImmediate; }
protected:
bool m_blnRenderImmediate;
};
#endif /* PLUGINS_CHANNELRX_DEMODATV_ATVSCREENINTERFACE_H_ */

View File

@ -31,14 +31,15 @@ CONFIG(macx):INCLUDEPATH += "../../../../../boost_1_64_0"
SOURCES += atvdemod.cpp\ SOURCES += atvdemod.cpp\
atvdemodgui.cpp\ atvdemodgui.cpp\
atvdemodplugin.cpp\ atvdemodplugin.cpp\
atvscreen.cpp\ atvscreen.cpp\
glshaderarray.cpp glshaderarray.cpp
HEADERS += atvdemod.h\ HEADERS += atvdemod.h\
atvdemodgui.h\ atvdemodgui.h\
atvdemodplugin.h\ atvdemodplugin.h\
atvscreen.h\ atvscreen.h\
glshaderarray.h atvscreeninterface.h\
glshaderarray.h
FORMS += atvdemodgui.ui FORMS += atvdemodgui.ui