mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
Use latest DAB lib API. Don't write MOT data to files, so we don't need to create sub-dirs.
This commit is contained in:
parent
88f83b2732
commit
c45e3651f3
@ -254,20 +254,23 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
QByteArray getData() const { return m_data; }
|
||||||
const QString getFilename() const { return m_filename; }
|
const QString getFilename() const { return m_filename; }
|
||||||
int getContentSubType() const { return m_contentSubType; }
|
int getContentSubType() const { return m_contentSubType; }
|
||||||
|
|
||||||
static MsgDABMOTData* create(const QString& filename, int contentSubType)
|
static MsgDABMOTData* create(QByteArray data, const QString& filename, int contentSubType)
|
||||||
{
|
{
|
||||||
return new MsgDABMOTData(filename, contentSubType);
|
return new MsgDABMOTData(data, filename, contentSubType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QByteArray m_data;
|
||||||
QString m_filename;
|
QString m_filename;
|
||||||
int m_contentSubType;
|
int m_contentSubType;
|
||||||
|
|
||||||
MsgDABMOTData(const QString& filename, int contentSubType) :
|
MsgDABMOTData(QByteArray data, const QString& filename, int contentSubType) :
|
||||||
Message(),
|
Message(),
|
||||||
|
m_data(data),
|
||||||
m_filename(filename),
|
m_filename(filename),
|
||||||
m_contentSubType(contentSubType)
|
m_contentSubType(contentSubType)
|
||||||
{ }
|
{ }
|
||||||
|
@ -253,7 +253,6 @@ bool DABDemodGUI::handleMessage(const Message& message)
|
|||||||
else if (DABDemod::MsgDABSampleRate::match(message))
|
else if (DABDemod::MsgDABSampleRate::match(message))
|
||||||
{
|
{
|
||||||
DABDemod::MsgDABSampleRate& report = (DABDemod::MsgDABSampleRate&) message;
|
DABDemod::MsgDABSampleRate& report = (DABDemod::MsgDABSampleRate&) message;
|
||||||
qDebug() << "Ssample rate: " << report.getSampleRate();
|
|
||||||
ui->sampleRate->setText(QString("%1k").arg(report.getSampleRate()/1000.0, 0, 'f', 0));
|
ui->sampleRate->setText(QString("%1k").arg(report.getSampleRate()/1000.0, 0, 'f', 0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -266,11 +265,16 @@ bool DABDemodGUI::handleMessage(const Message& message)
|
|||||||
else if (DABDemod::MsgDABMOTData::match(message))
|
else if (DABDemod::MsgDABMOTData::match(message))
|
||||||
{
|
{
|
||||||
DABDemod::MsgDABMOTData& report = (DABDemod::MsgDABMOTData&) message;
|
DABDemod::MsgDABMOTData& report = (DABDemod::MsgDABMOTData&) message;
|
||||||
QPixmap pixmap(report.getFilename());
|
QString filename = report.getFilename();
|
||||||
ui->motImage->resize(ui->motImage->width(), pixmap.height());
|
if (filename.endsWith(".png") || filename.endsWith(".PNG") || filename.endsWith(".jpg") || filename.endsWith(".JPG"))
|
||||||
ui->motImage->setVisible(true);
|
{
|
||||||
ui->motImage->setPixmap(pixmap, pixmap.size());
|
QPixmap pixmap;
|
||||||
arrangeRollups();
|
pixmap.loadFromData(report.getData());
|
||||||
|
ui->motImage->resize(ui->motImage->width(), pixmap.height());
|
||||||
|
ui->motImage->setVisible(true);
|
||||||
|
ui->motImage->setPixmap(pixmap, pixmap.size());
|
||||||
|
arrangeRollups();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +43,16 @@ void systemDataHandler(bool sync, int16_t snr, int32_t freqOffset, void *ctx)
|
|||||||
sink->systemData(sync, snr, freqOffset);
|
sink->systemData(sync, snr, freqOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ensembleNameHandler(std::string name, int32_t id, void *ctx)
|
void ensembleNameHandler(const char *name, int32_t id, void *ctx)
|
||||||
{
|
{
|
||||||
DABDemodSink *sink = (DABDemodSink *)ctx;
|
DABDemodSink *sink = (DABDemodSink *)ctx;
|
||||||
sink->ensembleName(QString::fromStdString(name), id);
|
sink->ensembleName(QString::fromUtf8(name), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void programNameHandler(std::string name, int32_t id, void *ctx)
|
void programNameHandler(const char *name, int32_t id, void *ctx)
|
||||||
{
|
{
|
||||||
DABDemodSink *sink = (DABDemodSink *)ctx;
|
DABDemodSink *sink = (DABDemodSink *)ctx;
|
||||||
sink->programName(QString::fromStdString(name), id);
|
sink->programName(QString::fromUtf8(name), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fibQualityHandler(int16_t percent, void *ctx)
|
void fibQualityHandler(int16_t percent, void *ctx)
|
||||||
@ -67,10 +67,10 @@ void audioHandler(int16_t *buffer, int size, int samplerate, bool stereo, void *
|
|||||||
sink->audio(buffer, size, samplerate, stereo);
|
sink->audio(buffer, size, samplerate, stereo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dataHandler(std::string data, void *ctx)
|
void dataHandler(const char *data, void *ctx)
|
||||||
{
|
{
|
||||||
DABDemodSink *sink = (DABDemodSink *)ctx;
|
DABDemodSink *sink = (DABDemodSink *)ctx;
|
||||||
sink->data(QString::fromStdString(data));
|
sink->data(QString::fromUtf8(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void byteHandler(uint8_t *data, int16_t a, uint8_t b, void *ctx)
|
void byteHandler(uint8_t *data, int16_t a, uint8_t b, void *ctx)
|
||||||
@ -274,10 +274,10 @@ void programQualityHandler(int16_t frames, int16_t rs, int16_t aac, void *ctx)
|
|||||||
sink->programQuality(frames, rs, aac);
|
sink->programQuality(frames, rs, aac);
|
||||||
}
|
}
|
||||||
|
|
||||||
void motDataHandler(std::string filename, int contentsubType, void *ctx)
|
void motDataHandler(uint8_t *data, int len, const char *filename, int contentsubType, void *ctx)
|
||||||
{
|
{
|
||||||
DABDemodSink *sink = (DABDemodSink *)ctx;
|
DABDemodSink *sink = (DABDemodSink *)ctx;
|
||||||
sink->motData(filename.c_str(), contentsubType);
|
sink->motData(data, len, QString::fromUtf8(filename), contentsubType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DABDemodSink::systemData(bool sync, int16_t snr, int32_t freqOffset)
|
void DABDemodSink::systemData(bool sync, int16_t snr, int32_t freqOffset)
|
||||||
@ -342,11 +342,12 @@ void DABDemodSink::data(const QString& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DABDemodSink::motData(const QString& filename, int contentSubType)
|
void DABDemodSink::motData(const uint8_t *data, int len, const QString& filename, int contentSubType)
|
||||||
{
|
{
|
||||||
if (getMessageQueueToChannel())
|
if (getMessageQueueToChannel())
|
||||||
{
|
{
|
||||||
DABDemod::MsgDABMOTData *msg = DABDemod::MsgDABMOTData::create(filename, contentSubType);
|
QByteArray byteArray((const char *)data, len);
|
||||||
|
DABDemod::MsgDABMOTData *msg = DABDemod::MsgDABMOTData::create(byteArray, filename, contentSubType);
|
||||||
getMessageQueueToChannel()->push(msg);
|
getMessageQueueToChannel()->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,20 +483,22 @@ DABDemodSink::DABDemodSink(DABDemod *packetDemod) :
|
|||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||||
|
|
||||||
int mode = 1; // Latest DAB spec only has mode 1
|
m_api.dabMode = 1; // Latest DAB spec only has mode 1
|
||||||
|
m_api.syncsignal_Handler = syncHandler;
|
||||||
|
m_api.systemdata_Handler = systemDataHandler;
|
||||||
|
m_api.ensemblename_Handler = ensembleNameHandler;
|
||||||
|
m_api.programname_Handler = programNameHandler;
|
||||||
|
m_api.fib_quality_Handler = fibQualityHandler;
|
||||||
|
m_api.audioOut_Handler = audioHandler;
|
||||||
|
m_api.dataOut_Handler = dataHandler;
|
||||||
|
m_api.bytesOut_Handler = byteHandler;
|
||||||
|
m_api.programdata_Handler = programDataHandler;
|
||||||
|
m_api.program_quality_Handler = programQualityHandler;
|
||||||
|
m_api.motdata_Handler = motDataHandler;
|
||||||
|
m_api.tii_data_Handler = nullptr;
|
||||||
|
m_api.timeHandler = nullptr;
|
||||||
m_dab = dabInit(&m_device,
|
m_dab = dabInit(&m_device,
|
||||||
mode,
|
&m_api,
|
||||||
syncHandler,
|
|
||||||
systemDataHandler,
|
|
||||||
ensembleNameHandler,
|
|
||||||
programNameHandler,
|
|
||||||
fibQualityHandler,
|
|
||||||
audioHandler,
|
|
||||||
dataHandler,
|
|
||||||
byteHandler,
|
|
||||||
programDataHandler,
|
|
||||||
programQualityHandler,
|
|
||||||
motDataHandler,
|
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
this);
|
this);
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
void programQuality(int16_t frames, int16_t rs, int16_t aac);
|
void programQuality(int16_t frames, int16_t rs, int16_t aac);
|
||||||
void fibQuality(int16_t percent);
|
void fibQuality(int16_t percent);
|
||||||
void data(const QString& data);
|
void data(const QString& data);
|
||||||
void motData(const QString& filename, int contentSubType);
|
void motData(const uint8_t *data, int len, const QString& filename, int contentSubType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct MagSqLevelsStore
|
struct MagSqLevelsStore
|
||||||
@ -114,6 +114,8 @@ private:
|
|||||||
void *m_dab;
|
void *m_dab;
|
||||||
DABDemodDevice m_device;
|
DABDemodDevice m_device;
|
||||||
audiodata m_ad;
|
audiodata m_ad;
|
||||||
|
packetdata m_pd;
|
||||||
|
API_struct m_api;
|
||||||
|
|
||||||
NCO m_nco;
|
NCO m_nco;
|
||||||
Interpolator m_interpolator;
|
Interpolator m_interpolator;
|
||||||
|
Loading…
Reference in New Issue
Block a user