begin work on the CameraManager

This commit is contained in:
Arisotura
2022-04-29 12:07:11 +02:00
parent c761feee6a
commit 5363d3bf0c
7 changed files with 227 additions and 91 deletions

View File

@ -22,5 +22,47 @@
#include <QCamera>
#include <QCameraInfo>
#include <QAbstractVideoSurface>
#include <QVideoSurfaceFormat>
#include <QMutex>
#include "types.h"
class CameraFrameDumper : public QAbstractVideoSurface
{
Q_OBJECT
public:
CameraFrameDumper(QObject* parent = nullptr);
bool present(const QVideoFrame& frame) override;
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const override;
};
class CameraManager
{
public:
CameraManager(int num, int width, int height, bool yuv);
~CameraManager();
void Init();
void DeInit();
void Start();
void Stop();
void CaptureFrame(u32* frame, int width, int height, bool yuv);
private:
int Num;
int InputType;
QString ImagePath;
QString CamDeviceName;
int FrameWidth, FrameHeight;
bool FrameFormatYUV;
u32* FrameBuffer;
QMutex FrameMutex;
};
#endif // CAMERAMANAGER_H