Skip to content

Commit 907e66a

Browse files
committed
[升级项目依赖并重构代码结构]:
- 升级 Qt 版本至 6.8.1,更新相关路径和配置。 - 替换 `ThreadSafeQueue` 为新的 `ConcurrentQueue` 实现,优化线程安全队列的性能。 - 重构 `BoundedBlockingQueue`,增加智能指针支持并修复潜在的线程安全问题。 - 添加 `QPlayer` 示例项目,基于 Qt Multimedia 模块实现媒体播放功能。 - 更新 `vcpkg.json`,调整 FFmpeg 的依赖特性,移除不必要的配置并优化平台支持。 - 修复 `ffmpeg` 模块中多个文件的编解码器队列操作,统一使用 `ConcurrentQueue`。 - 删除 Vulkan 相关着色器文件,调整 `shaders.qrc` 资源文件配置。 - 更新 `QtSingleApplication` 和 `QtLockedFile` 的 CMakeLists 配置,适配新的 Qt 模块命名。 - 优化项目结构,添加 `commonstr.hpp` 共享头文件,统一字符串资源管理。 - 修复 `examples` 和 `tests` 中的多个项目配置,适配新的依赖和模块变化。
1 parent f6f9b28 commit 907e66a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1583
-724
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ inputs:
2323
qt_ver:
2424
description: 'qt version'
2525
required: false
26-
default: '6.7.2'
26+
default: '6.8.1'
2727
type: string
2828

2929
runs:
@@ -42,7 +42,7 @@ runs:
4242
rm vcpkg.json
4343
4444
- name: Cache windows vcpkg
45-
if: startsWith(runner.os, 'Windows')
45+
if: runner.os == 'Windows'
4646
uses: actions/cache@v4
4747
with:
4848
path: C:\vcpkg\installed
@@ -51,10 +51,9 @@ runs:
5151
${{ inputs.os_name }}-vcpkg-installed-${{ runner.os_name }}-
5252
${{ inputs.os_name }}-vcpkg-installed-
5353
${{ inputs.os_name }}-
54-
save-always: true
5554
5655
- name: Cache macos or linux vcpkg
57-
if: startsWith(runner.os, 'macOS') || startsWith(runner.os, 'Linux')
56+
if: runner.os == 'macOS' || runner.os == 'Linux'
5857
uses: actions/cache@v4
5958
with:
6059
path: /usr/local/share/vcpkg/installed
@@ -63,10 +62,9 @@ runs:
6362
${{ inputs.os_name }}-vcpkg-installed-${{ runner.os_name }}-
6463
${{ inputs.os_name }}-vcpkg-installed-
6564
${{ inputs.os_name }}-
66-
save-always: true
6765
6866
- name: Install dependencies on windows
69-
if: startsWith(runner.os, 'Windows')
67+
if: runner.os == 'Windows'
7068
shell: bash
7169
run: |
7270
choco install ninja
@@ -77,7 +75,7 @@ runs:
7775
|| (cat C:/vcpkg/installed/vcpkg/issue_body.md && exit 1)
7876
7977
- name: Install dependencies on macos
80-
if: startsWith(runner.os, 'macOS')
78+
if: runner.os == 'macOS'
8179
shell: bash
8280
run: |
8381
brew install ninja nasm python-setuptools mpv
@@ -92,12 +90,12 @@ runs:
9290
|| (cat /usr/local/share/vcpkg/installed/vcpkg/issue_body.md && exit 1)
9391
9492
- name: Install dependencies on linux
95-
if: startsWith(runner.os, 'Linux')
93+
if: runner.os == 'Linux'
9694
shell: bash
9795
run: |
9896
sudo apt-get update
9997
sudo apt-get install ninja-build nasm autopoint gperf libgl1-mesa-dev \
100-
libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev \
98+
libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev libltdl-dev \
10199
mpv libmpv-dev
102100
ninja --version
103101
cmake --version
@@ -112,3 +110,4 @@ runs:
112110
version: ${{ inputs.qt_ver }}
113111
modules: ${{ inputs.qt_modules }}
114112
cache: 'true'
113+

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+

.github/workflows/qmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
os:
34-
- windows-2019
34+
- windows-latest
3535
- macos-latest
3636
- ubuntu-latest
3737

@@ -55,7 +55,7 @@ jobs:
5555
if: startsWith(matrix.os, 'windows')
5656
shell: pwsh
5757
run: |
58-
..\scripts\windows\setVsDev.ps1 -VersionRange "[16.0,17.0)" -Arch "x64"
58+
..\scripts\windows\setVsDev.ps1
5959
& qmake ./../.
6060
& jom
6161
working-directory: build

