PylonRecorder/writer.h
2020-11-20 09:58:37 +01:00

52 lines
926 B
C++

#ifndef WRITER_H
#define WRITER_H
#include <QObject>
#include <QThread>
#include <pylon/PylonIncludes.h>
#include "pylonwrapper.h"
#include "imagebuffer.h"
struct VideoSpecs {
std::string filename;
uint32_t width, height, quality = 95;
int fps;
double exposureTime;
double detectorGain;
Pylon::EPixelType pixelType;
Pylon::EImageOrientation orientation;
};
class Writer : public QThread
{
Q_OBJECT
public:
explicit Writer(ImageBuffer*buffer, QObject *parent = nullptr) :
QThread(parent), buffer(buffer) {}
void setVideoSpecs(VideoSpecs specs);
void run() override;
void stop();
signals:
void terminated();
void writingDone();
private:
ImageBuffer *buffer;
VideoSpecs videoSpecs;
bool stop_request = false, stopNow = false;
bool valid = false;
public slots:
void requestStop() {
stop_request=true;
}
void forceStop() {
stopNow = true;
}
};
#endif // WRITER_H