mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-11-27 10:33:18 -05:00
FileRecordInterface: basic implementation
This commit is contained in:
parent
401faefdf5
commit
122ff28c41
@ -330,7 +330,7 @@ bool AirspyInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -340,7 +340,7 @@ bool AirspyHFInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -298,7 +298,7 @@ bool Bladerf1Input::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -726,7 +726,7 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -304,7 +304,7 @@ bool FCDProInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -306,7 +306,7 @@ bool FCDProPlusInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -279,7 +279,7 @@ bool HackRFInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -219,7 +219,7 @@ bool KiwiSDRInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -755,7 +755,7 @@ bool LimeSDRInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -180,7 +180,7 @@ bool LocalInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -214,7 +214,7 @@ bool PerseusInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -216,7 +216,7 @@ bool PlutoSDRInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -177,7 +177,7 @@ bool RemoteInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -327,7 +327,7 @@ bool RTLSDRInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -321,7 +321,7 @@ bool SDRPlayInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -807,7 +807,7 @@ bool SoapySDRInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -198,7 +198,7 @@ bool TestSourceInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
m_fileSink->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
|
||||
@ -4,7 +4,9 @@ if(WIN32)
|
||||
set(OPUS_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/external/windows/libopus/include")
|
||||
set(OPUS_LIBRARIES "${CMAKE_SOURCE_DIR}/external/windows/libopus/lib/x64/libopus.lib")
|
||||
endif()
|
||||
|
||||
find_package(Opus REQUIRED)
|
||||
find_package(LibSigMF)
|
||||
|
||||
if(FFTW3F_FOUND)
|
||||
set(sdrbase_SOURCES
|
||||
@ -99,6 +101,7 @@ set(sdrbase_SOURCES
|
||||
dsp/filterrc.cpp
|
||||
dsp/filtermbe.cpp
|
||||
dsp/filerecord.cpp
|
||||
dsp/filerecordinterface.cpp
|
||||
dsp/freqlockcomplex.cpp
|
||||
dsp/interpolator.cpp
|
||||
dsp/glscopesettings.cpp
|
||||
@ -227,6 +230,7 @@ set(sdrbase_HEADERS
|
||||
dsp/filterrc.h
|
||||
dsp/filtermbe.h
|
||||
dsp/filerecord.h
|
||||
dsp/filerecordinterface.h
|
||||
dsp/freqlockcomplex.h
|
||||
dsp/gfft.h
|
||||
dsp/glscopesettings.h
|
||||
@ -341,6 +345,7 @@ target_link_libraries(sdrbase
|
||||
${sdrbase_FFTW3F_LIB}
|
||||
${sdrbase_SERIALDV_LIB}
|
||||
${sdrbase_LIMERFE_LIB}
|
||||
${sdrbase_LIBSIGMF_LIB}
|
||||
Qt5::Core
|
||||
Qt5::Multimedia
|
||||
Qt5::WebSockets
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "util/simpleserializer.h"
|
||||
@ -64,15 +63,6 @@ void FileRecord::setFileName(const QString& filename)
|
||||
}
|
||||
}
|
||||
|
||||
void FileRecord::genUniqueFileName(uint deviceUID, int istream)
|
||||
{
|
||||
if (istream < 0) {
|
||||
setFileName(QString("rec%1_%2.sdriq").arg(deviceUID).arg(QDateTime::currentDateTimeUtc().toString("yyyy-MM-ddTHH_mm_ss_zzz")));
|
||||
} else {
|
||||
setFileName(QString("rec%1_%2_%3.sdriq").arg(deviceUID).arg(istream).arg(QDateTime::currentDateTimeUtc().toString("yyyy-MM-ddTHH_mm_ss_zzz")));
|
||||
}
|
||||
}
|
||||
|
||||
void FileRecord::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||
{
|
||||
(void) positiveOnly;
|
||||
|
||||
@ -18,17 +18,18 @@
|
||||
#ifndef INCLUDE_FILERECORD_H
|
||||
#define INCLUDE_FILERECORD_H
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "dsp/filerecordinterface.h"
|
||||
#include "export.h"
|
||||
|
||||
class Message;
|
||||
|
||||
class SDRBASE_API FileRecord : public BasebandSampleSink {
|
||||
class SDRBASE_API FileRecord : public BasebandSampleSink, public FileRecordInterface {
|
||||
public:
|
||||
|
||||
#pragma pack(push, 1)
|
||||
@ -49,15 +50,14 @@ public:
|
||||
|
||||
quint64 getByteCount() const { return m_byteCount; }
|
||||
|
||||
void setFileName(const QString& filename);
|
||||
void genUniqueFileName(uint deviceUID, int istream = -1);
|
||||
virtual void setFileName(const QString& filename);
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& message);
|
||||
void startRecording();
|
||||
void stopRecording();
|
||||
virtual void startRecording();
|
||||
virtual void stopRecording();
|
||||
bool isRecording() const { return m_recordOn; }
|
||||
static bool readHeader(std::ifstream& samplefile, Header& header); //!< returns true if CRC checksum is correct else false
|
||||
static void writeHeader(std::ofstream& samplefile, Header& header);
|
||||
|
||||
31
sdrbase/dsp/filerecordinterface.cpp
Normal file
31
sdrbase/dsp/filerecordinterface.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// File recorder in SigMF format single channel for SI plugins //
|
||||
// //
|
||||
// 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 //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// 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 <QDateTime>
|
||||
|
||||
#include "filerecordinterface.h"
|
||||
|
||||
QString FileRecordInterface::genUniqueFileName(unsigned int deviceUID, int istream)
|
||||
{
|
||||
if (istream < 0) {
|
||||
return QString("rec%1_%2.sdriq").arg(deviceUID).arg(QDateTime::currentDateTimeUtc().toString("yyyy-MM-ddTHH_mm_ss_zzz"));
|
||||
} else {
|
||||
return QString("rec%1_%2_%3.sdriq").arg(deviceUID).arg(istream).arg(QDateTime::currentDateTimeUtc().toString("yyyy-MM-ddTHH_mm_ss_zzz"));
|
||||
}
|
||||
}
|
||||
36
sdrbase/dsp/filerecordinterface.h
Normal file
36
sdrbase/dsp/filerecordinterface.h
Normal file
@ -0,0 +1,36 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// File recorder in SigMF format single channel for SI plugins //
|
||||
// //
|
||||
// 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 //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// 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_FILERECORD_INTERFACE_H
|
||||
#define INCLUDE_FILERECORD_INTERFACE_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
class SDRBASE_API FileRecordInterface {
|
||||
public:
|
||||
virtual void setFileName(const QString &filename) = 0;
|
||||
virtual void startRecording() = 0;
|
||||
virtual void stopRecording() = 0;
|
||||
static QString genUniqueFileName(unsigned int deviceUID, int istream = -1);
|
||||
};
|
||||
|
||||
|
||||
#endif // INCLUDE_FILERECORD_INTERFACE_H
|
||||
Loading…
x
Reference in New Issue
Block a user