2,新增“Apps”; 3,新增“Common”; 4,新增“FileList”; 5,新增“MediaX”; 6,新增“OpenSource”; 7,新增“Samples”; 8,新增“SoftwareBusinessLines”.
91 lines
2.4 KiB
C++
91 lines
2.4 KiB
C++
#ifndef _FileStream_H_
|
|
#define _FileStream_H_
|
|
|
|
#include "../Common/CommDef.h"
|
|
#include "../../GIOParams.h"
|
|
//#include "../common/ConfigHelp.h"
|
|
#include "../common/GCycleQueue.h"
|
|
#include "../../DeviceStream/GdPCIE/pciedef.h"
|
|
#include "timeapi.h"
|
|
|
|
#include <QFile>
|
|
#include <thread>
|
|
#include <chrono>
|
|
#include <QThreadPool>
|
|
#include <QFuture>
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
extern int c_nWMemSize;
|
|
|
|
typedef void (*pCallBack_Progress)(int nFrameIndex, int nFrameCount, void* pOwner, int iChannelIndex);
|
|
|
|
class FileStream : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit FileStream(bool bDirectoryOnly, bool bRecyclePlay, const QString& strFileName, const GFrameFormat& varRawFileParam, pCallBack_Progress pCallBack, void* pOwner);
|
|
virtual ~FileStream();
|
|
ePlayState GetPlayState();
|
|
void Play();
|
|
void Stop();
|
|
void Pause();
|
|
bool Previous();
|
|
bool Next();
|
|
bool Seek(uint frameNo);
|
|
|
|
GCycleQueue& GetFrameQueue();
|
|
|
|
private:
|
|
typedef void (FileStream::*ThreadRunFunPtr)();
|
|
static void ThreadEntry(ThreadRunFunPtr pRunFun, void* pOwner);
|
|
void ThreadFun();
|
|
|
|
bool OpenFiles(QString strFileName_Playback);
|
|
bool ReadFileData(bool bReplay);
|
|
bool ReadFrameData(int nFrameIndex);
|
|
void CloseFiles();
|
|
|
|
bool EnumFiles(QString strDir, QVector<QString>& vecFileList);
|
|
|
|
int GetByteOfPixel(ePixelType ePT);
|
|
inline void SleepAccurate(int milliseconds);
|
|
|
|
private:
|
|
GFrameFormat m_varRawFileParam;
|
|
|
|
int m_nFrameCount;
|
|
int m_nFrameSize;
|
|
|
|
int m_nCurrentIndex;
|
|
|
|
char* m_pFrameBuffer;
|
|
|
|
bool m_bDirectoryOnly;
|
|
bool m_bRecyclePlay;
|
|
|
|
pCallBack_Progress m_pCallBack;
|
|
void* m_pOwner;
|
|
|
|
bool m_bOpen;
|
|
ePlayState m_ePlayState;
|
|
|
|
GCycleQueue m_varQueueFrameData;
|
|
uchar* m_pFullData;
|
|
|
|
QString m_strFileName_Playback;
|
|
QString m_strFileName; // 文件名
|
|
QFile* m_pFile; // 文件(视频数据)
|
|
|
|
// bool m_bThreadRunning;
|
|
// std::thread* m_pThread;
|
|
// int m_iFileStreamIndex;
|
|
int m_iThreadSleepMsec; // 线程休眠时间
|
|
|
|
bool m_bThreadRunning;
|
|
QThreadPool m_varThreadPool;
|
|
QFuture<void> m_futureThreadRun;
|
|
};
|
|
|
|
#endif // RAWFILEDLG_H
|