SigMFFileSink: give .sigmf-meta extension to provided file name automatically.

This commit is contained in:
f4exb 2021-02-19 15:54:08 +01:00
parent b865d995a4
commit d9d1bfff7e
2 changed files with 23 additions and 1 deletions

View File

@ -10,6 +10,9 @@ As per SigMF specifications two files are created in fact.
- One with `.sigmf-meta` extension contains meta data and details to find the different captures in the data file blob. It is written in JSON format and is human readable. You can refer to SigMF documentation in the link at top to read about the details.
- Another with `.sigmf-data` contains the IQ data as a blob indexed by structures in the `.sigmf-meta` file. Thus to the SigMF file reader data appears as a sequence of captures having idependent start time and length, center frequency and with SDRangel specific extensions independent sample rates.
If a filename is given without `.sigmf-meta` extension then the `.sigmf-meta` extension is appended automatically.
If a filename is given with an extension different of `.sigmf-meta` then the extension is replaced by `.sigmf-meta` automatically.
It adds a dependency to the [libsigmf library](https://github.com/f4exb/libsigmf) more specifically the `f4exb` fork that supports `multirecordings` and `sdrangel` extensions.
<h2>Interface</h2>

View File

@ -237,10 +237,28 @@ void SigMFFileSinkSink::applySettings(const SigMFFileSinkSettings& settings, boo
<< "m_fileRecordName: " << settings.m_fileRecordName
<< "force: " << force;
QString fileRecordName = settings.m_fileRecordName;
if ((settings.m_fileRecordName != m_settings.m_fileRecordName) || force)
{
QStringList dotBreakout = settings.m_fileRecordName.split(QLatin1Char('.'));
if (dotBreakout.size() > 1) {
QString extension = dotBreakout.last();
if (extension != "sigmf-meta") {
dotBreakout.last() = "sigmf-meta";
}
}
else
{
dotBreakout.append("sigmf-meta");
}
fileRecordName = dotBreakout.join(QLatin1Char('.'));
QString fileBase;
FileRecordInterface::RecordType recordType = FileRecordInterface::guessTypeFromFileName(settings.m_fileRecordName, fileBase);
FileRecordInterface::RecordType recordType = FileRecordInterface::guessTypeFromFileName(fileRecordName, fileBase);
if (recordType == FileRecordInterface::RecordTypeSigMF)
{
@ -266,6 +284,7 @@ void SigMFFileSinkSink::applySettings(const SigMFFileSinkSettings& settings, boo
}
m_settings = settings;
m_settings.m_fileRecordName = fileRecordName;
}
void SigMFFileSinkSink::squelchRecording(bool squelchOpen)