#ifndef VIDEOWIN_H #define VIDEOWIN_H #include "basewin.h" #define HAVE_REMOTE #include #include "pcap.h" #include #include #include #include #include "Win32-Extensions.h" #pragma comment(lib, "wpcap.lib") #pragma comment(lib, "Ws2_32.lib") QByteArray getNetDev(QWidget *parent); class VideoSendThread : public QThread { Q_OBJECT public: explicit VideoSendThread(pcap *pcap); ~VideoSendThread() { pcap_close(pcap); } pcap *pcap; std::atomic status{0}; QList imgs; std::mutex mtx; protected: void run(); signals: void onErr(QString); }; class VideoRecThread : public QThread { Q_OBJECT public: explicit VideoRecThread(pcap *pcap); ~VideoRecThread() { pcap_close(pcap); } pcap *pcap; std::atomic status{0}; protected: void run(); signals: void onMsg(QImage, int, int); void onErr(char *); }; class Canvas : public QWidget { public: QImage img; protected: void paintEvent(QPaintEvent *event); }; class VideoWin : public BaseWin { Q_OBJECT public: static VideoWin *newIns(QWidget *); explicit VideoWin(pcap *, pcap *, QWidget *parent = nullptr); ~VideoWin() { if(thdRece) thdRece->status = 2; if(sendThd) sendThd->status = 2; if(timerId) killTimer(timerId); } VideoRecThread *thdRece{0}; VideoSendThread *sendThd{0}; QScreen *screen; int timerId{0}; QSpinBox *fdWidth, *fdHeight; QRadioButton *fdEnd; QLabel *fdInfo, *fdLostTimes, *fdLostPkts; QString info; qint64 last_epoch{0}; int lostTimes{0}, lostPkts{0}; protected: void timerEvent(QTimerEvent *event) override; }; #endif // VIDEOWIN_H