#pragma once
#ifndef CAMERADATAHANDLEANDSHOW_H
#define CAMERADATAHANDLEANDSHOW_H

#endif // CAMERADATAHANDLEANDSHOW_H
#include <QtWidgets>
#include <QThread>
#include <QMutex>
#include "CInterface.h"
// 图像获取线程
class ImageGrabber : public QThread {
    Q_OBJECT
public:
    explicit ImageGrabber(int cameraId, QObject *parent = nullptr)
        : QThread(parent), m_cameraId(cameraId), m_running(true) {}

    void stop();
    long GrabImagetest(int iCameraId, ImageInfo& image);

signals:
    void imageGrabbed(const QImage&image);

protected:
    void run() override;

private:
    QImage convertImage(const ImageInfo &info);

    QImage convertYUV422ToRGB(const ImageInfo &info);

    int m_cameraId;
    bool m_running;
};
