#ifndef ETCAMERATEST_H
#define ETCAMERATEST_H

#include <QWidget>
#include <opencv2/opencv.hpp>
#include <mutex>
#include <QTimer>
#include "CLiveViodeProc.h"

namespace Ui {
class etCameraTest;
}

class etCameraTest : public QWidget, ITRTCVideoRenderCallback
{
    Q_OBJECT

public:
    explicit etCameraTest(QWidget *parent = nullptr);
    ~etCameraTest();

    int setUI(const int nLeft, const int nTop, const int nWidth);
    int widgetHeight();
    int getCheckStatus();//0:false 1:true 2:未检测
private slots:
    void on_btn_IsSelf_clicked();
    void on_btn_IsNotSelf_clicked();

private:
    void onRenderVideoFrame(const char* userId, TRTCVideoStreamType streamType, TRTCVideoFrame* frame);
    void setCameraStaus(bool bOpened);
    Ui::etCameraTest *ui;
    std::shared_ptr<QTimer> m_pVideoTimer;
//    std::shared_ptr<QTimer> m_pinitTimer;
//    cv::VideoCapture m_cam;
    cv::Mat m_nCurImage;
    std::mutex m_imageMutex;
    __int64 m_lastFaceTime=0;
	int m_nCameraOpenStatus;
	bool m_bSetCameraStaus = false;
};

#endif // ETCAMERATEST_H
