#include "widget.h" #include "./ui_widget.h" #include #include #include "spdlog/spdlog.h" #include "fmtlog.h" #include "VideoPlayer1.h" #include "VideoPlayer.h" Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this); m_videoPlayer = std::make_shared(); m_videoPlayer->setPlayWidget(ui->widget_display); // m_videoPlayer1 = std::make_shared(); // m_videoPlayer1->setParent(ui->widget_display); SPDLOG_INFO("***** Qt Library *****"); VideoPlayer::ListHWDecoder(); } Widget::~Widget() { delete ui; } void Widget::on_pBtn_openVideo_clicked() { SPDLOG_INFO("点击了“打开视频”按钮"); QFileDialog fileDialog(this); fileDialog.setWindowTitle("选择视频文件"); fileDialog.setFileMode(QFileDialog::ExistingFiles); fileDialog.setNameFilter("视频文件(*.mp4 *.avi *.flv *.mkv *.rmvb *.rm *.3gp *.wmv *.asf *.mov *.m4v *.dat *.vob *.mpg *.mpeg *.ts *.tp *.trp *.m2ts *.mts *.m2t *.m2p *.ps *.tp *.trp *.webm *.f4v *.swf *.avchd *.h264 *.h265 *.hevc *.vp9 *.vp8 *.vp6 *.vp10 *.rmvb *.rm *.3gp *.wmv *.asf *.mov *.m4v *.dat *.vob *.mpg *.mpeg *.ts *.tp *.trp *.m2ts *.mts *.m2t *.m2p *.ps *.tp *.trp *.webm *.f4v *.swf *.avchd *.h264 *.h265 *.hevc *.vp9 *.vp8 *.vp6 *.vp10)"); fileDialog.setDirectory(QApplication::applicationDirPath()); if (fileDialog.exec()) { QStringList files = fileDialog.selectedFiles(); if (files.size() > 0) { ui->lineEdit->setText(files[0]); } } m_videoPlayer->openPlayVedio(ui->lineEdit->text()); // m_videoPlayer1->setPlayVedio(ui->lineEdit->text()); } void Widget::on_pBtn_play_clicked() { SPDLOG_INFO("点击了“播放”按钮"); m_videoPlayer->play(); // m_videoPlayer1->play(); } void Widget::on_pBtn_pause_clicked() { SPDLOG_INFO("点击了“暂停”按钮"); // m_videoPlayer->pause(); } void Widget::on_pBtn_stop_clicked() { SPDLOG_INFO("点击了“停止”按钮"); // m_videoPlayer->stop(); } void Widget::on_pBtn_backward_clicked() { SPDLOG_INFO("点击了“后退”按钮"); // m_videoPlayer->backward(10000); } void Widget::on_pBtn_forward_clicked() { SPDLOG_INFO("点击了“前进”按钮"); // m_videoPlayer->forward(10000); }