#ifndef ELEVIDEO_H
#define ELEVIDEO_H

#include <QWidget>
#include <vlc/include/vlc/vlc.h>

class EleVideo : public QWidget {
    Q_OBJECT
public:
    explicit EleVideo(QString path, QWidget *parent = nullptr);
    ~EleVideo() {
        if(vlc) libvlc_release(vlc);
        if(player) libvlc_media_player_release(player);
    }

    unsigned mWidth{0}, mHeight{0};
    QImage imgRaw;
    QImage img;
    libvlc_instance_t *vlc{0};
    libvlc_media_player_t *player{0};
protected:
    void paintEvent(QPaintEvent *) override;
    void showEvent(QShowEvent *) override;
    void hideEvent(QHideEvent *) override;
signals:
    void emDisplay(QImage img);
};

#endif // ELEVIDEO_H
