#ifndef PLAYERWIDGET_H
#define PLAYERWIDGET_H

#include <QWidget>
#include "PlayerGlobalInfo.h"

class PlayerWidget : public QWidget
{
    Q_OBJECT
public:
    PlayerWidget(QWidget *parent = nullptr);
    ~PlayerWidget();

    /* 刷新一帧 */
    void updateFrame(Image_YUV420& yuvData);
    void updateFrame(Image_QImage& imageData);

protected:
    /* 绘画事件 */
    void paintEvent(QPaintEvent *event) override;
    /* 重新设置大小事件 */
    void resizeEvent(QResizeEvent *event) override;

private:
    /* YUV420转QImage */
    void YUV420ToQImage(Image_YUV420& yuvData, QImage& image);

private:

    int m_imageWidth = 0;
    int m_imageHeight = 0;
    QImage m_image;
    // Image_QImage m_image;

    QSize m_windowSize;         /* 窗口大小 */
};

#endif /* PLAYERWIDGET_H */
