|
- #pragma once
- #pragma execution_character_set("utf-8")
-
- #include <QByteArray>
- #include <QComboBox>
- #include <QGraphicsItem>
- #include <QGraphicsPixmapItem>
- #include <QImage>
- #include <QPixmap>
- #include <QResizeEvent>
- #include <QTimerEvent>
- #include <QWidget>
- #include "FfmpegDecodeNew.h"
- #include "MacroInfo.h"
- #include "ui_VideoWidget.h"
-
- struct WgtRect {
- int m_iWgtWidth;
- int m_iWgtHeight;
- int m_iMaxWidth;
- int m_iMaxHeight;
- };
-
- class VideoWidget : public QWidget
- {
- Q_OBJECT
- public:
- VideoWidget(QWidget* parent = Q_NULLPTR);
- ~VideoWidget();
- void setParam(QString title, int count);
- inline QString getTitle()
- {
- return m_strTitle;
- }
- inline int getCount()
- {
- return m_iCount;
- }
- void setWidgetEmbedded(bool embedded);
- inline WgtRect getWgtRect()
- {
- return m_wgtRect;
- }
- inline bool isEmbeded()
- {
- return m_bEmbedded;
- }
- void setVideoData(QByteArray array);
- FfmpegDecodeNew* getFfmpegDecode()
- {
- return m_pFfmpegDecodeNew;
- }
- void stopPlay();
- void clearWidget();
- void fitInView();
-
- private:
- Ui::VideoWidgetClass ui;
- QString m_strTitle;
- int m_iCount;
- bool m_bIsWindMax;
- int m_iWgtWidth; // 正常宽度
- int m_iWgtHeight; // 正常高度
- int m_iMaxWidth; // 最大宽度
- int m_iMaxHeight; // 最大高度
- int m_iCurWidth; // 当前宽度
- int m_iCurHeight; // 当前高度
- bool m_bMoving;
- QPoint m_lastMousePos;
- QGraphicsPixmapItem* m_pPixmapItem;
- QImage m_image;
- QPixmap m_pixmap;
- bool m_bEmbedded; // 窗口是否内嵌
- WgtRect m_wgtRect;
- FfmpegDecodeNew* m_pFfmpegDecodeNew; // FFmpeg播放器
- int m_iTimerId;
- QByteArray m_videoArray;
- unsigned int m_uiIndex;
- unsigned int m_uiDataSize;
- bool m_bIsPlay;
- unsigned int m_uiParseStatus; // 0:无任务解析,1:离线解析,2:在线解析
- private:
- void resizeEvent(QResizeEvent* event) override;
- void resizeSubControl(int width, int height);
- void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent* event);
- signals:
- void hideVideoWidget(int count);
- void popupVideoWidget(QString title, int count, bool embedded);
- void startPlayer(bool status);
- void videoSpeed(QString speed);
- void setPlayPos(int pos);
- private slots:
- void resizeWidget();
- void popupWidget();
- void hideWidget();
- void videoPlayer(); // 视频播放
- void selectVideoSpeed();
- void videoSilderPressed();
- void videoSilderReleased();
- public slots:
- void playedCount(unsigned int num, unsigned int count);
- void setParseStatus(unsigned int status);
- };
|