123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #ifndef VideoPlayer_H
- #define VideoPlayer_H
- #include <QWidget>
- #include <QThread>
- #include <QTimer>
- #include <QSemaphore>
- class DecodeVedio;
- class VideoPlayer : public QWidget
- {
- Q_OBJECT
- public:
- explicit VideoPlayer(QWidget *parent = nullptr);
- ~VideoPlayer();
- void setPlayVedio(const QString& fileName);
- bool play();
- void pause();
- void stop();
- bool getPlayStatus() { return m_playStatus; }
- qint64 getDuration();
- qint64 getCurrentPos();
- void setCurrentPos(quint64 pos);
- protected:
- void paintEvent(QPaintEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- void refreshOneUIUntilHave();
- private slots:
- void do_refreshUI();
- void do_refreshOneUI();
- private:
- QString m_fileName;
- QTimer m_timerRefreshUI;
- int m_srcWidth = 0;
- int m_srcHeight = 0;
- int m_nowWidth = 0;
- int m_nowHeight = 0;
- int m_frameCount = 0;
- int m_interval = 0;
- DecodeVedio* m_decodeVedio = nullptr;
- QThread* m_threadDecode = nullptr;
- QImage* m_image = nullptr;
- bool m_playStatus = false;
- bool isSetVedioFile = false;
- QSemaphore* m_semRefresh = nullptr;
- };
- #endif
|