2022-08-25 18:37:24 +08:00
|
|
|
#ifndef EVIDEO_H
|
|
|
|
#define EVIDEO_H
|
|
|
|
|
|
|
|
#include "ebase.h"
|
|
|
|
#include "pagelistitem.h"
|
|
|
|
extern "C"{
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
}
|
2022-10-27 15:07:45 +08:00
|
|
|
class ProgItem;
|
2022-08-25 18:37:24 +08:00
|
|
|
class EVideo : public EBase {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static QString filters() {
|
|
|
|
static const QString filters = tr("Video")+"(*.mp4 *.mkv *.ts *.m2ts *.tp *.rm *.rmvb *.avi *.wmv *.mov);;"+tr("Flash")+"(*.flv *.swf)";
|
|
|
|
return filters;
|
|
|
|
}
|
|
|
|
static const QImage &mask() {
|
|
|
|
static const QImage mask = QImage(":/res/video-pre.png");
|
|
|
|
return mask;
|
|
|
|
}
|
2023-05-16 11:13:55 +08:00
|
|
|
static QString transcoding(QWidget *parent, QString rawFile, QString rawName, QString dir, int rawW, int rawH, AVCodecID codec_id);
|
2022-08-25 18:37:24 +08:00
|
|
|
static EVideo *create(const QString &file, PageListItem *pageItem, EBase *multiWin = nullptr);
|
2023-10-23 14:58:29 +08:00
|
|
|
static EVideo *create(const JObj &, PageListItem *pageItem, EBase *multiWin = nullptr);
|
|
|
|
static JObj genProg(const JObj &, const QString &, ProgItem *mProgItem);
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
explicit EVideo(const QString &, const QString &, const QString &, const QString &, QImage &img, int dur, PageListItem *pageItem, EBase *multiWin = nullptr);
|
|
|
|
|
|
|
|
int type() const override { return EBase::Video; }
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
|
|
QWidget* attrWgt() override;
|
|
|
|
bool save(const QString &pRoot) override;
|
2023-10-23 14:58:29 +08:00
|
|
|
JObj attrJson() const override;
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
QString mDir;
|
|
|
|
QString mName;
|
|
|
|
QString mRawDir;
|
|
|
|
QString mRawName;
|
|
|
|
QImage mCoverImg;
|
|
|
|
protected:
|
|
|
|
int aspectRatioMode = Qt::IgnoreAspectRatio;
|
|
|
|
int playDuration = 10;
|
|
|
|
int playTimes = 1;
|
|
|
|
PageListItem *mPageItem;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EVIDEO_H
|