mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-14 15:33:34 -04:00
SigMF recoding: first implementation of recording with RTLSDR
This commit is contained in:
@@ -583,11 +583,15 @@ void RTLSDRGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
|
||||
void RTLSDRGui::openFileRecordDialog(const QPoint& p)
|
||||
{
|
||||
if (ui->record->isChecked()) { // do not fire up dialog if recording is on-going
|
||||
return;
|
||||
}
|
||||
|
||||
QFileDialog fileDialog(
|
||||
this,
|
||||
tr("Save I/Q record file"),
|
||||
m_settings.m_fileRecordName,
|
||||
tr("SDR I/Q Files (*.sdriq)")
|
||||
tr("SDR I/Q Files (*.sdriq);;SigMF Files (*.sigmf-meta);;All files (*.*)")
|
||||
);
|
||||
|
||||
fileDialog.setOptions(QFileDialog::DontUseNativeDialog);
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/filerecord.h"
|
||||
#ifdef HAS_LIBSIGMF
|
||||
#include "dsp/sigmffilerecord.h"
|
||||
#endif
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgConfigureRTLSDR, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgFileRecord, Message)
|
||||
@@ -322,31 +325,57 @@ bool RTLSDRInput::handleMessage(const Message& message)
|
||||
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||
qDebug() << "RTLSDRInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||
|
||||
if (conf.getStartStop())
|
||||
QString fileBase;
|
||||
FileRecordInterface::RecordType recordType = FileRecordInterface::guessTypeFromFileName(m_settings.m_fileRecordName, fileBase);
|
||||
|
||||
#ifdef HAS_LIBSIGMF
|
||||
if (recordType == FileRecordInterface::RecordTypeSigMF)
|
||||
{
|
||||
if (m_fileSink)
|
||||
if (conf.getStartStop())
|
||||
{
|
||||
if (!m_fileSink) {
|
||||
m_fileSink = new SigMFFileRecord(fileBase, m_deviceAPI->getHardwareId());
|
||||
}
|
||||
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
m_fileSink->stopRecording();
|
||||
}
|
||||
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink = new FileRecord(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink = new FileRecord(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileSink->stopRecording();
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
m_fileSink = nullptr;
|
||||
}
|
||||
#endif
|
||||
if (conf.getStartStop())
|
||||
{
|
||||
if (m_fileSink)
|
||||
{
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
}
|
||||
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink = new FileRecord(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink = new FileRecord(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileSink->stopRecording();
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
m_fileSink = nullptr;
|
||||
}
|
||||
#ifdef HAS_LIBSIGMF
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else if (MsgStartStop::match(message))
|
||||
@@ -563,6 +592,30 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_fileRecordName != settings.m_fileRecordName) || force)
|
||||
{
|
||||
reverseAPIKeys.append("fileRecordName");
|
||||
QString fileBase;
|
||||
FileRecordInterface::RecordType recordType = FileRecordInterface::guessTypeFromFileName(settings.m_fileRecordName, fileBase);
|
||||
#ifdef HAS_LIBSIGMF
|
||||
if (recordType == FileRecordInterface::RecordTypeSigMF)
|
||||
{
|
||||
if (m_fileSink) {
|
||||
m_fileSink->setFileName(fileBase);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fileSink)
|
||||
{
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
m_fileSink = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
#include <QByteArray>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include <dsp/devicesamplesource.h>
|
||||
#include "rtlsdrsettings.h"
|
||||
#include <rtl-sdr.h>
|
||||
|
||||
#include "dsp/devicesamplesource.h"
|
||||
#include "dsp/filerecordinterface.h"
|
||||
#include "rtlsdrsettings.h"
|
||||
|
||||
class DeviceAPI;
|
||||
class RTLSDRThread;
|
||||
class FileRecord;
|
||||
@@ -168,7 +170,7 @@ public:
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
FileRecordInterface *m_fileSink; //!< File sink to record device I/Q output
|
||||
QMutex m_mutex;
|
||||
RTLSDRSettings m_settings;
|
||||
rtlsdr_dev_t* m_dev;
|
||||
|
||||
Reference in New Issue
Block a user