Skip to content

Commit

Permalink
[更新Qt版本并增加音视频轨道选择功能]:
Browse files Browse the repository at this point in the history
- 更新了`action.yml`文件中的Qt版本至6.7.2。
- 调整了`qt.cmake`文件中的Qt路径,以适应Windows和Linux上的新版本。
- 在`mainwindow.cpp`和`mainwindow.cc`文件中,增加了音视频轨道选择功能,允许用户选择无轨道选项。
- 修正了`createtoneMappingMenu`函数的命名,以符合C++的命名规范。
- 在`mediainfo.hpp`中,将`TraskInfo`结构体的`id`成员类型从`int`更改为`QVariant`,以支持更灵活的类型。
- 更新了`vcpkg.json`文件,增加了对ffmpeg的特定功能支持,并更新了内置基线的哈希值。
  • Loading branch information
RealChuan committed Jun 25, 2024
1 parent 618c578 commit f6f9b28
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
qt_ver:
description: 'qt version'
required: false
default: '6.7.1'
default: '6.7.2'
type: string

runs:
Expand Down
4 changes: 2 additions & 2 deletions cmake/qt.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if(CMAKE_HOST_WIN32)
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.7.1\\msvc2019_64")
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.7.2\\msvc2019_64")
elseif(CMAKE_HOST_APPLE)

elseif(CMAKE_HOST_LINUX)
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.7.1/gcc_64")
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.7.2/gcc_64")
endif()
4 changes: 2 additions & 2 deletions examples/ffmpegplayer/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class MainWindow::MainWindowPrivate

~MainWindowPrivate() = default;

auto createtoneMappingMenu() -> QMenu *
auto createToneMappingMenu() -> QMenu *
{
auto *group = new QActionGroup(q_ptr);
group->setExclusive(true);
Expand Down Expand Up @@ -710,7 +710,7 @@ void MainWindow::initMenu()
connect(equalizerAction, &QAction::triggered, this, &MainWindow::onEqualizer);
d_ptr->videoMenu->addAction(equalizerAction);

d_ptr->videoMenu->addMenu(d_ptr->createtoneMappingMenu());
d_ptr->videoMenu->addMenu(d_ptr->createToneMappingMenu());
d_ptr->videoMenu->addMenu(d_ptr->createTargetPrimariesMenu());

connect(d_ptr->audioTracksGroup, &QActionGroup::triggered, this, [this](QAction *action) {
Expand Down
18 changes: 16 additions & 2 deletions examples/mpvplayer/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class MainWindow::MainWindowPrivate
return menu;
}

auto createtoneMappingMenu() -> QMenu *
auto createToneMappingMenu() -> QMenu *
{
auto *group = new QActionGroup(q_ptr);
group->setExclusive(true);
Expand Down Expand Up @@ -423,7 +423,15 @@ void MainWindow::onTrackChanged()
{
d_ptr->resetTrackMenu();

Mpv::TraskInfo noTrackInfo;
noTrackInfo.id = "no";
noTrackInfo.title = "no";
noTrackInfo.selected = true;

auto videoTracks = d_ptr->mpvPlayer->videoTracks();
if (!videoTracks.isEmpty()) {
videoTracks.insert(0, noTrackInfo);
}
for (const auto &item : std::as_const(videoTracks)) {
auto *action = new QAction(item.text(), this);
action->setData(QVariant::fromValue(item));
Expand All @@ -436,6 +444,9 @@ void MainWindow::onTrackChanged()
}

auto audioTracks = d_ptr->mpvPlayer->audioTracks();
if (!audioTracks.isEmpty()) {
audioTracks.insert(0, noTrackInfo);
}
for (const auto &item : std::as_const(audioTracks)) {
auto *action = new QAction(item.text(), this);
action->setData(QVariant::fromValue(item));
Expand All @@ -448,6 +459,9 @@ void MainWindow::onTrackChanged()
}

auto subTracks = d_ptr->mpvPlayer->subTracks();
if (!subTracks.isEmpty()) {
subTracks.insert(0, noTrackInfo);
}
for (const auto &item : std::as_const(subTracks)) {
auto *action = new QAction(item.text(), this);
action->setData(QVariant::fromValue(item));
Expand Down Expand Up @@ -775,7 +789,7 @@ void MainWindow::initMenu()
auto *equalizerAction = new QAction(tr("Equalizer"), this);
connect(equalizerAction, &QAction::triggered, this, &MainWindow::onEqualizer);
d_ptr->videoMenu->addAction(equalizerAction);
d_ptr->videoMenu->addMenu(d_ptr->createtoneMappingMenu());
d_ptr->videoMenu->addMenu(d_ptr->createToneMappingMenu());
d_ptr->videoMenu->addMenu(d_ptr->createTargetPrimariesMenu());

connect(d_ptr->videoTracksGroup, &QActionGroup::triggered, this, [this](QAction *action) {
Expand Down
2 changes: 1 addition & 1 deletion src/mpv/mediainfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct MPV_LIB_EXPORT TraskInfo
int ff_index = 0;
bool forced = false;
bool hearing_impaired = false;
int id = 0;
QVariant id;
bool image = false;
QString lang;
bool selected = false;
Expand Down
70 changes: 35 additions & 35 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "qt-media",
"version": "0.0.1",
"description": "manifest",
"dependencies": [
"breakpad",
"crashpad",
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "qt-media",
"version": "0.0.1",
"description": "manifest",
"dependencies": [
"breakpad",
"crashpad",
{
"name": "ffmpeg",
"features": [
"opengl",
"ass",
"bzip2",
"freetype",
"fribidi",
"zlib",
"gpl",
"ffmpeg",
"ffplay",
"ffprobe",
{
"name": "ffmpeg",
"features": [
"opengl",
"ass",
"bzip2",
"freetype",
"fribidi",
"zlib",
"gpl",
"ffmpeg",
"ffplay",
"ffprobe",
{
"name": "qsv",
"platform": "windows"
},
{
"name": "amf",
"platform": "windows | linux"
},
{
"name": "nvcodec",
"platform": "windows | linux"
}
]
"name": "qsv",
"platform": "windows"
},
{
"name": "amf",
"platform": "windows | linux"
},
{
"name": "nvcodec",
"platform": "windows | linux"
}
],
"builtin-baseline": "dee924de74e81388140a53c32a919ecec57d20ab"
}
]
}
],
"builtin-baseline": "c4467cb686f92671f0172aa8299a77d908175b4e"
}

0 comments on commit f6f9b28

Please sign in to comment.