Update to version 3.2
This commit is contained in:
@@ -83,6 +83,10 @@ inline Time getEndTime(const Time &stime, size_t count, const DataRecord::Header
|
||||
|
||||
RawDataRecord::RawDataRecord() : _dataOfs(0), _dataSize(0), _dirty(false) {}
|
||||
|
||||
DataRecord *RawDataRecord::clone() const {
|
||||
return new RawDataRecord(*this);
|
||||
}
|
||||
|
||||
const char *RawDataRecord::formatName() const {
|
||||
DT2STR("RAW/", _currentHeader.dataType)
|
||||
}
|
||||
@@ -258,11 +262,13 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
|
||||
if ( (start.valid() || end.valid()) && _endTime.valid() ) {
|
||||
// Out of bounds?
|
||||
if ( end.valid() && (end <= _startTime) )
|
||||
if ( end.valid() && (end <= _startTime) ) {
|
||||
return RS_AfterTimeWindow;
|
||||
}
|
||||
|
||||
if ( start.valid() && (start >= _endTime) )
|
||||
if ( start.valid() && (start >= _endTime) ) {
|
||||
return RS_BeforeTimeWindow;
|
||||
}
|
||||
|
||||
// Trim packet front
|
||||
if ( _startTime < start ) {
|
||||
@@ -284,7 +290,7 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
// return a partial record
|
||||
if ( maxSamples < sampleCount ) {
|
||||
CAPS_DEBUG("Clip %d available samples to %d", sampleCount, maxSamples);
|
||||
_endTime -= samplesToTimeSpan(_header, sampleCount-maxSamples);
|
||||
_endTime -= samplesToTimeSpan(_header, sampleCount - maxSamples);
|
||||
sampleCount = maxSamples;
|
||||
partial = true;
|
||||
}
|
||||
@@ -311,37 +317,45 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
|
||||
switch ( _header.dataType ) {
|
||||
case DT_INT8:
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<1,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) return RS_Error;
|
||||
}
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<1,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) {
|
||||
return RS_Error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DT_INT16:
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<2,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) return RS_Error;
|
||||
}
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<2,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) {
|
||||
return RS_Error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DT_INT32:
|
||||
case DT_FLOAT:
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<4,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) return RS_Error;
|
||||
}
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<4,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) {
|
||||
return RS_Error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DT_INT64:
|
||||
case DT_DOUBLE:
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<8,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) return RS_Error;
|
||||
}
|
||||
{
|
||||
// Stay with little endian data
|
||||
RIFF::VectorChunk<8,false> dataChunk(_data, sampleOfs, sampleCount);
|
||||
if ( !dataChunk.get(buf, size) ) {
|
||||
return RS_Error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -354,7 +368,7 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
_dataOfs = 0;
|
||||
_dataSize = _data.size();
|
||||
|
||||
return partial?RS_Partial:RS_Complete;
|
||||
return partial ? RS_Partial : RS_Complete;
|
||||
}
|
||||
|
||||
bool RawDataRecord::put(std::streambuf &buf, bool withHeader) const {
|
||||
|
||||
Reference in New Issue
Block a user