1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Renamed FileSink plugin to FileOutput

This commit is contained in:
f4exb 2020-08-04 00:29:15 +02:00
parent 1870b35832
commit 44a62ea505
24 changed files with 311 additions and 312 deletions

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -23742,7 +23742,7 @@
"width": 153,
"height": 38,
"autoResize": false,
"text": "FileSink does not use this sample FIFO",
"text": "FileOutput does not use this sample FIFO",
"wordWrap": true
},
{
@ -23788,7 +23788,7 @@
"width": 153,
"height": 77,
"autoResize": false,
"text": "Does the upsampling from baseband FIFO to device FIFO. FileSink pulls from baseband FIFO directly",
"text": "Does the upsampling from baseband FIFO to device FIFO. FileOutput pulls from baseband FIFO directly",
"wordWrap": true
},
{

View File

@ -235,7 +235,7 @@ void FileSourceSource::seekFileStream(int seekMillis)
{
quint64 seekPoint = ((m_recordLength * seekMillis) / 1000) * m_fileSampleRate;
m_samplesCount = seekPoint;
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileSink::Header)
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileRecord::Header)
m_ifstream.clear();
m_ifstream.seekg(seekPoint + sizeof(FileRecord::Header), std::ios::beg);
}

View File

@ -1,7 +1,7 @@
project(samplesink)
add_subdirectory(testsink)
add_subdirectory(filesink)
add_subdirectory(fileoutput)
add_subdirectory(localoutput)
if(CM256CC_FOUND)

View File

@ -0,0 +1,55 @@
project(fileoutput)
set(fileoutput_SOURCES
fileoutput.cpp
fileoutputplugin.cpp
fileoutputsettings.cpp
fileoutputworker.cpp
)
set(fileoutput_HEADERS
fileoutput.h
fileoutputplugin.h
fileoutputsettings.h
fileoutputworker.h
)
include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
)
if(NOT SERVER_MODE)
set(fileoutput_SOURCES
${fileoutput_SOURCES}
fileoutputgui.cpp
fileoutputgui.ui
)
set(fileoutput_HEADERS
${fileoutput_HEADERS}
fileoutputgui.h
)
set(TARGET_NAME outputfileoutput)
set(TARGET_LIB "Qt5::Widgets")
set(TARGET_LIB_GUI "sdrgui")
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
else()
set(TARGET_NAME outputfileoutputsrv)
set(TARGET_LIB "")
set(TARGET_LIB_GUI "")
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()
add_library(${TARGET_NAME} SHARED
${fileoutput_SOURCES}
)
target_link_libraries(${TARGET_NAME}
Qt5::Core
${TARGET_LIB}
sdrbase
${TARGET_LIB_GUI}
swagger
)
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

View File

