Skip to content

Commit

Permalink
新增视频播放mdk内核
Browse files Browse the repository at this point in the history
  • Loading branch information
feiyangqingyun committed Dec 15, 2023
1 parent 123a5b4 commit 2806faa
Show file tree
Hide file tree
Showing 565 changed files with 4,083 additions and 118,662 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
![](video/0snap/playvlc.jpg)
- 视频播放mpv-plaympv
![](video/0snap/plaympv.jpg)
- 视频播放mdk-playmdk
![](video/0snap/playmdk.jpg)

### 3.4 窗体相关-widget
- 颜色拾取器-colorwidget
Expand Down
9 changes: 5 additions & 4 deletions control/devicebutton/devicebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,27 @@ void DeviceButton::paintEvent(QPaintEvent *)
bool DeviceButton::eventFilter(QObject *watched, QEvent *event)
{
//识别鼠标 按下+移动+松开+双击 等事件
int type = event->type();
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
//限定鼠标左键
if (mouseEvent->button() == Qt::LeftButton) {
lastPoint = mouseEvent->pos();
isPressed = true;
Q_EMIT clicked();
return true;
}
} else if (event->type() == QEvent::MouseMove) {
} else if (type == QEvent::MouseMove) {
//允许拖动并且鼠标按下准备拖动
if (canMove && isPressed) {
int dx = mouseEvent->pos().x() - lastPoint.x();
int dy = mouseEvent->pos().y() - lastPoint.y();
this->move(this->x() + dx, this->y() + dy);
return true;
}
} else if (event->type() == QEvent::MouseButtonRelease) {
} else if (type == QEvent::MouseButtonRelease) {
isPressed = false;
} else if (event->type() == QEvent::MouseButtonDblClick) {
} else if (type == QEvent::MouseButtonDblClick) {
Q_EMIT doubleClicked();
}

Expand Down
7 changes: 4 additions & 3 deletions control/lightbutton/lightbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,20 @@ LightButton::LightButton(QWidget *parent) : QWidget(parent)

