1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-10-01 01:06:35 -04:00

SDRdaemon plugin: changed sample buffer to raw format (uint8_t)

This commit is contained in:
f4exb 2016-01-26 08:27:45 +01:00
parent fd8c9c41eb
commit 458767aa45
2 changed files with 28 additions and 10 deletions

View File

@ -31,7 +31,11 @@ SDRdaemonBuffer::SDRdaemonBuffer(std::size_t blockSize) :
m_nbDecodes(0),
m_nbSuccessfulDecodes(0),
m_nbCRCOK(0),
m_dataCRC(0)
m_dataCRC(0),
m_sampleRate(1000000),
m_sampleBytes(2),
m_sampleBits(12),
m_rawBuffer(0)
{
m_buf = new uint8_t[blockSize];
m_currentMeta.init();
@ -39,6 +43,10 @@ SDRdaemonBuffer::SDRdaemonBuffer(std::size_t blockSize) :
SDRdaemonBuffer::~SDRdaemonBuffer()
{
if (m_rawBuffer) {
delete[] m_rawBuffer;
}
delete[] m_buf;
}
@ -210,6 +218,14 @@ void SDRdaemonBuffer::updateSizes(MetaData *metaData)
m_lz4InCount = 0;
}
void SDRdaemonBuffer::updateBufferSize()
{
if (m_rawBuffer) {
delete[] m_rawBuffer;
}
m_rawBuffer = new uint8_t[m_sampleRate * 2 * m_sampleBytes]; // store 1 second of samples
}
void SDRdaemonBuffer::printMeta(MetaData *metaData)
{
@ -227,6 +243,3 @@ void SDRdaemonBuffer::printMeta(MetaData *metaData)
<< std::endl;
}

View File

@ -69,6 +69,7 @@ public:
private:
bool writeAndReadLZ4(uint8_t *array, std::size_t length, uint8_t *data, std::size_t& dataLength);
void updateSizes(MetaData *metaData);
void updateBufferSize();
void printMeta(MetaData *metaData);
std::size_t m_blockSize; //!< UDP block (payload) size
@ -78,17 +79,21 @@ private:
CRC64 m_crc64; //!< CRC64 calculator
uint8_t *m_buf; //!< UDP block buffer
uint8_t *m_lz4InBuffer; //!< Buffer for LZ4 compressed input
uint32_t m_lz4InCount; //!< Current position in LZ4 input buffer
uint32_t m_lz4InSize; //!< Size in bytes of the LZ4 input data
uint8_t *m_lz4OutBuffer; //!< Buffer for LZ4 uncompressed output
uint32_t m_lz4OutSize; //!< Size in bytes of the LZ4 output data (original uncomressed data)
uint8_t *m_lz4InBuffer; //!< Buffer for LZ4 compressed input
uint32_t m_lz4InCount; //!< Current position in LZ4 input buffer
uint32_t m_lz4InSize; //!< Size in bytes of the LZ4 input data
uint8_t *m_lz4OutBuffer; //!< Buffer for LZ4 uncompressed output
uint32_t m_lz4OutSize; //!< Size in bytes of the LZ4 output data (original uncomressed data)
uint32_t m_nbDecodes;
uint32_t m_nbSuccessfulDecodes;
uint32_t m_nbCRCOK;
uint64_t m_dataCRC;
SampleVector m_convertBuffer;
uint32_t m_sampleRate; //!< Current sample rate in Hz
uint8_t m_sampleBytes; //!< Current number of bytes per I or Q sample
uint8_t m_sampleBits; //!< Current number of effective bits per sample
uint8_t *m_rawBuffer; //!< Buffer for raw samples obtained from UDP (I/Q not in a formal I/Q structure)
};