123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef VideoPlayer_H
- #define VideoPlayer_H
- #include <QWidget>
- #include <QThread>
- #include <QTimer>
- #include <QSemaphore>
- #include "globalInfo.h"
- 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);
- void setPlayVedioSize(int width,int height);
- void setPlayCallBack(std::function<Play_CallBack> playCallBack,void* context);
- protected:
- void paintEvent(QPaintEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- void refreshOneUIUntilHave();
-
- void mouseDoubleClickEvent(QMouseEvent *event) override;
- private slots:
- void do_refreshUI();
- void do_refreshOneUI();
- void do_playCompleted();
- 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;
- std::function<Play_CallBack> m_funcPlayCB = nullptr;
- void* m_context = nullptr;
- };
- #endif
|