更新代码

This commit is contained in:
feiyangqingyun
2023-01-30 11:41:50 +08:00
parent 890c06d443
commit d35ca11ee2
30 changed files with 85 additions and 68 deletions

View File

@@ -253,7 +253,7 @@ void FFmpegThread::run()
continue;
}
frameFinish = avcodec_receive_frame(videoCodec, avFrame2);
frameFinish = avcodec_receive_frame(videoCodec, avFrame2);
if (frameFinish < 0) {
continue;
}
@@ -383,7 +383,16 @@ void FFmpegWidget::paintEvent(QPaintEvent *)
//qDebug() << TIMEMS << "paintEvent" << objectName();
QPainter painter(this);
#if 0
//image = image.scaled(this->size(), Qt::KeepAspectRatio);
//按照比例自动居中绘制
int pixX = rect().center().x() - image.width() / 2;
int pixY = rect().center().y() - image.height() / 2;
QPoint point(pixX, pixY);
painter.drawImage(point, image);
#else
painter.drawImage(this->rect(), image);
#endif
}
void FFmpegWidget::updateImage(const QImage &image)

View File

@@ -1,7 +1,7 @@
### 特别说明
1. 编译完成以后记得将动态库文件复制到可执行文件同一目录。
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946731](https://qtchina.blog.csdn.net/article/details/103946731)
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946067](https://qtchina.blog.csdn.net/article/details/103946067)
### 其他说明
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)

View File

@@ -7,7 +7,7 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
ui->setupUi(this);
QStringList urls;
urls << "https://hls01open.ys7.com/openlive/6e0b2be040a943489ef0b9bb344b96b8.hd.m3u8";
urls << "f:/1.mp4";
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
urls << "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4";
urls << "rtsp://admin:Admin123456@192.168.0.15:554/media/video1";

View File

@@ -1,7 +1,7 @@
### 特别说明
1. 编译完成以后记得将dll文件复制到可执行文件同一目录。
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/107972067](https://qtchina.blog.csdn.net/article/details/107972067)
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946067](https://qtchina.blog.csdn.net/article/details/103946067)
### 其他说明
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)

View File

