1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 21:31:47 -05:00
sdrangel/plugins/channelrx/demoddatv/datvdemod.h

119 lines
4.9 KiB
C
Raw Normal View History

2018-02-22 16:52:49 -05:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 F4HKW //
// for F4EXB / SDRAngel //
// using LeanSDR Framework (C) 2016 F4DAV //
// //
// 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 //
2019-04-11 00:39:30 -04:00
// (at your option) any later version. //
2018-02-22 16:52:49 -05:00
// //
// 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_DATVDEMOD_H
#define INCLUDE_DATVDEMOD_H
2019-05-08 16:11:53 -04:00
class DeviceAPI;
2018-02-22 16:52:49 -05:00
2019-05-09 11:27:12 -04:00
#include "channel/channelapi.h"
2018-03-10 19:00:27 -05:00
#include "dsp/basebandsamplesink.h"
#include "dsp/devicesamplesource.h"
#include "dsp/dspcommands.h"
2018-02-22 16:52:49 -05:00
#include "util/message.h"
2018-03-10 19:00:27 -05:00
2019-12-03 12:49:52 -05:00
#include "datvdemodbaseband.h"
2018-02-22 16:52:49 -05:00
2019-05-09 11:27:12 -04:00
class DATVDemod : public BasebandSampleSink, public ChannelAPI
2018-02-22 16:52:49 -05:00
{
2018-02-25 19:04:45 -05:00
Q_OBJECT
2018-02-22 16:52:49 -05:00
public:
2019-05-08 16:11:53 -04:00
DATVDemod(DeviceAPI *);
virtual ~DATVDemod();
2018-02-22 16:52:49 -05:00
2018-02-25 19:04:45 -05:00
virtual void destroy() { delete this; }
virtual void getIdentifier(QString& id) { id = m_channelId; }
virtual const QString& getURI() const { return m_channelIdURI; }
2018-02-25 19:04:45 -05:00
virtual void getTitle(QString& title) { title = objectName(); }
virtual qint64 getCenterFrequency() const { return m_settings.m_centerFrequency; }
2018-02-22 16:52:49 -05:00
2018-02-25 19:04:45 -05:00
virtual QByteArray serialize() const { return QByteArray(); }
virtual bool deserialize(const QByteArray& data) { (void) data; return false; }
2018-02-22 16:52:49 -05:00
2018-02-25 19:04:45 -05:00
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start();
virtual void stop();
virtual bool handleMessage(const Message& cmd);
2018-02-22 16:52:49 -05:00
2019-05-09 11:27:12 -04:00
virtual int getNbSinkStreams() const { return 1; }
virtual int getNbSourceStreams() const { return 0; }
uint32_t getNumberOfDeviceStreams() const;
2019-05-09 11:27:12 -04:00
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
{
(void) streamIndex;
(void) sinkElseSource;
return m_settings.m_centerFrequency;
}
void SetTVScreen(TVScreen *objScreen) { m_basebandSink->setTVScreen(objScreen); }
2019-12-03 12:49:52 -05:00
DATVideostream *SetVideoRender(DATVideoRender *objScreen) { return m_basebandSink->SetVideoRender(objScreen); }
bool audioActive() { return m_basebandSink->audioActive(); }
bool audioDecodeOK() { return m_basebandSink->audioDecodeOK(); }
bool videoActive() { return m_basebandSink->videoActive(); }
bool videoDecodeOK() { return m_basebandSink->videoDecodeOK(); }
2018-02-22 16:52:49 -05:00
bool PlayVideo(bool blnStartStop) { return m_basebandSink->PlayVideo(blnStartStop); }
2018-02-25 19:04:45 -05:00
2019-12-03 12:49:52 -05:00
double getMagSq() const { return m_basebandSink->getMagSq(); } //!< Beware this is scaled to 2^30
int getModcodModulation() const { return m_basebandSink->getModcodModulation(); }
int getModcodCodeRate() const { return m_basebandSink->getModcodCodeRate(); }
bool isCstlnSetByModcod() const { return m_basebandSink->isCstlnSetByModcod(); }
2018-02-22 16:52:49 -05:00
static const QString m_channelIdURI;
static const QString m_channelId;
class MsgConfigureDATVDemod : public Message {
2018-02-25 19:04:45 -05:00
MESSAGE_CLASS_DECLARATION
2018-02-24 18:07:08 -05:00
public:
const DATVDemodSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
2018-02-25 19:04:45 -05:00
static MsgConfigureDATVDemod* create(const DATVDemodSettings& settings, bool force)
{
return new MsgConfigureDATVDemod(settings, force);
}
2018-02-25 19:04:45 -05:00
private:
DATVDemodSettings m_settings;
bool m_force;
MsgConfigureDATVDemod(const DATVDemodSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
{ }
2018-02-22 16:52:49 -05:00
};
private:
2019-05-08 16:11:53 -04:00
DeviceAPI* m_deviceAPI;
2019-12-03 12:49:52 -05:00
QThread *m_thread;
DATVDemodBaseband* m_basebandSink;
DATVDemodSettings m_settings;
2019-12-03 12:49:52 -05:00
int m_basebandSampleRate; //!< stored from device message used when starting baseband sink
2018-02-22 16:52:49 -05:00
void applySettings(const DATVDemodSettings& settings, bool force = false);
2018-02-22 16:52:49 -05:00
};
#endif // INCLUDE_DATVDEMOD_H