bool LightButton::eventFilter(QObject *watched, QEvent *event)
{
int type = event->type();
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
if (this->rect().contains(mouseEvent->pos()) && (mouseEvent->button() == Qt::LeftButton)) {
lastPoint = mouseEvent->pos();
pressed = true;
}
} else if (mouseEvent->type() == QEvent::MouseMove && pressed) {
} else if (type == QEvent::MouseMove && pressed) {
if (canMove) {
int dx = mouseEvent->pos().x() - lastPoint.x();
int dy = mouseEvent->pos().y() - lastPoint.y();
this->move(this->x() + dx, this->y() + dy);
}
} else if (mouseEvent->type() == QEvent::MouseButtonRelease && pressed) {
} else if (type == QEvent::MouseButtonRelease && pressed) {
pressed = false;
Q_EMIT clicked();
}
Expand Down
13 changes: 7 additions & 6 deletions control/navbutton/iconhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,27 @@ bool IconHelper::eventFilter(QObject *watched, QEvent *event)
int index = btns.indexOf(btn);
if (index >= 0) {
//不同的事件设置不同的图标,同时区分选中的和没有选中的
int type = event->type();
if (btn->isChecked()) {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixChecked.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixPressed.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixHover.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixNormal.at(index)));
}
}
Expand Down
13 changes: 7 additions & 6 deletions third/qcustomplotdemo/frmcustom/iconhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,27 @@ bool IconHelper::eventFilter(QObject *watched, QEvent *event)
int index = btns.indexOf(btn);
if (index >= 0) {
//不同的事件设置不同的图标,同时区分选中的和没有选中的
int type = event->type();
if (btn->isChecked()) {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixChecked.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixPressed.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixHover.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixNormal.at(index)));
}
}
Expand Down
13 changes: 7 additions & 6 deletions ui/core_base/iconhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,27 @@ bool IconHelper::eventFilter(QObject *watched, QEvent *event)
int index = btns.indexOf(btn);
if (index >= 0) {
//不同的事件设置不同的图标,同时区分选中的和没有选中的
int type = event->type();
if (btn->isChecked()) {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixChecked.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixPressed.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixHover.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixNormal.at(index)));
}
}
Expand Down
13 changes: 7 additions & 6 deletions ui/iconhelper/iconhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,27 @@ bool IconHelper::eventFilter(QObject *watched, QEvent *event)
int index = btns.indexOf(btn);
if (index >= 0) {
//不同的事件设置不同的图标,同时区分选中的和没有选中的
int type = event->type();
if (btn->isChecked()) {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixChecked.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixChecked.at(index)));
}
} else {
if (event->type() == QEvent::MouseButtonPress) {
if (type == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (mouseEvent->button() == Qt::LeftButton) {
btn->setIcon(QIcon(pixPressed.at(index)));
}
} else if (event->type() == QEvent::Enter) {
} else if (type == QEvent::Enter) {
btn->setIcon(QIcon(pixHover.at(index)));
} else if (event->type() == QEvent::Leave) {
} else if (type == QEvent::Leave) {
btn->setIcon(QIcon(pixNormal.at(index)));
}
}
Expand Down
Binary file added video/0snap/playmdk.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion video/playffmpeg/ffmpeg/ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <QtWidgets>
#endif

#include "ffmpeghead.h"
#include "ffmpeginclude.h"

class FFmpegThread : public QThread
{
Expand Down
62 changes: 12 additions & 50 deletions video/playffmpeg/ffmpeg/ffmpeg.pri
Original file line number Diff line number Diff line change
@@ -1,60 +1,22 @@
HEADERS += $$PWD/ffmpeghead.h
HEADERS += $$PWD/ffmpeg.h
SOURCES += $$PWD/ffmpeg.cpp

#如果用的是ffmpeg4内核请将ffmpeg3改成ffmpeg4,两种内核不兼容,头文件也不一样
#如果用的是ffmpeg4内核请将ffmpeg3改成ffmpeg4
DEFINES += ffmpeg4

#ffmpeg4则使用ffmpeg4的目录

contains(DEFINES, ffmpeg4) {
strPath = ffmpeg4
path_main = ffmpeg4
} else {
strPath = ffmpeg3
path_main = ffmpeg3
}

#表示64位的构建套件
contains(QT_ARCH, x86_64) {
strLib = winlib64
strInclude = include64
path_lib = libwin64
} else {
#由于Qt4不支持QT_ARCH所以会执行下面的
#如果用的64位的Qt4则需要自行修改

strLib = winlib
strInclude = include
path_lib = libwin32
}

#表示arm平台构建套件

contains(QT_ARCH, arm) {
strInclude = include
}
#包含头文件
INCLUDEPATH += $$PWD/$$path_main/include
#链接库文件
LIBS += -L$$PWD/$$path_main/$$path_lib/ -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil

!android {
INCLUDEPATH += $$PWD/$$strPath/$$strInclude
}

win32 {
LIBS += -L$$PWD/$$strPath/$$strLib/ -lavcodec -lavfilter -lavformat -lswscale -lavutil -lswresample -lavdevice
}

#请自行替换

!android {
unix:!macx {
LIBS += -L$$PWD/linuxlib/ -lavfilter -lavformat -lavdevice -lavcodec -lswscale -lavutil -lswresample -lavdevice -lpthread -lm -lz -lrt -ldl
}}

#android系统
android {
INCLUDEPATH += $$PWD/androidlib/include
LIBS += -L$$PWD/androidlib/ -lavcodec -lavfilter -lavformat -lswscale -lavutil -lswresample
#将动态库文件一起打包
ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavcodec.so
ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavfilter.so
ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavformat.so
ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavutil.so
ANDROID_EXTRA_LIBS += $$PWD/androidlib/libswresample.so
ANDROID_EXTRA_LIBS += $$PWD/androidlib/libswscale.so
}
HEADERS += $$PWD/ffmpeginclude.h
HEADERS += $$PWD/ffmpeg.h
SOURCES += $$PWD/ffmpeg.cpp
112 changes: 0 additions & 112 deletions video/playffmpeg/ffmpeg/ffmpeg3/include/mfx/mfxdefs.h

This file was deleted.

Loading

0 comments on commit 2806faa

Please sign in to comment.