mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 21:20:31 -05:00 
			
		
		
		
	Unify TV screen (4)
This commit is contained in:
		
							parent
							
								
									707ce197cd
								
							
						
					
					
						commit
						6109be8eeb
					
				@ -5,7 +5,6 @@ set(atv_SOURCES
 | 
			
		||||
	atvdemodsettings.cpp
 | 
			
		||||
	atvdemodgui.cpp
 | 
			
		||||
	atvdemodplugin.cpp
 | 
			
		||||
	atvscreen.cpp
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set(atv_HEADERS
 | 
			
		||||
@ -13,8 +12,6 @@ set(atv_HEADERS
 | 
			
		||||
    atvdemodsettings.h
 | 
			
		||||
	atvdemodgui.h
 | 
			
		||||
	atvdemodplugin.h
 | 
			
		||||
	atvscreen.h
 | 
			
		||||
	atvscreeninterface.h
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set(atv_FORMS
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ ATVDemod::ATVDemod(DeviceSourceAPI *deviceAPI) :
 | 
			
		||||
        ChannelSinkAPI(m_channelIdURI),
 | 
			
		||||
        m_deviceAPI(deviceAPI),
 | 
			
		||||
        m_scopeSink(0),
 | 
			
		||||
        m_registeredATVScreen(0),
 | 
			
		||||
        m_registeredTVScreen(0),
 | 
			
		||||
        m_intNumberSamplePerTop(0),
 | 
			
		||||
        m_intImageIndex(0),
 | 
			
		||||
        m_intSynchroPoints(0),
 | 
			
		||||
@ -103,9 +103,9 @@ ATVDemod::~ATVDemod()
 | 
			
		||||
    delete m_channelizer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemod::setATVScreen(ATVScreenInterface *objScreen)
 | 
			
		||||
void ATVDemod::setTVScreen(TVScreen *objScreen)
 | 
			
		||||
{
 | 
			
		||||
    m_registeredATVScreen = objScreen;
 | 
			
		||||
    m_registeredTVScreen = objScreen;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemod::configure(
 | 
			
		||||
@ -607,10 +607,10 @@ void ATVDemod::applySettings()
 | 
			
		||||
        m_configPrivate.m_intNumberSamplePerLine = (int) (m_config.m_fltLineDuration * m_config.m_intSampleRate);
 | 
			
		||||
        m_intNumberSamplePerTop = (int) (m_config.m_fltTopDuration * m_config.m_intSampleRate);
 | 
			
		||||
 | 
			
		||||
        if (m_registeredATVScreen)
 | 
			
		||||
        if (m_registeredTVScreen)
 | 
			
		||||
        {
 | 
			
		||||
            m_registeredATVScreen->setRenderImmediate(!(m_config.m_fltFramePerS > 25.0f));
 | 
			
		||||
            m_registeredATVScreen->resizeATVScreen(
 | 
			
		||||
            //m_registeredTVScreen->setRenderImmediate(!(m_config.m_fltFramePerS > 25.0f));
 | 
			
		||||
            m_registeredTVScreen->resizeTVScreen(
 | 
			
		||||
                    m_configPrivate.m_intNumberSamplePerLine - m_intNumberSamplePerLineSignals,
 | 
			
		||||
                    m_intNumberOfLines - m_intNumberOfBlackLines);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@
 | 
			
		||||
#include "dsp/phasediscri.h"
 | 
			
		||||
#include "audio/audiofifo.h"
 | 
			
		||||
#include "util/message.h"
 | 
			
		||||
#include "atvscreeninterface.h"
 | 
			
		||||
#include "gui/tvscreen.h"
 | 
			
		||||
 | 
			
		||||
class DeviceSourceAPI;
 | 
			
		||||
class ThreadedBasebandSampleSink;
 | 
			
		||||
@ -231,7 +231,7 @@ public:
 | 
			
		||||
    virtual QByteArray serialize() const { return QByteArray(); }
 | 
			
		||||
    virtual bool deserialize(const QByteArray& data __attribute__((unused))) { return false; }
 | 
			
		||||
 | 
			
		||||
    void setATVScreen(ATVScreenInterface *objScreen);
 | 
			
		||||
    void setTVScreen(TVScreen *objScreen);
 | 
			
		||||
    int getSampleRate();
 | 
			
		||||
    int getEffectiveSampleRate();
 | 
			
		||||
    double getMagSq() const { return m_objMagSqAverage; } //!< Beware this is scaled to 2^30
 | 
			
		||||
@ -413,7 +413,7 @@ private:
 | 
			
		||||
    SampleVector m_scopeSampleBuffer;
 | 
			
		||||
 | 
			
		||||
    //*************** ATV PARAMETERS  ***************
 | 
			
		||||
    ATVScreenInterface * m_registeredATVScreen;
 | 
			
		||||
    TVScreen *m_registeredTVScreen;
 | 
			
		||||
 | 
			
		||||
    //int m_intNumberSamplePerLine;
 | 
			
		||||
    int m_intNumberSamplePerTop;
 | 
			
		||||
@ -497,7 +497,7 @@ private:
 | 
			
		||||
 | 
			
		||||
    inline void processHSkip(float& fltVal, int& intVal)
 | 
			
		||||
    {
 | 
			
		||||
        m_registeredATVScreen->setDataColor(m_intColIndex - m_intNumberSaplesPerHSync + m_intNumberSamplePerTop, intVal, intVal, intVal);
 | 
			
		||||
        m_registeredTVScreen->setDataColor(m_intColIndex - m_intNumberSaplesPerHSync + m_intNumberSamplePerTop, intVal, intVal, intVal);
 | 
			
		||||
 | 
			
		||||
        // Horizontal Synchro detection
 | 
			
		||||
 | 
			
		||||
@ -522,7 +522,7 @@ private:
 | 
			
		||||
            {
 | 
			
		||||
                //qDebug("VSync: %d %d %d", m_intColIndex, m_intSampleIndex, m_intLineIndex);
 | 
			
		||||
                m_intAvgColIndex = m_intColIndex;
 | 
			
		||||
                m_registeredATVScreen->renderImage(0);
 | 
			
		||||
                m_registeredTVScreen->renderImage(0);
 | 
			
		||||
 | 
			
		||||
                m_intImageIndex++;
 | 
			
		||||
                m_intLineIndex = 0;
 | 
			
		||||
@ -570,7 +570,7 @@ private:
 | 
			
		||||
                m_fltEffMax = -2000000.0f;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            m_registeredATVScreen->selectRow(m_intRowIndex);
 | 
			
		||||
            m_registeredTVScreen->selectRow(m_intRowIndex);
 | 
			
		||||
            m_intLineIndex++;
 | 
			
		||||
            m_intRowIndex++;
 | 
			
		||||
        }
 | 
			
		||||
@ -658,7 +658,7 @@ private:
 | 
			
		||||
 | 
			
		||||
            if (m_intRowIndex < m_intNumberOfLines)
 | 
			
		||||
            {
 | 
			
		||||
                m_registeredATVScreen->selectRow(m_intRowIndex - m_intNumberOfSyncLines);
 | 
			
		||||
                m_registeredTVScreen->selectRow(m_intRowIndex - m_intNumberOfSyncLines);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            m_intLineIndex++;
 | 
			
		||||
@ -667,7 +667,7 @@ private:
 | 
			
		||||
        // Filling pixels
 | 
			
		||||
 | 
			
		||||
        // +4 is to compensate shift due to hsync amortizing factor of 1/4
 | 
			
		||||
        m_registeredATVScreen->setDataColor(m_intColIndex - m_intNumberSaplesPerHSync + m_intNumberSamplePerTop + 4, intVal, intVal, intVal);
 | 
			
		||||
        m_registeredTVScreen->setDataColor(m_intColIndex - m_intNumberSaplesPerHSync + m_intNumberSamplePerTop + 4, intVal, intVal, intVal);
 | 
			
		||||
        m_intColIndex++;
 | 
			
		||||
 | 
			
		||||
        // Vertical sync and image rendering
 | 
			
		||||
@ -686,7 +686,7 @@ private:
 | 
			
		||||
 | 
			
		||||
                        if ((m_intLineIndex % 2 == 0) || !m_interleaved) // even => odd image
 | 
			
		||||
                        {
 | 
			
		||||
                            m_registeredATVScreen->renderImage(0);
 | 
			
		||||
                            m_registeredTVScreen->renderImage(0);
 | 
			
		||||
                            m_intRowIndex = 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
@ -694,7 +694,7 @@ private:
 | 
			
		||||
                            m_intRowIndex = 0;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        m_registeredATVScreen->selectRow(m_intRowIndex - m_intNumberOfSyncLines);
 | 
			
		||||
                        m_registeredTVScreen->selectRow(m_intRowIndex - m_intNumberOfSyncLines);
 | 
			
		||||
                        m_intLineIndex = 0;
 | 
			
		||||
                        m_intImageIndex++;
 | 
			
		||||
                    }
 | 
			
		||||
@ -711,7 +711,7 @@ private:
 | 
			
		||||
            {
 | 
			
		||||
                if (m_intImageIndex % 2 == 1) // odd image
 | 
			
		||||
                {
 | 
			
		||||
                    m_registeredATVScreen->renderImage(0);
 | 
			
		||||
                    m_registeredTVScreen->renderImage(0);
 | 
			
		||||
 | 
			
		||||
                    if (m_rfRunning.m_enmModulation == ATV_AM)
 | 
			
		||||
                    {
 | 
			
		||||
@ -736,7 +736,7 @@ private:
 | 
			
		||||
                    m_intRowIndex = 0;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                m_registeredATVScreen->selectRow(m_intRowIndex - m_intNumberOfSyncLines);
 | 
			
		||||
                m_registeredTVScreen->selectRow(m_intRowIndex - m_intNumberOfSyncLines);
 | 
			
		||||
                m_intLineIndex = 0;
 | 
			
		||||
                m_intImageIndex++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -285,7 +285,7 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Base
 | 
			
		||||
    m_atvDemod = (ATVDemod*) rxChannel; //new ATVDemod(m_deviceUISet->m_deviceSourceAPI);
 | 
			
		||||
    m_atvDemod->setMessageQueueToGUI(getInputMessageQueue());
 | 
			
		||||
    m_atvDemod->setScopeSink(m_scopeVis);
 | 
			
		||||
    m_atvDemod->setATVScreen(ui->screenTV);
 | 
			
		||||
    m_atvDemod->setTVScreen(ui->screenTV);
 | 
			
		||||
 | 
			
		||||
    ui->glScope->connectTimer(MainWindow::getInstance()->getMasterTimer());
 | 
			
		||||
    connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
 | 
			
		||||
 | 
			
		||||
@ -1011,7 +1011,7 @@
 | 
			
		||||
    <enum>QTabWidget::West</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="currentIndex">
 | 
			
		||||
    <number>1</number>
 | 
			
		||||
    <number>0</number>
 | 
			
		||||
   </property>
 | 
			
		||||
   <widget class="QWidget" name="tabScreen">
 | 
			
		||||
    <property name="autoFillBackground">
 | 
			
		||||
@ -1037,7 +1037,7 @@
 | 
			
		||||
       <enum>QLayout::SetMinimumSize</enum>
 | 
			
		||||
      </property>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="ATVScreen" name="screenTV" native="true">
 | 
			
		||||
       <widget class="TVScreen" name="screenTV" native="true">
 | 
			
		||||
        <property name="sizePolicy">
 | 
			
		||||
         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
 | 
			
		||||
          <horstretch>0</horstretch>
 | 
			
		||||
@ -1116,12 +1116,6 @@
 | 
			
		||||
   <extends>QToolButton</extends>
 | 
			
		||||
   <header>gui/buttonswitch.h</header>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>ATVScreen</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
   <header>atvscreen.h</header>
 | 
			
		||||
   <container>1</container>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>GLScopeNG</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
@ -1140,6 +1134,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>
 | 
			
		||||
  <include location="../../../sdrgui/resources/res.qrc"/>
 | 
			
		||||
 | 
			
		||||
@ -1,209 +0,0 @@
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// Copyright (C) 2017 F4HKW                                                      //
 | 
			
		||||
// for F4EXB / SDRAngel                                                          //
 | 
			
		||||
//                                                                               //
 | 
			
		||||
// OpenGL interface modernization.                                               //
 | 
			
		||||
//                                                                               //
 | 
			
		||||
// 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/>.          //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#include <QPainter>
 | 
			
		||||
#include <QMouseEvent>
 | 
			
		||||
#include <QOpenGLContext>
 | 
			
		||||
#include <QOpenGLFunctions>
 | 
			
		||||
#include <QSurface>
 | 
			
		||||
#include "atvscreen.h"
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
ATVScreen::ATVScreen(QWidget* parent) :
 | 
			
		||||
        QGLWidget(parent), ATVScreenInterface(), m_objMutex(QMutex::NonRecursive), m_objGLShaderArray(false)
 | 
			
		||||
{
 | 
			
		||||
    setAttribute(Qt::WA_OpaquePaintEvent);
 | 
			
		||||
    connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
 | 
			
		||||
    m_objTimer.start(40); // capped at 25 FPS
 | 
			
		||||
 | 
			
		||||
    m_chrLastData = NULL;
 | 
			
		||||
    m_blnConfigChanged = false;
 | 
			
		||||
    m_blnDataChanged = false;
 | 
			
		||||
    m_blnGLContextInitialized = false;
 | 
			
		||||
 | 
			
		||||
    //Par défaut
 | 
			
		||||
    m_intAskedCols = ATV_COLS;
 | 
			
		||||
    m_intAskedRows = ATV_ROWS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ATVScreen::~ATVScreen()
 | 
			
		||||
{
 | 
			
		||||
    cleanup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QRgb* ATVScreen::getRowBuffer(int intRow)
 | 
			
		||||
{
 | 
			
		||||
    if (m_blnGLContextInitialized == false)
 | 
			
		||||
    {
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return m_objGLShaderArray.GetRowBuffer(intRow);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::renderImage(unsigned char * objData)
 | 
			
		||||
{
 | 
			
		||||
    m_chrLastData = objData;
 | 
			
		||||
    m_blnDataChanged = true;
 | 
			
		||||
    if (m_blnRenderImmediate) update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::resetImage()
 | 
			
		||||
{
 | 
			
		||||
    m_objGLShaderArray.ResetPixels();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::resizeATVScreen(int intCols, int intRows)
 | 
			
		||||
{
 | 
			
		||||
    m_intAskedCols = intCols;
 | 
			
		||||
    m_intAskedRows = intRows;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::initializeGL()
 | 
			
		||||
{
 | 
			
		||||
    m_objMutex.lock();
 | 
			
		||||
 | 
			
		||||
    QOpenGLContext *objGlCurrentContext = QOpenGLContext::currentContext();
 | 
			
		||||
 | 
			
		||||
    if (objGlCurrentContext)
 | 
			
		||||
    {
 | 
			
		||||
        if (QOpenGLContext::currentContext()->isValid())
 | 
			
		||||
        {
 | 
			
		||||
            qDebug() << "ATVScreen::initializeGL: context:"
 | 
			
		||||
                    << " major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
 | 
			
		||||
                    << " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
 | 
			
		||||
                    << " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no");
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            qDebug() << "ATVScreen::initializeGL: current context is invalid";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        qCritical() << "ATVScreen::initializeGL: no current context";
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QSurface *objSurface = objGlCurrentContext->surface();
 | 
			
		||||
 | 
			
		||||
    if (objSurface == NULL)
 | 
			
		||||
    {
 | 
			
		||||
        qCritical() << "ATVScreen::initializeGL: no surface attached";
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        if (objSurface->surfaceType() != QSurface::OpenGLSurface)
 | 
			
		||||
        {
 | 
			
		||||
            qCritical() << "ATVScreen::initializeGL: surface is not an OpenGLSurface: "
 | 
			
		||||
                    << objSurface->surfaceType()
 | 
			
		||||
                    << " cannot use an OpenGL context";
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            qDebug() << "ATVScreen::initializeGL: OpenGL surface:"
 | 
			
		||||
                    << " class: " << (objSurface->surfaceClass() == QSurface::Window ? "Window" : "Offscreen");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this,
 | 
			
		||||
            &ATVScreen::cleanup); // TODO: when migrating to QOpenGLWidget
 | 
			
		||||
 | 
			
		||||
    m_blnGLContextInitialized = true;
 | 
			
		||||
 | 
			
		||||
    m_objMutex.unlock();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::resizeGL(int intWidth, int intHeight)
 | 
			
		||||
{
 | 
			
		||||
    QOpenGLFunctions *ptrF = QOpenGLContext::currentContext()->functions();
 | 
			
		||||
    ptrF->glViewport(0, 0, intWidth, intHeight);
 | 
			
		||||
    m_blnConfigChanged = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::paintGL()
 | 
			
		||||
{
 | 
			
		||||
    if (!m_objMutex.tryLock(2))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    m_blnDataChanged = false;
 | 
			
		||||
 | 
			
		||||
    if ((m_intAskedCols != 0) && (m_intAskedRows != 0))
 | 
			
		||||
    {
 | 
			
		||||
        m_objGLShaderArray.InitializeGL(m_intAskedCols, m_intAskedRows);
 | 
			
		||||
        m_intAskedCols = 0;
 | 
			
		||||
        m_intAskedRows = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m_objGLShaderArray.RenderPixels(m_chrLastData);
 | 
			
		||||
 | 
			
		||||
    m_objMutex.unlock();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::mousePressEvent(QMouseEvent* event __attribute__((unused)))
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVScreen::tick()
 | 
			
		||||
{
 | 
			
		||||
    if (m_blnDataChanged) {
 | 
			
		||||
        update();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
    {
 | 
			
		||||
        m_objGLShaderArray.Cleanup();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ATVScreen::selectRow(int intLine)
 | 
			
		||||
{
 | 
			
		||||
    if (m_blnGLContextInitialized)
 | 
			
		||||
    {
 | 
			
		||||
        return m_objGLShaderArray.SelectRow(intLine);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ATVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue)
 | 
			
		||||
{
 | 
			
		||||
    if (m_blnGLContextInitialized)
 | 
			
		||||
    {
 | 
			
		||||
        return m_objGLShaderArray.SetDataColor(intCol,
 | 
			
		||||
                qRgb(intRed, intGreen, intBlue));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
@ -1,96 +0,0 @@
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// 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 INCLUDE_ATVSCREEN_H
 | 
			
		||||
#define INCLUDE_ATVSCREEN_H
 | 
			
		||||
 | 
			
		||||
#include <QGLWidget>
 | 
			
		||||
#include <QPen>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QMutex>
 | 
			
		||||
#include <QFont>
 | 
			
		||||
#include <QMatrix4x4>
 | 
			
		||||
#include "dsp/dsptypes.h"
 | 
			
		||||
#include "gui/glshadertextured.h"
 | 
			
		||||
#include "gui/glshadertvarray.h"
 | 
			
		||||
#include "util/export.h"
 | 
			
		||||
#include "util/bitfieldindex.h"
 | 
			
		||||
 | 
			
		||||
#include "atvscreeninterface.h"
 | 
			
		||||
 | 
			
		||||
class QPainter;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ATVScreen: public QGLWidget, public ATVScreenInterface
 | 
			
		||||
{
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
	ATVScreen(QWidget* parent = NULL);
 | 
			
		||||
	virtual ~ATVScreen();
 | 
			
		||||
 | 
			
		||||
	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);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    bool m_blnGLContextInitialized;
 | 
			
		||||
    int m_intAskedCols;
 | 
			
		||||
    int m_intAskedRows;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// state
 | 
			
		||||
    QTimer m_objTimer;
 | 
			
		||||
    QMutex m_objMutex;
 | 
			
		||||
    bool m_blnDataChanged;
 | 
			
		||||
    bool m_blnConfigChanged;
 | 
			
		||||
 | 
			
		||||
    GLShaderTVArray m_objGLShaderArray;
 | 
			
		||||
 | 
			
		||||
    void initializeGL();
 | 
			
		||||
	void resizeGL(int width, int height);
 | 
			
		||||
	void paintGL();
 | 
			
		||||
 | 
			
		||||
	void mousePressEvent(QMouseEvent*);
 | 
			
		||||
 | 
			
		||||
	unsigned char *m_chrLastData;
 | 
			
		||||
 | 
			
		||||
protected slots:
 | 
			
		||||
	void cleanup();
 | 
			
		||||
	void tick();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // INCLUDE_ATVSCREEN_H
 | 
			
		||||
@ -1,46 +0,0 @@
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// 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_ */
 | 
			
		||||
@ -31,14 +31,11 @@ CONFIG(macx):INCLUDEPATH += "../../../../../boost_1_64_0"
 | 
			
		||||
 | 
			
		||||
SOURCES += atvdemod.cpp\
 | 
			
		||||
	atvdemodgui.cpp\
 | 
			
		||||
	atvdemodplugin.cpp\
 | 
			
		||||
    atvscreen.cpp
 | 
			
		||||
	atvdemodplugin.cpp
 | 
			
		||||
 | 
			
		||||
HEADERS += atvdemod.h\
 | 
			
		||||
	atvdemodgui.h\
 | 
			
		||||
	atvdemodplugin.h\
 | 
			
		||||
    atvscreen.h\
 | 
			
		||||
    atvscreeninterface.h
 | 
			
		||||
	atvdemodplugin.h
 | 
			
		||||
 | 
			
		||||
FORMS += atvdemodgui.ui
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user