1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

File Source plugin: skip header when seeking in I/Q recording

This commit is contained in:
f4exb 2016-10-08 10:02:36 +02:00
parent e9f23ed2bf
commit 008ee56252
2 changed files with 7 additions and 6 deletions

View File

@ -136,7 +136,7 @@ void FileSourceInput::seekFileStream(int seekPercentage)
m_fileSourceThread->setSamplesCount(seekPoint);
seekPoint *= 4; // + sizeof(FileSink::Header)
m_ifstream.clear();
m_ifstream.seekg(seekPoint, std::ios::beg);
m_ifstream.seekg(seekPoint + sizeof(FileRecord::Header), std::ios::beg);
}
}
@ -152,7 +152,7 @@ bool FileSourceInput::start(int device)
if (m_ifstream.tellg() != 0) {
m_ifstream.clear();
m_ifstream.seekg(0, std::ios::beg);
m_ifstream.seekg(sizeof(FileRecord::Header), std::ios::beg);
}
if(!m_sampleFifo.setSize(m_sampleRate * 4)) {

View File

@ -19,8 +19,9 @@
#include <assert.h>
#include <QDebug>
#include "dsp/filerecord.h"
#include "filesourcethread.h"
#include "../../../sdrbase/dsp/samplesinkfifo.h"
#include "dsp/samplesinkfifo.h"
FileSourceThread::FileSourceThread(std::ifstream *samplesStream, SampleSinkFifo* sampleFifo, QObject* parent) :
QThread(parent),
@ -52,7 +53,7 @@ FileSourceThread::~FileSourceThread()
void FileSourceThread::startWork()
{
qDebug() << "FileSourceThread::startWork: ";
if (m_ifstream->is_open())
{
qDebug() << "FileSourceThread::startWork: file stream open, starting...";
@ -157,13 +158,13 @@ void FileSourceThread::tick()
// read samples directly feeding the SampleFifo (no callback)
m_ifstream->read(reinterpret_cast<char*>(m_buf), m_chunksize);
if (m_ifstream->eof())
{
m_sampleFifo->write(m_buf, m_ifstream->gcount());
// TODO: handle loop playback situation
m_ifstream->clear();
m_ifstream->seekg(0, std::ios::beg);
m_ifstream->seekg(sizeof(FileRecord::Header), std::ios::beg);
m_samplesCount = 0;
//stopWork();
//m_ifstream->close();