mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
FileRecord improvement: update FileSink plugin and writeHeader private method in FileRecord accordingly
This commit is contained in:
parent
ef1e9c2b25
commit
993ab36a29
@ -68,12 +68,15 @@ void FileSinkOutput::openFileStream()
|
||||
|
||||
m_ofstream.open(m_fileName.toStdString().c_str(), std::ios::binary);
|
||||
|
||||
FileRecord::Header header;
|
||||
int actualSampleRate = m_settings.m_sampleRate * (1<<m_settings.m_log2Interp);
|
||||
m_ofstream.write((const char *) &actualSampleRate, sizeof(int));
|
||||
//m_ofstream.write((const char *) &m_settings.m_sampleRate, sizeof(int));
|
||||
m_ofstream.write((const char *) &m_settings.m_centerFrequency, sizeof(quint64));
|
||||
header.sampleRate = actualSampleRate;
|
||||
header.centerFrequency = m_settings.m_centerFrequency;
|
||||
m_startingTimeStamp = time(0);
|
||||
m_ofstream.write((const char *) &m_startingTimeStamp, sizeof(std::time_t));
|
||||
header.startTimeStamp = m_startingTimeStamp;
|
||||
header.sampleSize = SDR_RX_SAMP_SZ;
|
||||
|
||||
FileRecord::writeHeader(m_ofstream, header);
|
||||
|
||||
qDebug() << "FileSinkOutput::openFileStream: " << m_fileName.toStdString().c_str();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
const PluginDescriptor FileSinkPlugin::m_pluginDescriptor = {
|
||||
QString("File sink output"),
|
||||
QString("3.14.5"),
|
||||
QString("4.2.1"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -155,11 +155,8 @@ void FileRecord::writeHeader()
|
||||
header.startTimeStamp = ts;
|
||||
header.sampleSize = SDR_RX_SAMP_SZ;
|
||||
header.filler = 0;
|
||||
boost::crc_32_type crc32;
|
||||
crc32.process_bytes(&header, 28);
|
||||
header.crc32 = crc32.checksum();
|
||||
|
||||
m_sampleFile.write((const char *) &header, sizeof(Header));
|
||||
writeHeader(m_sampleFile, header);
|
||||
}
|
||||
|
||||
bool FileRecord::readHeader(std::ifstream& sampleFile, Header& header)
|
||||
@ -169,3 +166,11 @@ bool FileRecord::readHeader(std::ifstream& sampleFile, Header& header)
|
||||
crc32.process_bytes(&header, 28);
|
||||
return header.crc32 == crc32.checksum();
|
||||
}
|
||||
|
||||
void FileRecord::writeHeader(std::ofstream& sampleFile, Header& header)
|
||||
{
|
||||
boost::crc_32_type crc32;
|
||||
crc32.process_bytes(&header, 28);
|
||||
header.crc32 = crc32.checksum();
|
||||
sampleFile.write((const char *) &header, sizeof(Header));
|
||||
}
|
@ -58,6 +58,7 @@ public:
|
||||
void startRecording();
|
||||
void stopRecording();
|
||||
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);
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
|
Loading…
Reference in New Issue
Block a user