@ -28,22 +28,22 @@
#include "device/deviceapi.h"
#include "filesinkoutput.h"
#include "filesinkworker.h"
#include "fileoutput.h"
#include "fileoutputworker.h"
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSink, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkName, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkWork, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgReportFileSinkGeneration, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgReportFileSinkStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgConfigureFileOutput, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgConfigureFileOutputName, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgConfigureFileOutputWork, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgConfigureFileOutputStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgReportFileOutputGeneration, Message)
MESSAGE_CLASS_DEFINITION(FileOutput::MsgReportFileOutputStreamTiming, Message)
FileSinkOutput::FileSinkOutput(DeviceAPI *deviceAPI) :
FileOutput::FileOutput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_fileSinkWorker(nullptr),
m_deviceDescription("FileSink"),
m_fileOutputWorker(nullptr),
m_deviceDescription("FileOutput"),
m_fileName("./test.sdriq"),
m_startingTimeStamp(0),
m_masterTimer(deviceAPI->getMasterTimer())
@ -51,17 +51,17 @@ FileSinkOutput::FileSinkOutput(DeviceAPI *deviceAPI) :
m_deviceAPI->setNbSinkStreams(1);
}
FileSinkOutput::~FileSinkOutput()
FileOutput::~FileOutput()
{
stop();
}
void FileSinkOutput::destroy()
void FileOutput::destroy()
{
delete this;
}
void FileSinkOutput::openFileStream()
void FileOutput::openFileStream()
{
if (m_ofstream.is_open()) {
m_ofstream.close();
@ -79,51 +79,51 @@ void FileSinkOutput::openFileStream()
FileRecord::writeHeader(m_ofstream, header);
qDebug() << "FileSinkOutput::openFileStream: " << m_fileName.toStdString().c_str();
qDebug() << "FileOutput::openFileStream: " << m_fileName.toStdString().c_str();
}
void FileSinkOutput::init()
void FileOutput::init()
{
applySettings(m_settings, true);
}
bool FileSinkOutput::start()
bool FileOutput::start()
{
QMutexLocker mutexLocker(&m_mutex);
qDebug() << "FileSinkOutput::start";
qDebug() << "FileOutput::start";
openFileStream();
m_fileSinkWorker = new FileSinkWorker(&m_ofstream, &m_sampleSourceFifo);
m_fileSinkWorker->moveToThread(&m_fileSinkWorkerThread);
m_fileSinkWorker->setSamplerate(m_settings.m_sampleRate);
m_fileSinkWorker->setLog2Interpolation(m_settings.m_log2Interp);
m_fileSinkWorker->connectTimer(m_masterTimer);
m_fileOutputWorker = new FileOutputWorker(&m_ofstream, &m_sampleSourceFifo);
m_fileOutputWorker->moveToThread(&m_fileOutputWorkerThread);
m_fileOutputWorker->setSamplerate(m_settings.m_sampleRate);
m_fileOutputWorker->setLog2Interpolation(m_settings.m_log2Interp);
m_fileOutputWorker->connectTimer(m_masterTimer);
startWorker();
mutexLocker.unlock();
//applySettings(m_generalSettings, m_settings, true);
qDebug("FileSinkOutput::start: started");
qDebug("FileOutput::start: started");
if (getMessageQueueToGUI())
{
MsgReportFileSinkGeneration *report = MsgReportFileSinkGeneration::create(true); // acquisition on
MsgReportFileOutputGeneration *report = MsgReportFileOutputGeneration::create(true); // acquisition on
getMessageQueueToGUI()->push(report);
}
return true;
}
void FileSinkOutput::stop()
void FileOutput::stop()
{
qDebug() << "FileSourceInput::stop";
QMutexLocker mutexLocker(&m_mutex);
if (m_fileSinkWorker)
if (m_fileOutputWorker)
{
stopWorker();
delete m_fileSinkWorker;
m_fileSinkWorker = nullptr;
delete m_fileOutputWorker;
m_fileOutputWorker = nullptr;
}
if (m_ofstream.is_open()) {
@ -132,30 +132,30 @@ void FileSinkOutput::stop()
if (getMessageQueueToGUI())
{
MsgReportFileSinkGeneration *report = MsgReportFileSinkGeneration::create(false); // acquisition off
MsgReportFileOutputGeneration *report = MsgReportFileOutputGeneration::create(false); // acquisition off
getMessageQueueToGUI()->push(report);
}
}
void FileSinkOutput::startWorker()
void FileOutput::startWorker()
{
m_fileSinkWorker->startWork();
m_fileSinkWorkerThread.start();
m_fileOutputWorker->startWork();
m_fileOutputWorkerThread.start();
}
void FileSinkOutput::stopWorker()
void FileOutput::stopWorker()
{
m_fileSinkWorker->stopWork();
m_fileSinkWorkerThread.quit();
m_fileSinkWorkerThread.wait();
m_fileOutputWorker->stopWork();
m_fileOutputWorkerThread.quit();
m_fileOutputWorkerThread.wait();
}
QByteArray FileSinkOutput::serialize() const
QByteArray FileOutput::serialize() const
{
return m_settings.serialize();
}
bool FileSinkOutput::deserialize(const QByteArray& data)
bool FileOutput::deserialize(const QByteArray& data)
{
bool success = true;
@ -165,58 +165,58 @@ bool FileSinkOutput::deserialize(const QByteArray& data)
success = false;
}
MsgConfigureFileSink* message = MsgConfigureFileSink::create(m_settings, true);
MsgConfigureFileOutput* message = MsgConfigureFileOutput::create(m_settings, true);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureFileSink* messageToGUI = MsgConfigureFileSink::create(m_settings, true);
MsgConfigureFileOutput* messageToGUI = MsgConfigureFileOutput::create(m_settings, true);
m_guiMessageQueue->push(messageToGUI);
}
return success;
}
const QString& FileSinkOutput::getDeviceDescription() const
const QString& FileOutput::getDeviceDescription() const
{
return m_deviceDescription;
}
int FileSinkOutput::getSampleRate() const
int FileOutput::getSampleRate() const
{
return m_settings.m_sampleRate;
}
quint64 FileSinkOutput::getCenterFrequency() const
quint64 FileOutput::getCenterFrequency() const
{
return m_settings.m_centerFrequency;
}
void FileSinkOutput::setCenterFrequency(qint64 centerFrequency)
void FileOutput::setCenterFrequency(qint64 centerFrequency)
{
FileSinkSettings settings = m_settings;
FileOutputSettings settings = m_settings;
settings.m_centerFrequency = centerFrequency;
MsgConfigureFileSink* message = MsgConfigureFileSink::create(settings, false);
MsgConfigureFileOutput* message = MsgConfigureFileOutput::create(settings, false);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureFileSink* messageToGUI = MsgConfigureFileSink::create(settings, false);
MsgConfigureFileOutput* messageToGUI = MsgConfigureFileOutput::create(settings, false);
m_guiMessageQueue->push(messageToGUI);
}
}
std::time_t FileSinkOutput::getStartingTimeStamp() const
std::time_t FileOutput::getStartingTimeStamp() const
{
return m_startingTimeStamp;
}
bool FileSinkOutput::handleMessage(const Message& message)
bool FileOutput::handleMessage(const Message& message)
{
if (MsgConfigureFileSinkName::match(message))
if (MsgConfigureFileOutputName::match(message))
{
MsgConfigureFileSinkName& conf = (MsgConfigureFileSinkName&) message;
MsgConfigureFileOutputName& conf = (MsgConfigureFileOutputName&) message;
m_fileName = conf.getFileName();
openFileStream();
return true;
@ -224,7 +224,7 @@ bool FileSinkOutput::handleMessage(const Message& message)
else if (MsgStartStop::match(message))
{
MsgStartStop& cmd = (MsgStartStop&) message;
qDebug() << "FileSinkOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
qDebug() << "FileOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
if (cmd.getStartStop())
{
@ -240,19 +240,19 @@ bool FileSinkOutput::handleMessage(const Message& message)
return true;
}
else if (MsgConfigureFileSink::match(message))
else if (MsgConfigureFileOutput::match(message))
{
qDebug() << "FileSinkOutput::handleMessage: MsgConfigureFileSink";
MsgConfigureFileSink& conf = (MsgConfigureFileSink&) message;
qDebug() << "FileOutput::handleMessage: MsgConfigureFileOutput";
MsgConfigureFileOutput& conf = (MsgConfigureFileOutput&) message;
applySettings(conf.getSettings(), conf.getForce());
return true;
}
else if (MsgConfigureFileSinkWork::match(message))
else if (MsgConfigureFileOutputWork::match(message))
{
MsgConfigureFileSinkWork& conf = (MsgConfigureFileSinkWork&) message;
MsgConfigureFileOutputWork& conf = (MsgConfigureFileOutputWork&) message;
bool working = conf.isWorking();
if (m_fileSinkWorker != 0)
if (m_fileOutputWorker != 0)
{
if (working) {
startWorker();
@ -263,13 +263,13 @@ bool FileSinkOutput::handleMessage(const Message& message)
return true;
}
else if (MsgConfigureFileSinkStreamTiming::match(message))
else if (MsgConfigureFileOutputStreamTiming::match(message))
{
MsgReportFileSinkStreamTiming *report;
MsgReportFileOutputStreamTiming *report;
if (m_fileSinkWorker != 0 && getMessageQueueToGUI())
if (m_fileOutputWorker != 0 && getMessageQueueToGUI())
{
report = MsgReportFileSinkStreamTiming::create(m_fileSinkWorker->getSamplesCount());
report = MsgReportFileOutputStreamTiming::create(m_fileOutputWorker->getSamplesCount());
getMessageQueueToGUI()->push(report);
}
@ -281,7 +281,7 @@ bool FileSinkOutput::handleMessage(const Message& message)
}
}
void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
void FileOutput::applySettings(const FileOutputSettings& settings, bool force)
{
QMutexLocker mutexLocker(&m_mutex);
bool forwardChange = false;
@ -296,9 +296,9 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
{
m_settings.m_sampleRate = settings.m_sampleRate;
if (m_fileSinkWorker != 0)
if (m_fileOutputWorker != 0)
{
m_fileSinkWorker->setSamplerate(m_settings.m_sampleRate);
m_fileOutputWorker->setSamplerate(m_settings.m_sampleRate);
}
forwardChange = true;
@ -308,9 +308,9 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
{
m_settings.m_log2Interp = settings.m_log2Interp;
if (m_fileSinkWorker != 0)
if (m_fileOutputWorker != 0)
{
m_fileSinkWorker->setLog2Interpolation(m_settings.m_log2Interp);
m_fileOutputWorker->setLog2Interpolation(m_settings.m_log2Interp);
}
forwardChange = true;
@ -318,7 +318,7 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
if (forwardChange)
{
qDebug("FileSinkOutput::applySettings: forward: m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d",
qDebug("FileOutput::applySettings: forward: m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d",
m_settings.m_centerFrequency,
m_settings.m_sampleRate,
m_settings.m_log2Interp);
@ -328,7 +328,7 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
}
int FileSinkOutput::webapiRunGet(
int FileOutput::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage)
{
@ -337,7 +337,7 @@ int FileSinkOutput::webapiRunGet(
return 200;
}
int FileSinkOutput::webapiRun(
int FileOutput::webapiRun(
bool run,
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage)

View File

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_FILESINKOUTPUT_H
#define INCLUDE_FILESINKOUTPUT_H
#ifndef INCLUDE_FILEOUTPUT_H
#define INCLUDE_FILEOUTPUT_H
#include <QString>
#include <QTimer>
@ -27,30 +27,30 @@
#include <fstream>
#include "dsp/devicesamplesink.h"
#include "filesinksettings.h"
#include "fileoutputsettings.h"
class FileSinkWorker;
class FileOutputWorker;
class DeviceAPI;
class FileSinkOutput : public DeviceSampleSink {
class FileOutput : public DeviceSampleSink {
public:
class MsgConfigureFileSink : public Message {
class MsgConfigureFileOutput : public Message {
MESSAGE_CLASS_DECLARATION
public:
const FileSinkSettings& getSettings() const { return m_settings; }
const FileOutputSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
static MsgConfigureFileSink* create(const FileSinkSettings& settings, bool force)
static MsgConfigureFileOutput* create(const FileOutputSettings& settings, bool force)
{
return new MsgConfigureFileSink(settings, force);
return new MsgConfigureFileOutput(settings, force);
}
private:
FileSinkSettings m_settings;
FileOutputSettings m_settings;
bool m_force;
MsgConfigureFileSink(const FileSinkSettings& settings, bool force) :
MsgConfigureFileOutput(const FileOutputSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
@ -76,105 +76,105 @@ public:
{ }
};
class MsgConfigureFileSinkName : public Message {
class MsgConfigureFileOutputName : public Message {
MESSAGE_CLASS_DECLARATION
public:
const QString& getFileName() const { return m_fileName; }
static MsgConfigureFileSinkName* create(const QString& fileName)
static MsgConfigureFileOutputName* create(const QString& fileName)
{
return new MsgConfigureFileSinkName(fileName);
return new MsgConfigureFileOutputName(fileName);
}
private:
QString m_fileName;
MsgConfigureFileSinkName(const QString& fileName) :
MsgConfigureFileOutputName(const QString& fileName) :
Message(),
m_fileName(fileName)
{ }
};
class MsgConfigureFileSinkWork : public Message {
class MsgConfigureFileOutputWork : public Message {
MESSAGE_CLASS_DECLARATION
public:
bool isWorking() const { return m_working; }
static MsgConfigureFileSinkWork* create(bool working)
static MsgConfigureFileOutputWork* create(bool working)
{
return new MsgConfigureFileSinkWork(working);
return new MsgConfigureFileOutputWork(working);
}
private:
bool m_working;
MsgConfigureFileSinkWork(bool working) :
MsgConfigureFileOutputWork(bool working) :
Message(),
m_working(working)
{ }
};
class MsgConfigureFileSinkStreamTiming : public Message {
class MsgConfigureFileOutputStreamTiming : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgConfigureFileSinkStreamTiming* create()
static MsgConfigureFileOutputStreamTiming* create()
{
return new MsgConfigureFileSinkStreamTiming();
return new MsgConfigureFileOutputStreamTiming();
}
private:
MsgConfigureFileSinkStreamTiming() :
MsgConfigureFileOutputStreamTiming() :
Message()
{ }
};
class MsgReportFileSinkGeneration : public Message {
class MsgReportFileOutputGeneration : public Message {
MESSAGE_CLASS_DECLARATION
public:
bool getAcquisition() const { return m_acquisition; }
static MsgReportFileSinkGeneration* create(bool acquisition)
static MsgReportFileOutputGeneration* create(bool acquisition)
{
return new MsgReportFileSinkGeneration(acquisition);
return new MsgReportFileOutputGeneration(acquisition);
}
protected:
bool m_acquisition;
MsgReportFileSinkGeneration(bool acquisition) :
MsgReportFileOutputGeneration(bool acquisition) :
Message(),
m_acquisition(acquisition)
{ }
};
class MsgReportFileSinkStreamTiming : public Message {
class MsgReportFileOutputStreamTiming : public Message {
MESSAGE_CLASS_DECLARATION
public:
std::size_t getSamplesCount() const { return m_samplesCount; }
static MsgReportFileSinkStreamTiming* create(std::size_t samplesCount)
static MsgReportFileOutputStreamTiming* create(std::size_t samplesCount)
{
return new MsgReportFileSinkStreamTiming(samplesCount);
return new MsgReportFileOutputStreamTiming(samplesCount);
}
protected:
std::size_t m_samplesCount;
MsgReportFileSinkStreamTiming(std::size_t samplesCount) :
MsgReportFileOutputStreamTiming(std::size_t samplesCount) :
Message(),
m_samplesCount(samplesCount)
{ }
};
FileSinkOutput(DeviceAPI *deviceAPI);
virtual ~FileSinkOutput();
FileOutput(DeviceAPI *deviceAPI);
virtual ~FileOutput();
virtual void destroy();
virtual void init();
@ -206,10 +206,10 @@ public:
private:
DeviceAPI *m_deviceAPI;
QMutex m_mutex;
FileSinkSettings m_settings;
FileOutputSettings m_settings;
std::ofstream m_ofstream;
FileSinkWorker* m_fileSinkWorker;
QThread m_fileSinkWorkerThread;
FileOutputWorker* m_fileOutputWorker;
QThread m_fileOutputWorkerThread;
QString m_deviceDescription;
QString m_fileName;
std::time_t m_startingTimeStamp;
@ -218,7 +218,7 @@ private:
void startWorker();
void stopWorker();
void openFileStream();
void applySettings(const FileSinkSettings& settings, bool force = false);
void applySettings(const FileOutputSettings& settings, bool force = false);
};
#endif // INCLUDE_FILESINKOUTPUT_H
#endif // INCLUDE_FILEOUTPUT_H

View File

@ -23,7 +23,7 @@
#include <QFileDialog>
#include <QMessageBox>
#include "ui_filesinkgui.h"
#include "ui_fileoutputgui.h"
#include "plugin/pluginapi.h"
#include "gui/colormapper.h"
#include "gui/glspectrum.h"
@ -34,11 +34,11 @@
#include "device/deviceapi.h"
#include "device/deviceuiset.h"
#include "filesinkgui.h"
#include "fileoutputgui.h"
FileSinkGui::FileSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
FileOutputGui::FileOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
QWidget(parent),
ui(new Ui::FileSinkGui),
ui(new Ui::FileOutputGui),
m_deviceUISet(deviceUISet),
m_doApplySettings(true),
m_forceSettings(true),
@ -69,55 +69,55 @@ FileSinkGui::FileSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
displaySettings();
m_deviceSampleSink = (FileSinkOutput*) m_deviceUISet->m_deviceAPI->getSampleSink();
m_deviceSampleSink = (FileOutput*) m_deviceUISet->m_deviceAPI->getSampleSink();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
FileSinkGui::~FileSinkGui()
FileOutputGui::~FileOutputGui()
{
delete ui;
}
void FileSinkGui::destroy()
void FileOutputGui::destroy()
{
delete this;
}
void FileSinkGui::setName(const QString& name)
void FileOutputGui::setName(const QString& name)
{
setObjectName(name);
}
QString FileSinkGui::getName() const
QString FileOutputGui::getName() const
{
return objectName();
}
void FileSinkGui::resetToDefaults()
void FileOutputGui::resetToDefaults()
{
m_settings.resetToDefaults();
displaySettings();
sendSettings();
}
qint64 FileSinkGui::getCenterFrequency() const
qint64 FileOutputGui::getCenterFrequency() const
{
return m_settings.m_centerFrequency;
}
void FileSinkGui::setCenterFrequency(qint64 centerFrequency)
void FileOutputGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray FileSinkGui::serialize() const
QByteArray FileOutputGui::serialize() const
{
return m_settings.serialize();
}
bool FileSinkGui::deserialize(const QByteArray& data)
bool FileOutputGui::deserialize(const QByteArray& data)
{
if(m_settings.deserialize(data)) {
displaySettings();
@ -130,35 +130,35 @@ bool FileSinkGui::deserialize(const QByteArray& data)
}
}
bool FileSinkGui::handleMessage(const Message& message)
bool FileOutputGui::handleMessage(const Message& message)
{
if (FileSinkOutput::MsgConfigureFileSink::match(message))
if (FileOutput::MsgConfigureFileOutput::match(message))
{
qDebug("FileSinkGui::handleMessage: message: MsgConfigureFileSink");
const FileSinkOutput::MsgConfigureFileSink& cfg = (FileSinkOutput::MsgConfigureFileSink&) message;
qDebug("FileOutputGui::handleMessage: message: MsgConfigureFileOutput");
const FileOutput::MsgConfigureFileOutput& cfg = (FileOutput::MsgConfigureFileOutput&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else if (FileSinkOutput::MsgReportFileSinkGeneration::match(message))
else if (FileOutput::MsgReportFileOutputGeneration::match(message))
{
m_generation = ((FileSinkOutput::MsgReportFileSinkGeneration&)message).getAcquisition();
qDebug("FileSinkGui::handleMessage: message: MsgReportFileSinkGeneration: %s", m_generation ? "start" : "stop");
m_generation = ((FileOutput::MsgReportFileOutputGeneration&)message).getAcquisition();
qDebug("FileOutputGui::handleMessage: message: MsgReportFileOutputGeneration: %s", m_generation ? "start" : "stop");
updateWithGeneration();
return true;
}
else if (FileSinkOutput::MsgReportFileSinkStreamTiming::match(message))
else if (FileOutput::MsgReportFileOutputStreamTiming::match(message))
{
m_samplesCount = ((FileSinkOutput::MsgReportFileSinkStreamTiming&)message).getSamplesCount();
m_samplesCount = ((FileOutput::MsgReportFileOutputStreamTiming&)message).getSamplesCount();
updateWithStreamTime();
return true;
}
else if (FileSinkOutput::MsgStartStop::match(message))
else if (FileOutput::MsgStartStop::match(message))
{
FileSinkOutput::MsgStartStop& notif = (FileSinkOutput::MsgStartStop&) message;
qDebug("FileSinkGui::handleMessage: message: MsgStartStop: %s", notif.getStartStop() ? "start" : "stop");
FileOutput::MsgStartStop& notif = (FileOutput::MsgStartStop&) message;
qDebug("FileOutputGui::handleMessage: message: MsgStartStop: %s", notif.getStartStop() ? "start" : "stop");
blockApplySettings(true);
ui->startStop->setChecked(notif.getStartStop());
blockApplySettings(false);
@ -170,7 +170,7 @@ bool FileSinkGui::handleMessage(const Message& message)
}
}
void FileSinkGui::handleInputMessages()
void FileOutputGui::handleInputMessages()
{
Message* message;
@ -180,7 +180,7 @@ void FileSinkGui::handleInputMessages()
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
qDebug("FileSinkGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("FileOutputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
updateSampleRateAndFrequency();
@ -197,36 +197,36 @@ void FileSinkGui::handleInputMessages()
}
}
void FileSinkGui::updateSampleRateAndFrequency()
void FileOutputGui::updateSampleRateAndFrequency()
{
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate*(1<<m_settings.m_log2Interp)) / 1000));
}
void FileSinkGui::displaySettings()
void FileOutputGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_sampleRate);
}
void FileSinkGui::sendSettings()
void FileOutputGui::sendSettings()
{
if(!m_updateTimer.isActive())
m_updateTimer.start(100);
}
void FileSinkGui::updateHardware()
void FileOutputGui::updateHardware()
{
qDebug() << "FileSinkGui::updateHardware";
FileSinkOutput::MsgConfigureFileSink* message = FileSinkOutput::MsgConfigureFileSink::create(m_settings, m_forceSettings);
qDebug() << "FileOutputGui::updateHardware";
FileOutput::MsgConfigureFileOutput* message = FileOutput::MsgConfigureFileOutput::create(m_settings, m_forceSettings);
m_deviceSampleSink->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
void FileSinkGui::updateStatus()
void FileOutputGui::updateStatus()
{
int state = m_deviceUISet->m_deviceAPI->state();
@ -255,19 +255,19 @@ void FileSinkGui::updateStatus()
}
}
void FileSinkGui::on_centerFrequency_changed(quint64 value)
void FileOutputGui::on_centerFrequency_changed(quint64 value)
{
m_settings.m_centerFrequency = value * 1000;
sendSettings();
}
void FileSinkGui::on_sampleRate_changed(quint64 value)
void FileOutputGui::on_sampleRate_changed(quint64 value)
{
m_settings.m_sampleRate = value;
sendSettings();
}
void FileSinkGui::on_interp_currentIndexChanged(int index)
void FileOutputGui::on_interp_currentIndexChanged(int index)
{
if (index < 0) {
return;
@ -278,16 +278,16 @@ void FileSinkGui::on_interp_currentIndexChanged(int index)
sendSettings();
}
void FileSinkGui::on_startStop_toggled(bool checked)
void FileOutputGui::on_startStop_toggled(bool checked)
{
if (m_doApplySettings)
{
FileSinkOutput::MsgStartStop *message = FileSinkOutput::MsgStartStop::create(checked);
FileOutput::MsgStartStop *message = FileOutput::MsgStartStop::create(checked);
m_deviceSampleSink->getInputMessageQueue()->push(message);
}
}
void FileSinkGui::on_showFileDialog_clicked(bool checked)
void FileOutputGui::on_showFileDialog_clicked(bool checked)
{
(void) checked;
QString fileName = QFileDialog::getSaveFileName(this,
@ -301,19 +301,19 @@ void FileSinkGui::on_showFileDialog_clicked(bool checked)
}
}
void FileSinkGui::configureFileName()
void FileOutputGui::configureFileName()
{
qDebug() << "FileSinkGui::configureFileName: " << m_fileName.toStdString().c_str();
FileSinkOutput::MsgConfigureFileSinkName* message = FileSinkOutput::MsgConfigureFileSinkName::create(m_fileName);
qDebug() << "FileOutputGui::configureFileName: " << m_fileName.toStdString().c_str();
FileOutput::MsgConfigureFileOutputName* message = FileOutput::MsgConfigureFileOutputName::create(m_fileName);
m_deviceSampleSink->getInputMessageQueue()->push(message);
}
void FileSinkGui::updateWithGeneration()
void FileOutputGui::updateWithGeneration()
{
ui->showFileDialog->setEnabled(!m_generation);
}
void FileSinkGui::updateWithStreamTime()
void FileOutputGui::updateWithStreamTime()
{
int t_sec = 0;
int t_msec = 0;
@ -330,11 +330,11 @@ void FileSinkGui::updateWithStreamTime()
ui->relTimeText->setText(s_timems);
}
void FileSinkGui::tick()
void FileOutputGui::tick()
{
if ((++m_tickCount & 0xf) == 0)
{
FileSinkOutput::MsgConfigureFileSinkStreamTiming* message = FileSinkOutput::MsgConfigureFileSinkStreamTiming::create();
FileOutput::MsgConfigureFileOutputStreamTiming* message = FileOutput::MsgConfigureFileOutputStreamTiming::create();
m_deviceSampleSink->getInputMessageQueue()->push(message);
}
}

View File

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_FILESINKGUI_H
#define INCLUDE_FILESINKGUI_H
#ifndef INCLUDE_FILEOUTPUTGUI_H
#define INCLUDE_FILEOUTPUTGUI_H
#include <plugin/plugininstancegui.h>
#include <QTimer>
@ -24,23 +24,23 @@
#include "util/messagequeue.h"
#include "filesinkoutput.h"
#include "filesinksettings.h"
#include "fileoutput.h"
#include "fileoutputsettings.h"
class DeviceSampleSink;
class DeviceUISet;
namespace Ui {
class FileSinkGui;
class FileOutputGui;
}
class FileSinkGui : public QWidget, public PluginInstanceGUI {
class FileOutputGui : public QWidget, public PluginInstanceGUI {
Q_OBJECT
public:
explicit FileSinkGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~FileSinkGui();
explicit FileOutputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~FileOutputGui();
virtual void destroy();
void setName(const QString& name);
@ -55,12 +55,12 @@ public:
virtual bool handleMessage(const Message& message);
private:
Ui::FileSinkGui* ui;
Ui::FileOutputGui* ui;
DeviceUISet* m_deviceUISet;
bool m_doApplySettings;
bool m_forceSettings;
FileSinkSettings m_settings;
FileOutputSettings m_settings;
QString m_fileName;
QTimer m_updateTimer;
QTimer m_statusTimer;
@ -95,4 +95,4 @@ private slots:
void tick();
};
#endif // INCLUDE_FILESINKGUI_H
#endif // INCLUDE_FILEOUTPUTGUI_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FileSinkGui</class>
<widget class="QWidget" name="FileSinkGui">
<class>FileOutputGui</class>
<widget class="QWidget" name="FileOutputGui">
<property name="geometry">
<rect>
<x>0</x>
@ -29,7 +29,7 @@
</font>
</property>
<property name="windowTitle">
<string>FileSink</string>
<string>FileOutput</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">

View File

@ -21,48 +21,48 @@
#include "util/simpleserializer.h"
#ifdef SERVER_MODE
#include "filesinkoutput.h"
#include "fileoutput.h"
#else
#include "filesinkgui.h"
#include "fileoutputgui.h"
#endif
#include "filesinkplugin.h"
#include "fileoutputplugin.h"
const PluginDescriptor FileSinkPlugin::m_pluginDescriptor = {
QString("FileSink"),
QString("File sink output"),
QString("4.14.16"),
const PluginDescriptor FileOutputPlugin::m_pluginDescriptor = {
QString("FileOutput"),
QString("File output"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
QString("https://github.com/f4exb/sdrangel")
};
const QString FileSinkPlugin::m_hardwareID = "FileSink";
const QString FileSinkPlugin::m_deviceTypeID = FILESINK_DEVICE_TYPE_ID;
const QString FileOutputPlugin::m_hardwareID = "FileOutput";
const QString FileOutputPlugin::m_deviceTypeID = FILEOUTPUT_DEVICE_TYPE_ID;
FileSinkPlugin::FileSinkPlugin(QObject* parent) :
FileOutputPlugin::FileOutputPlugin(QObject* parent) :
QObject(parent)
{
}
const PluginDescriptor& FileSinkPlugin::getPluginDescriptor() const
const PluginDescriptor& FileOutputPlugin::getPluginDescriptor() const
{
return m_pluginDescriptor;
}
void FileSinkPlugin::initPlugin(PluginAPI* pluginAPI)
void FileOutputPlugin::initPlugin(PluginAPI* pluginAPI)
{
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
void FileSinkPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
void FileOutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"FileSink",
"FileOutput",
m_hardwareID,
QString(),
0, // Sequence
@ -73,7 +73,7 @@ void FileSinkPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices&
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks(const OriginDevices& originDevices)
PluginInterface::SamplingDevices FileOutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
@ -99,7 +99,7 @@ PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks(const OriginDev
}
#ifdef SERVER_MODE
PluginInstanceGUI* FileSinkPlugin::createSampleSinkPluginInstanceGUI(
PluginInstanceGUI* FileOutputPlugin::createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,
DeviceUISet *deviceUISet)
@ -107,32 +107,32 @@ PluginInstanceGUI* FileSinkPlugin::createSampleSinkPluginInstanceGUI(
(void) sinkId;
(void) widget;
(void) deviceUISet;
return 0;
return nullptr;
}
#else
PluginInstanceGUI* FileSinkPlugin::createSampleSinkPluginInstanceGUI(
PluginInstanceGUI* FileOutputPlugin::createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
if(sinkId == m_deviceTypeID)
if (sinkId == m_deviceTypeID)
{
FileSinkGui* gui = new FileSinkGui(deviceUISet);
FileOutputGui* gui = new FileOutputGui(deviceUISet);
*widget = gui;
return gui;
}
else
{
return 0;
return nullptr;
}
}
#endif
DeviceSampleSink* FileSinkPlugin::createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI)
DeviceSampleSink* FileOutputPlugin::createSampleSinkPluginInstance(const QString& sinkId, DeviceAPI *deviceAPI)
{
if(sinkId == m_deviceTypeID)
{
FileSinkOutput* output = new FileSinkOutput(deviceAPI);
FileOutput* output = new FileOutput(deviceAPI);
return output;
}
else

View File

@ -15,24 +15,24 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_FILESINKPLUGIN_H
#define INCLUDE_FILESINKPLUGIN_H
#ifndef INCLUDE_FILEOUTPUTPLUGIN_H
#define INCLUDE_FILEOUTPUTPLUGIN_H
#include <QObject>
#include "plugin/plugininterface.h"
#define FILESINK_DEVICE_TYPE_ID "sdrangel.samplesink.filesink"
#define FILEOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.fileoutput"
class PluginAPI;
class DeviceAPI;
class FileSinkPlugin : public QObject, public PluginInterface {
class FileOutputPlugin : public QObject, public PluginInterface {
Q_OBJECT
Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID FILESINK_DEVICE_TYPE_ID)
Q_PLUGIN_METADATA(IID FILEOUTPUT_DEVICE_TYPE_ID)
public:
explicit FileSinkPlugin(QObject* parent = NULL);
explicit FileOutputPlugin(QObject* parent = NULL);
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
@ -52,4 +52,4 @@ private:
static const PluginDescriptor m_pluginDescriptor;
};
#endif // INCLUDE_FILESOURCEPLUGIN_H
#endif // INCLUDE_FILEOUTPUTPLUGIN_H

View File

@ -16,21 +16,21 @@
///////////////////////////////////////////////////////////////////////////////////
#include "util/simpleserializer.h"
#include "filesinksettings.h"
#include "fileoutputsettings.h"
FileSinkSettings::FileSinkSettings()
FileOutputSettings::FileOutputSettings()
{
resetToDefaults();
}
void FileSinkSettings::resetToDefaults()
void FileOutputSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_sampleRate = 48000;
m_log2Interp = 0;
}
QByteArray FileSinkSettings::serialize() const
QByteArray FileOutputSettings::serialize() const
{
SimpleSerializer s(1);
@ -40,7 +40,7 @@ QByteArray FileSinkSettings::serialize() const
return s.final();
}
bool FileSinkSettings::deserialize(const QByteArray& data)
bool FileOutputSettings::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);

View File

@ -15,20 +15,20 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_SAMPLESINK_FILESINK_FILESINKSETTINGS_H_
#define PLUGINS_SAMPLESINK_FILESINK_FILESINKSETTINGS_H_
#ifndef PLUGINS_SAMPLESINK_FILEOUTPUT_FILEOUTPUTSETTINGS_H_
#define PLUGINS_SAMPLESINK_FILEOUTPUT_FILEOUTPUTSETTINGS_H_
#include <QByteArray>
struct FileSinkSettings {
struct FileOutputSettings {
quint64 m_centerFrequency;
quint64 m_sampleRate;
quint32 m_log2Interp;
FileSinkSettings();
FileOutputSettings();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
};
#endif /* PLUGINS_SAMPLESINK_FILESINK_FILESINKSETTINGS_H_ */
#endif /* PLUGINS_SAMPLESINK_FILEOUTPUT_FILEOUTPUTSETTINGS_H_ */

View File

@ -22,9 +22,9 @@
#include <QDebug>
#include "dsp/samplesourcefifo.h"
#include "filesinkworker.h"
#include "fileoutputworker.h"
FileSinkWorker::FileSinkWorker(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent) :
FileOutputWorker::FileOutputWorker(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent) :
QObject(parent),
m_running(false),
m_ofstream(samplesStream),
@ -34,7 +34,7 @@ FileSinkWorker::FileSinkWorker(std::ofstream *samplesStream, SampleSourceFifo* s
m_samplesCount(0),
m_samplerate(0),
m_log2Interpolation(0),
m_throttlems(FILESINK_THROTTLE_MS),
m_throttlems(FILEOUTPUT_THROTTLE_MS),
m_maxThrottlems(50),
m_throttleToggle(false),
m_buf(nullptr)
@ -42,7 +42,7 @@ FileSinkWorker::FileSinkWorker(std::ofstream *samplesStream, SampleSourceFifo* s
assert(m_ofstream != nullptr);
}
FileSinkWorker::~FileSinkWorker()
FileOutputWorker::~FileOutputWorker()
{
if (m_running) {
stopWork();
@ -51,34 +51,34 @@ FileSinkWorker::~FileSinkWorker()
if (m_buf) delete[] m_buf;
}
void FileSinkWorker::startWork()
void FileOutputWorker::startWork()
{
qDebug() << "FileSinkWorker::startWork: ";
qDebug() << "FileOutputWorker::startWork: ";
if (m_ofstream->is_open())
{
qDebug() << "FileSinkWorker::startWork: file stream open, starting...";
qDebug() << "FileOutputWorker::startWork: file stream open, starting...";
m_maxThrottlems = 0;
m_elapsedTimer.start();
m_running = true;
}
else
{
qDebug() << "FileSinkWorker::startWork: file stream closed, not starting.";
qDebug() << "FileOutputWorker::startWork: file stream closed, not starting.";
m_running = false;
}
}
void FileSinkWorker::stopWork()
void FileOutputWorker::stopWork()
{
m_running = false;
}
void FileSinkWorker::setSamplerate(int samplerate)
void FileOutputWorker::setSamplerate(int samplerate)
{
if (samplerate != m_samplerate)
{
qDebug() << "FileSinkWorker::setSamplerate:"
qDebug() << "FileOutputWorker::setSamplerate:"
<< " new:" << samplerate
<< " old:" << m_samplerate;
@ -108,7 +108,7 @@ void FileSinkWorker::setSamplerate(int samplerate)
}
}
void FileSinkWorker::setLog2Interpolation(int log2Interpolation)
void FileOutputWorker::setLog2Interpolation(int log2Interpolation)
{
if ((log2Interpolation < 0) || (log2Interpolation > 6))
{
@ -117,7 +117,7 @@ void FileSinkWorker::setLog2Interpolation(int log2Interpolation)
if (log2Interpolation != m_log2Interpolation)
{
qDebug() << "FileSinkWorker::setLog2Interpolation:"
qDebug() << "FileOutputWorker::setLog2Interpolation:"
<< " new:" << log2Interpolation
<< " old:" << m_log2Interpolation;
@ -141,13 +141,13 @@ void FileSinkWorker::setLog2Interpolation(int log2Interpolation)
}
}
void FileSinkWorker::connectTimer(const QTimer& timer)
void FileOutputWorker::connectTimer(const QTimer& timer)
{
qDebug() << "FileSinkWorker::connectTimer";
qDebug() << "FileOutputWorker::connectTimer";
connect(&timer, SIGNAL(timeout()), this, SLOT(tick()));
}
void FileSinkWorker::tick()
void FileOutputWorker::tick()
{
if (m_running)
{
@ -175,7 +175,7 @@ void FileSinkWorker::tick()
}
}
void FileSinkWorker::callbackPart(SampleVector& data, unsigned int iBegin, unsigned int iEnd)
void FileOutputWorker::callbackPart(SampleVector& data, unsigned int iBegin, unsigned int iEnd)
{
SampleVector::iterator beginRead = data.begin() + iBegin;
unsigned int chunkSize = iEnd - iBegin;

View File

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_FILESINKWORKER_H
#define INCLUDE_FILESINKWORKER_H
#ifndef INCLUDE_FILEOUTPUTWORKER_H
#define INCLUDE_FILEOUTPUTWORKER_H
#include <QObject>
#include <QTimer>
@ -29,16 +29,16 @@
#include "dsp/inthalfbandfilter.h"
#include "dsp/interpolators.h"
#define FILESINK_THROTTLE_MS 50
#define FILEOUTPUT_THROTTLE_MS 50
class SampleSourceFifo;
class FileSinkWorker : public QObject {
class FileOutputWorker : public QObject {
Q_OBJECT
public:
FileSinkWorker(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent = 0);
~FileSinkWorker();
FileOutputWorker(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent = 0);
~FileOutputWorker();
void startWork();
void stopWork();
@ -76,4 +76,4 @@ private slots:
void tick();
};
#endif // INCLUDE_FILESINKWORKER_H
#endif // INCLUDE_FILEOUTPUTWORKER_H

View File

@ -1,8 +1,8 @@
<h1>File sink plugin</h1>
<h1>File output plugin</h1>
<h2>Introduction</h2>
This output sample sink plugin sends its samples to file in the SDRangel .sdriq format.
This sample sink plugin sends its samples to file in the SDRangel .sdriq format.
The format is S16LE I/Q samples. Thus there are 4 bytes per sample. I and Q values are 16 bit signed integers. The file starts with a context header containing information about center frequency, sample rate and timestamp of the start of the recording. This header has a length which is a multiple of a sample size (normally 24 bytes thus 6 samples). Thus this file can be used as a raw I/Q file with S16LE samples tolerating a glitch at the start corresponding to the 6 "random" samples. For example in GNURadio you can simply specify your file source format as short complex.
@ -10,7 +10,7 @@ You can also zap the 24 bytes header with this Linux command: `tail -c +25 myfil
To convert in another format you may use the sox utility. For example to convert to 32 bit (float) complex samples do: `sox -r 48k b 16 e signed-integer -c 2 myfile.raw -e float -c 2 myfilec.raw`
Note that you have to specify the sampling rate and use .raw for the file extensions.
Note that you have to specify the sampling rate and use .raw for the file extensions.
<h2>Build</h2>
@ -18,20 +18,20 @@ The plugin is always built.
<h2>Interface</h2>
![File sink plugin GUI](../../../doc/img/FileSink_plugin.png)
![File output plugin GUI](../../../doc/img/FileOutput_plugin.png)
<h3>1: Start/Stop</h3>
Device start / stop button.
Device start / stop button.
- Blue triangle icon: device is ready and can be started
- Red square icon: device is running and can be stopped
- Magenta (or pink) square icon: an error occurred
<h3>2: File stream sample rate</h3>
This is the file stream sample rate in kS/s after interpolation (4) from the baseband stream. Thus this is the sample rate (7) multiplied by the interpolation factor (6).
This is the file stream sample rate in kS/s after interpolation (4) from the baseband stream. Thus this is the sample rate (7) multiplied by the interpolation factor (6).
<h3>3: Frequency</h3>
This is the center frequency in kHz that will be put in the file header.

View File

@ -1,56 +0,0 @@
project(filesink)
set(filesink_SOURCES
filesinkoutput.cpp
filesinkplugin.cpp
filesinksettings.cpp
filesinkworker.cpp
)
set(filesink_HEADERS
filesinkoutput.h
filesinkplugin.h
filesinksettings.h
filesinkworker.h
)
include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
)
if(NOT SERVER_MODE)
set(filesink_SOURCES
${filesink_SOURCES}
filesinkgui.cpp
filesinkgui.ui
)
set(filesink_HEADERS
${filesink_HEADERS}
filesinkgui.h
)
set(TARGET_NAME outputfilesink)
set(TARGET_LIB "Qt5::Widgets")
set(TARGET_LIB_GUI "sdrgui")
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
else()
set(TARGET_NAME outputfilesinksrv)
set(TARGET_LIB "")
set(TARGET_LIB_GUI "")
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()
add_library(${TARGET_NAME} SHARED
${filesink_SOURCES}
)
target_link_libraries(${TARGET_NAME}
Qt5::Core
${TARGET_LIB}
sdrbase
${TARGET_LIB_GUI}
swagger
)
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

View File

@ -165,7 +165,7 @@ void FileInput::seekFileStream(int seekMillis)
{
quint64 seekPoint = ((m_recordLength * seekMillis) / 1000) * m_sampleRate;
m_fileInputWorker->setSamplesCount(seekPoint);
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileSink::Header)
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileRecord::Header)
m_ifstream.clear();
m_ifstream.seekg(seekPoint + sizeof(FileRecord::Header), std::ios::beg);
}

View File

@ -36,7 +36,7 @@ FileRecord::FileRecord() :
m_recordStart(false),
m_byteCount(0)
{
setObjectName("FileSink");
setObjectName("FileRecord");
}
FileRecord::FileRecord(const QString& filename) :

View File

@ -42,8 +42,8 @@ const QString PluginManager::m_localOutputHardwareID = "LocalOutput";
const QString PluginManager::m_localOutputDeviceTypeID = "sdrangel.samplesource.localoutput";
const QString PluginManager::m_remoteOutputHardwareID = "RemoteOutput";
const QString PluginManager::m_remoteOutputDeviceTypeID = "sdrangel.samplesink.remoteoutput";
const QString PluginManager::m_fileSinkHardwareID = "FileSink";
const QString PluginManager::m_fileSinkDeviceTypeID = "sdrangel.samplesink.filesink";
const QString PluginManager::m_fileOutputHardwareID = "FileOutput";
const QString PluginManager::m_fileOutputDeviceTypeID = "sdrangel.samplesink.fileoutput";
PluginManager::PluginManager(QObject* parent) :
QObject(parent),

View File

@ -91,7 +91,7 @@ public:
const PluginInterface *getDevicePluginInterface(const QString& deviceId) const;
static const QString& getFileInputDeviceId() { return m_fileInputDeviceTypeID; }
static const QString& getFileSinkDeviceId() { return m_fileSinkDeviceTypeID; }
static const QString& getFileSinkDeviceId() { return m_fileOutputDeviceTypeID; }
private:
struct SamplingDevice { //!< This is the device registration
@ -143,8 +143,8 @@ private:
static const QString m_localOutputDeviceTypeID; //!< Local output plugin ID
static const QString m_remoteOutputHardwareID; //!< Remote output hardware ID
static const QString m_remoteOutputDeviceTypeID; //!< Remote output plugin ID
static const QString m_fileSinkHardwareID; //!< FileSink sink hardware ID
static const QString m_fileSinkDeviceTypeID; //!< FileSink sink plugin ID
static const QString m_fileOutputHardwareID; //!< FileOutput sink hardware ID
static const QString m_fileOutputDeviceTypeID; //!< FileOutput sink plugin ID
void loadPluginsDir(const QDir& dir);
};

View File

@ -38,7 +38,7 @@ def getInputOptions():
options.device_hwid_rx = "FileInput"
if options.device_hwid_tx == None:
options.device_hwid_tx = "FileSink"
options.device_hwid_tx = "FileOutput"
if options.device_freq == None:
options.device_freq = 435000