@@ -37,7 +37,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
//超过一个子元素则添加子菜单
QMenu *menuSub;
if (flags.count() > 1) {
if (flags.size() > 1) {
menuSub = menu->addMenu(name);
} else {
menuSub = menu;
@@ -50,7 +50,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
//对应菜单文本
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
if (flags.count() == 1) {
if (flags.size() == 1) {
text = name;
}
@@ -76,7 +76,7 @@ void VideoBox::setLayout(QGridLayout *gridLayout)
void VideoBox::setWidgets(QWidgetList widgets)
{
this->widgets = widgets;
this->videoCount = widgets.count();
this->videoCount = widgets.size();
}
void VideoBox::setMenuFlag(const QString &menuFlag)
@@ -97,7 +97,7 @@ void VideoBox::setTypes(const QMap<int, QStringList> &types)
void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
{
//通过菜单是否可见设置每个菜单可见与否
if (enable.count() < 9) {
if (enable.size() < 9) {
return;
}
@@ -209,7 +209,7 @@ void VideoBox::change_video_normal(int index, int flag)
{
//首先隐藏所有通道
hide_video_all();
int count = 0;
int size = 0;
int row = 0;
int column = 0;
@@ -221,7 +221,7 @@ void VideoBox::change_video_normal(int index, int flag)
gridLayout->addWidget(widgets.at(i), row, column);
widgets.at(i)->setVisible(true);
count++;
size++;
column++;
if (column == flag) {
row++;
@@ -229,7 +229,7 @@ void VideoBox::change_video_normal(int index, int flag)
}
}
if (count == (flag * flag)) {
if (size == (flag * flag)) {
break;
}
}
@@ -255,7 +255,7 @@ void VideoBox::change_video_custom(int index, int type)
void VideoBox::change_video_6(const QList<int> &indexs)
{
//过滤防止索引越界
if (indexs.count() < 6) {
if (indexs.size() < 6) {
return;
}
@@ -277,7 +277,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
void VideoBox::change_video_8(const QList<int> &indexs)
{
//过滤防止索引越界
if (indexs.count() < 8) {
if (indexs.size() < 8) {
return;
}
@@ -301,7 +301,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
void VideoBox::change_video_13(const QList<int> &indexs)
{
//过滤防止索引越界
if (indexs.count() < 13) {
if (indexs.size() < 13) {
return;
}

View File

@@ -37,7 +37,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
//超过一个子元素则添加子菜单
QMenu *menuSub;
if (flags.count() > 1) {
if (flags.size() > 1) {
menuSub = menu->addMenu(name);
} else {
menuSub = menu;
@@ -50,7 +50,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
//对应菜单文本
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
if (flags.count() == 1) {
if (flags.size() == 1) {
text = name;
}
@@ -76,7 +76,7 @@ void VideoBox::setLayout(QGridLayout *gridLayout)
void VideoBox::setWidgets(QWidgetList widgets)
{
this->widgets = widgets;
this->videoCount = widgets.count();
this->videoCount = widgets.size();
}
void VideoBox::setMenuFlag(const QString &menuFlag)
@@ -97,7 +97,7 @@ void VideoBox::setTypes(const QMap<int, QStringList> &types)
void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
{
//通过菜单是否可见设置每个菜单可见与否
if (enable.count() < 9) {
if (enable.size() < 9) {
return;
}
@@ -209,7 +209,7 @@ void VideoBox::change_video_normal(int index, int flag)
{
//首先隐藏所有通道
hide_video_all();
int count = 0;
int size = 0;
int row = 0;
int column = 0;
@@ -221,7 +221,7 @@ void VideoBox::change_video_normal(int index, int flag)
gridLayout->addWidget(widgets.at(i), row, column);
widgets.at(i)->setVisible(true);
count++;
size++;
column++;
if (column == flag) {
row++;
@@ -229,7 +229,7 @@ void VideoBox::change_video_normal(int index, int flag)
}
}
if (count == (flag * flag)) {
if (size == (flag * flag)) {
break;
}
}
@@ -255,7 +255,7 @@ void VideoBox::change_video_custom(int index, int type)
void VideoBox::change_video_6(const QList<int> &indexs)
{
//过滤防止索引越界
if (indexs.count() < 6) {
if (indexs.size() < 6) {
return;
}
@@ -277,7 +277,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
void VideoBox::change_video_8(const QList<int> &indexs)
{
//过滤防止索引越界
if (indexs.count() < 8) {
if (indexs.size() < 8) {
return;
}
@@ -301,7 +301,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
void VideoBox::change_video_13(const QList<int> &indexs)
{
//过滤防止索引越界
if (indexs.count() < 13) {
if (indexs.size() < 13) {
return;
}

Binary file not shown.

View File

@@ -109,7 +109,7 @@ void VideoWindow::initFlowPanel()
if (!fontDb.families().contains("iconfont")) {
int fontId = fontDb.addApplicationFont(":/font/iconfont.ttf");
QStringList fontName = fontDb.applicationFontFamilies(fontId);
if (fontName.count() == 0) {
if (fontName.size() == 0) {
qDebug() << "load iconfont.ttf error";
}
}
@@ -124,7 +124,7 @@ void VideoWindow::initFlowPanel()
#endif
//循环添加顶部按钮
for (int i = 0; i < btns.count(); ++i) {
for (int i = 0; i < btns.size(); ++i) {
QPushButton *btn = new QPushButton;
//绑定按钮单击事件,用来发出信号通知
connect(btn, SIGNAL(clicked(bool)), this, SLOT(btnClicked()));
@@ -208,7 +208,7 @@ void VideoWindow::dropEvent(QDropEvent *event)
url = event->mimeData()->urls().first().toLocalFile();
} else if (event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
QTreeWidget *treeWidget = (QTreeWidget *)event->source();
if (treeWidget != 0) {
if (treeWidget) {
url = treeWidget->currentItem()->data(0, Qt::UserRole).toString();
}
}