.github/workflows/toolchain.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
matrix:
2121
os:
2222
- windows-latest
23-
- windows-2019
2423
- macos-latest
2524
- ubuntu-latest
2625

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,5 @@ include_directories(src)
111111
add_subdirectory(src)
112112
add_subdirectory(tests)
113113
add_subdirectory(examples)
114+
115+
include(cmake/build_info.cmake)

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ transcodeCtx->audioPts += frame->nb_samples;
110110
qt.dbus.integration: Could not connect "org.freedesktop.IBus" to globalEngineChanged(QString)
111111
```
112112

113-
- 在Windows和Unix下,ControlWidget和TitleWidget的控制方式不同
114-
115-
1. Windows下使用 `mpv_set_property(d_ptr->mpv, "wid", MPV_FORMAT_INT64, &wid);`,使用layout布局,会使得视频窗口在最前面,遮挡ControlWidget和TitleWidget,所以将ControlWidget和TitleWidget悬浮在视频窗口上方,使用 `eventFilter`去处理大部分情况下ControlWidget和TitleWidget的显示,写的非常啰嗦,但是为了能够使用D3D11渲染,更棒的性能,只能这样处理,也是值得的;
116-
2. Unix下使用QOpenGLWidget,使用layout布局更加方便;
117-
118113
- MacOS打包需要[install_name_tool](/mac/change_lib_dependencies.rb),依赖拷贝脚本文件来自[iina](https://github.com/iina/iina/blob/develop/other/change_lib_dependencies.rb);
119114

120115
**当前 `brew`安装的 `mpv`中,`libmpv.dylib`的依赖是 `@loader_path/`,所以对脚本进行了一些修改;**
@@ -125,6 +120,10 @@ transcodeCtx->audioPts += frame->nb_samples;
125120

126121
依赖会拷贝到 `packet/Qt-Mpv.app/Contents/Frameworks/`
127122

123+
# QPlayer
124+
125+
- 参考 [Media Player Example](https://doc.qt.io/qt-6/qtmultimedia-player-example.html)
126+
128127
## QT-BUG
129128

130129
- 动态切换Video Render,从opengl切换到widget,还是有GPU 0-3D占用,而且使用量是opengl的2倍!!!QT-BUG?

cmake/qt.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
if(CMAKE_HOST_WIN32)
2-
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.7.2\\msvc2019_64")
2+
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.8.1\\msvc2022_64")
33
elseif(CMAKE_HOST_APPLE)
44

55
elseif(CMAKE_HOST_LINUX)
6-
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.7.2/gcc_64")
6+
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.8.1/gcc_64")
77
endif()
8+
9+
add_definitions(-DQT_DEPRECATED_WARNINGS)

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_subdirectory(ffmpegplayer)
22
add_subdirectory(ffmpegtranscoder)
3+
add_subdirectory(qplayer)
34

45
if(BUILD_MPV)
56
add_subdirectory(mpvplayer)

examples/common/commonstr.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
3+
#include <QCoreApplication>
4+
5+
namespace Common {
6+
7+
struct Tr
8+
{
9+
Q_DECLARE_TR_FUNCTIONS(Common)
10+
};
11+
12+
} // namespace Common

examples/common/controlwidget.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ ControlWidget::ControlWidget(QWidget *parent)
131131
: QWidget{parent}
132132
, d_ptr(new ControlWidgetPrivate(this))
133133
{
134-
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::Tool);
135-
setAttribute(Qt::WA_TranslucentBackground); //设置窗口背景透明
136-
137134
d_ptr->setupUI();
138135
buildConnect();
139136
d_ptr->initModelButton();
@@ -213,7 +210,7 @@ void ControlWidget::setDuration(int value)
213210
setPosition(0);
214211
}
215212

216-
#ifdef MPV_ON
213+
#if defined(MPV_ON)
217214
void ControlWidget::setChapters(const Mpv::Chapters &chapters)
218215
{
219216
QVector<qint64> nodes;
@@ -222,7 +219,7 @@ void ControlWidget::setChapters(const Mpv::Chapters &chapters)
222219
}
223220
d_ptr->slider->setNodes(nodes);
224221
}
225-
#else
222+
#elif defined(FFMPEG_ON)
226223
void ControlWidget::setChapters(const Ffmpeg::Chapters &chapters)
227224
{
228225
QVector<qint64> nodes;

0 commit comments

Comments
 (0)