Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

Bundle original VB-CABLE setup for offline installation

Veyra Goal Agentd07ab8df9655
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9d7a615..f56d5658 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1268,6 +1268,16 @@ if(VEYRA_BUILD_QML_UI AND Qt6_FOUND)
# Interface translations (设置 → 界面语言): one catalog, compiled in so a package
# cannot ship without it. scripts/i18n/ builds it from the source strings.
qt_add_resources(veyra_qml_ui "veyra_i18n" PREFIX "/i18n" BASE "${CMAKE_CURRENT_SOURCE_DIR}/i18n" FILES i18n/catalog.json)
+ set(VEYRA_VB_CABLE_PACKAGE "" CACHE FILEPATH "Original VB-Audio Pack46 ZIP to include for optional offline installation")
+ if(VEYRA_VB_CABLE_PACKAGE)
+ file(SHA256 "${VEYRA_VB_CABLE_PACKAGE}" veyra_vb_cable_sha256)
+ if(NOT veyra_vb_cable_sha256 STREQUAL "bc44e8974191a5a2427d6c979e2dab08dbb09925f3f435dfa2f0ba3e45b6eb90")
+ message(FATAL_ERROR "VEYRA_VB_CABLE_PACKAGE must be the original VB-Audio Pack46 ZIP")
+ endif()
+ set_source_files_properties("${VEYRA_VB_CABLE_PACKAGE}" PROPERTIES QT_RESOURCE_ALIAS "VBCABLE_Driver_Pack46.zip")
+ qt_add_resources(veyra_qml_ui "veyra_optional_vb_cable" PREFIX "/optional-drivers"
+ FILES "${VEYRA_VB_CABLE_PACKAGE}" OPTIONS -no-compress)
+ endif()
target_compile_features(veyra_qml_ui PRIVATE cxx_std_20)
# Every thread without an explicit size (UI, engine, export worker) reserves the
# image default. The 32-node EffectChain is 45 KB and the bridge, preset and
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index c4be67e0..486181d0 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -1069,3 +1069,7 @@ Ported from `src/dllmain.cpp`: `Hook_cuDeviceGetAttribute`, `Hook_cuModuleLoadDa
Only the recognized VFG runtime receives this experimental SM86 adaptation. RTX 40/50 use their native path without installing these hooks. No SDK, model or proprietary runtime bytes are embedded in Veyra's source or executable, and the existing NVIDIA runtime/model set is reused. Source-level and RTX5070 native regression evidence is not a claim of RTX30 hardware inference, image quality or performance validation. NVIDIA's runtime remains proprietary and is governed separately by its supplied terms.
+## VB-Audio VB-CABLE (optional capture audio)
+
+Veyra Virtual Speaker uses the original VB-Audio VB-CABLE Pack46 for Windows. Builds configured with `VEYRA_VB_CABLE_PACKAGE` include the unmodified vendor ZIP for offline installation. Veyra opens the vendor setup only after the user confirms installation or removal. VB-CABLE is VB-Audio donationware. Users can support VB-Audio from the vendor site. See [VB-CABLE](https://vb-audio.com/Cable/) and [VB-Audio distribution terms](https://vb-audio.com/Services/licensing.htm).
+
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 7cbd430e..9dc38cc0 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -898,3 +898,11 @@ Claude初次构建305.9s,原完整Quick172/0/1、25 GPU用例、原双重/超
使用 MSVC 2022 的 CMake 对 `build/claude-screen-recording-20261022` 执行 `--build --parallel 2 --target veyra_qml_ui veyra_wasapi_input_tests veyra_qml_quick_tests veyra_ui_contract_tests`,最终增量通过。WASAPI `--offline` 19/0,`--blocked-output` 2/0 且提交音频帧为零,UI contract 包含新模式端点保存和加载。QtQuick 软件渲染 175/0/0。首次 QuickTest 用错 Qt 导入环境,按实际 Qt SDK 路径重新运行。真实 QML 实例核对未安装状态、安装说明、取消不启动安装、卸载确认。快捷按钮实际打开 Windows 录制标签,验证后关闭窗口。翻译目录检查无缺失和占位符错误。
日志位于 `E:/项目/Veyra/logs/virtual-capture-audio-20261108`。本机测试入口为 `E:/项目/Veyra/tests/virtual-capture-audio-20261108/启动虚拟扬声器测试.cmd`,使用独立配置与现有运行时供体。验收没有实际安装或移除系统驱动,故障采集卡的侦听转接和端到端听感仍需实卡复测。本轮在本地隔离分支交付。
+
+## 2026-11-09 虚拟扬声器离线安装
+
+在 `codex/virtual-capture-audio-20261108` 续作。Veyra 里显示「Veyra 虚拟扬声器」。Windows 继续注册 VB-Audio 原签名驱动的播放端点,使用说明提供从播放设备属性将 CABLE Input 改名为「Veyra 采集音频」的步骤。设备识别继续按适配器名称,音频选择仍按稳定端点 ID 保存。
+
+构建选项 `-DVEYRA_VB_CABLE_PACKAGE=E:/项目/Veyra/deps/vb-audio/pack46/VBCABLE_Driver_Pack46.zip` 将 SHA-256 固定的 1,324,680 字节原 ZIP 编入 `veyra_qml_ui.exe`。使用 [VB-Audio 原包](https://download.vb-audio.com/Download_CABLE/VBCABLE_Driver_Pack46.zip) 和厂商署名说明。正式和测试打包都沿用已编入资源的 EXE。纯源码构建可以留空此选项,此时没有离线安装包。应用内安装和卸载读取同一内置资源,确认前不会启动安装器,安装包不进入源码 Git。
+
+MSVC/CMake 使用共享构建目录按上述选项重新配置,再以 `--parallel 2 --target veyra_qml_ui` 构建成功。字节比对证实原 ZIP 在 EXE 中恰好出现一次且完整一致。真实 QML 验证离线资源可读、名称与说明、安装与卸载确认,以及取消无安装动作。多语言目录无缺失和占位符错误。日志 `E:/项目/Veyra/logs/offline-virtual-capture-audio-20261109`。本机入口 `E:/项目/Veyra/tests/offline-virtual-capture-audio-20261109/启动离线虚拟扬声器测试.cmd`。本轮未在系统安装驱动或修改 Windows 端点名称。
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 180c4778..3ccd26a2 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -617,11 +617,11 @@
"ja": "2 項目"
},
{
- "zh": "2. 回到 Veyra,在“音频监听”选“虚拟扬声器回录”,再连接采集。\n3. 在 Veyra 的音频设置中选真实耳机或音箱,可继续使用音画同步。",
+ "zh": "2. 回到 Veyra,在“音频监听”选“Veyra 虚拟扬声器”,再连接采集。音频输出选真实耳机或音箱,即可使用音画同步。\n\n可选改名:在 Windows 声音的“播放”页打开 CABLE Input 的属性,在“常规”里改成“Veyra 采集音频”。",
"src": "qml/CaptureSourceDialog.qml",
- "zh-TW": "2. 回到 Veyra,在“音訊監聽”選“虛擬揚聲器回錄”,再連接擷取。\n3. 在 Veyra 的音訊設定中選真實耳機或音箱,可繼續使用音畫同步。",
- "en": "2. In Veyra, select Virtual speaker loopback under Audio monitoring, then connect the capture card.\n3. Select your physical headphones or speakers in Veyra’s audio settings. Audio/video sync remains available.",
- "ja": "2. Veyra の「音声モニター」で「仮想スピーカーのループバック」を選んでから接続します。\n3. Veyra の音声設定で実際のヘッドホンまたはスピーカーを選びます。映像と音声の同期も利用できます。"
+ "zh-TW": "2. 回到 Veyra,在“音訊監聽”選“Veyra 虛擬揚聲器”,再連接擷取。音訊輸出選真實耳機或音箱,即可使用音畫同步。\n\n可選改名:在 Windows 聲音的“播放”頁開啟 CABLE Input 的屬性,在“常規”裡改成“Veyra 擷取音訊”。",
+ "en": "2. In Veyra, select Veyra Virtual Speaker under Audio monitoring, then connect the capture card. Select your physical headphones or speakers as the output to use audio/video sync.\n\nOptional rename: On the Playback tab in Windows Sound, open CABLE Input properties. On General, rename it to Veyra Capture Audio.",
+ "ja": "2. Veyra の「音声モニター」で「Veyra 仮想スピーカー」を選んでから接続します。出力先に実際のヘッドホンまたはスピーカーを選ぶと、映像と音声の同期を利用できます。\n\n名前を変更する場合は、Windows の「サウンド」の「再生」で CABLE Input のプロパティを開き、「全般」で Veyra キャプチャ音声に変更します。"
},
{
"zh": "203 = 中性;调高整体变亮,峰值不变",
@@ -2142,13 +2142,6 @@
"en": "UI correction · unverified",
"ja": "UI 補正 · 未検証"
},
- {
- "zh": "VB-Audio 安装包校验失败,请从官网获取",
- "src": "src/ui/bridge/VirtualCaptureAudioSetup.cpp",
- "zh-TW": "VB-Audio 安裝包校驗失敗,請從官網獲取",
- "en": "VB-Audio package verification failed. Get the package from the official website.",
- "ja": "VB-Audio パッケージの検証に失敗しました。公式サイトから入手してください。"
- },
{
"zh": "VB-Audio 安装器未完成操作(%1)",
"src": "src/ui/bridge/VirtualCaptureAudioSetup.cpp",
@@ -2233,6 +2226,27 @@
"en": "Veyra local diagnostics (redacted preview before copying; nothing is uploaded)\n",
"ja": "Veyra ローカル診断(コピー前に匿名化してプレビュー。アップロードはしません)\n"
},
+ {
+ "zh": "Veyra 虚拟扬声器",
+ "src": "qml/CaptureSourceDialog.qml",
+ "zh-TW": "Veyra 虛擬揚聲器",
+ "en": "Veyra Virtual Speaker",
+ "ja": "Veyra 仮想スピーカー"
+ },
+ {
+ "zh": "Veyra 虚拟扬声器 · %1",
+ "src": "src/ui/bridge/Capture.cpp",
+ "zh-TW": "Veyra 虛擬揚聲器 · %1",
+ "en": "Veyra Virtual Speaker · %1",
+ "ja": "Veyra 仮想スピーカー · %1"
+ },
+ {
+ "zh": "Veyra 虚拟扬声器使用说明",
+ "src": "qml/CaptureSourceDialog.qml",
+ "zh-TW": "Veyra 虛擬揚聲器使用說明",
+ "en": "Veyra Virtual Speaker instructions",
+ "ja": "Veyra 仮想スピーカーの使い方"
+ },
{
"zh": "Veyra 预设 (*.vpreset)",
"src": "src/ui/bridge/Preferences.cpp",
@@ -2765,13 +2779,6 @@
"en": "Download %1 MB/s",
"ja": "ダウンロード %1 MB/s"
},
- {
- "zh": "下载 VB-Audio 安装包失败,请检查网络后重试",
- "src": "src/ui/bridge/VirtualCaptureAudioSetup.cpp",
- "zh-TW": "下載 VB-Audio 安裝包失敗,請檢查網路後重試",
- "en": "Could not download the VB-Audio package. Check your connection and try again.",
- "ja": "VB-Audio パッケージをダウンロードできません。接続を確認して再試行してください。"
- },
{
"zh": "下载 —",
"src": "src/ui/bridge/Playback.cpp",
@@ -4313,6 +4320,13 @@
"en": "Built-in",
"ja": "内蔵"
},
+ {
+ "zh": "内置 VB-CABLE 安装包校验失败",
+ "src": "src/ui/bridge/VirtualCaptureAudioSetup.cpp",
+ "zh-TW": "內建 VB-CABLE 安裝包校驗失敗",
+ "en": "Bundled VB-CABLE package verification failed",
+ "ja": "同梱の VB-CABLE パッケージの検証に失敗しました"
+ },
{
"zh": "内置预设不能删除,可以另存一份",
"src": "src/ui/bridge/Chain.cpp",
@@ -4950,6 +4964,13 @@
"en": "Click the picture",
"ja": "映像をクリック"
},
+ {
+ "zh": "卸载 Veyra 虚拟扬声器",
+ "src": "qml/CaptureSourceDialog.qml",
+ "zh-TW": "解除安裝 Veyra 虛擬揚聲器",
+ "en": "Uninstall Veyra Virtual Speaker",
+ "ja": "Veyra 仮想スピーカーのアンインストール"
+ },
{
"zh": "卸载…",
"src": "qml/CaptureSourceDialog.qml",
@@ -4957,13 +4978,6 @@
"en": "Uninstall…",
"ja": "アンインストール…"
},
- {
- "zh": "卸载虚拟扬声器",
- "src": "qml/CaptureSourceDialog.qml",
- "zh-TW": "解除安裝虛擬揚聲器",
- "en": "Uninstall virtual speaker",
- "ja": "仮想スピーカーのアンインストール"
- },
{
"zh": "历史拒绝",
"src": "qml/AntiAliasEditor.qml",
@@ -6700,6 +6714,13 @@
"en": "Within range",
"ja": "範囲内"
},
+ {
+ "zh": "安装 Veyra 虚拟扬声器",
+ "src": "qml/CaptureSourceDialog.qml",
+ "zh-TW": "安裝 Veyra 虛擬揚聲器",
+ "en": "Install Veyra Virtual Speaker",
+ "ja": "Veyra 仮想スピーカーのインストール"
+ },
{
"zh": "安装…",
"src": "qml/CaptureSourceDialog.qml",
@@ -6714,13 +6735,6 @@
"en": "Setup closed. If installation or removal completed, follow VB-Audio’s instructions to restart Windows.",
"ja": "セットアップが終了しました。インストールまたは削除が完了した場合は、VB-Audio の指示に従って Windows を再起動してください。"
},
- {
- "zh": "安装虚拟扬声器",
- "src": "qml/CaptureSourceDialog.qml",
- "zh-TW": "安裝虛擬揚聲器",
- "en": "Install virtual speaker",
- "ja": "仮想スピーカーのインストール"
- },
{
"zh": "宋体",
"src": "qml/SubtitleSettingsDialog.qml",
@@ -12288,11 +12302,11 @@
"ja": "正常"
},
{
- "zh": "此功能使用 VB-Audio 的 VB-CABLE(捐赠软件)。首次安装需管理员确认,完成后按安装器提示重启。\n\n1. 在 Windows“录制”里打开采集卡音频的属性,在“侦听”中勾选“侦听此设备”,播放目标选 CABLE Input。",
+ "zh": "此功能使用 VB-Audio 的 VB-CABLE(捐赠软件),可从内置安装包离线安装。首次安装需管理员确认,完成后按提示重启。\n\n1. 在 Windows“录制”里打开采集卡音频的属性,勾选“侦听此设备”,播放目标选 CABLE Input。如果已改名,请选择改后的名称。",
"src": "qml/CaptureSourceDialog.qml",
- "zh-TW": "此功能使用 VB-Audio 的 VB-CABLE(捐贈軟體)。首次安裝需管理員確認,完成後按安裝器提示重啟。\n\n1. 在 Windows“錄制”裡開啟擷取卡音訊的屬性,在“偵聽”中勾選“偵聽此裝置”,播放目標選 CABLE Input。",
- "en": "This feature uses VB-CABLE by VB-Audio (donationware). First-time installation requires administrator approval. Restart Windows if prompted.\n\n1. In Windows Recording settings, open the capture card’s audio properties. On Listen, enable Listen to this device and set the playback target to CABLE Input.",
- "ja": "この機能は VB-Audio の VB-CABLE(ドネーションウェア)を使用します。初回は管理者の承認が必要です。指示に従って Windows を再起動してください。\n\n1. Windows の「録音」でキャプチャカードの音声プロパティを開き、「聴く」で「このデバイスを聴く」を有効にして再生先を CABLE Input にします。"
+ "zh-TW": "此功能使用 VB-Audio 的 VB-CABLE(捐贈軟體),可從內建安裝包離線安裝。首次安裝需管理員確認,完成後按提示重啟。\n\n1. 在 Windows“錄制”裡開啟擷取卡音訊的屬性,勾選“偵聽此裝置”,播放目標選 CABLE Input。如果已改名,請選擇改後的名稱。",
+ "en": "This feature uses VB-CABLE by VB-Audio (donationware). Install it offline from the bundled package. First-time installation requires administrator approval. Restart Windows if prompted.\n\n1. In Windows Recording settings, open the capture card’s audio properties, enable Listen to this device, and select CABLE Input. If you renamed it, select the new name.",
+ "ja": "この機能は VB-Audio の VB-CABLE(ドネーションウェア)を使用します。同梱のパッケージからオフラインでインストールできます。初回は管理者の承認が必要です。指示に従って Windows を再起動してください。\n\n1. Windows の「録音」でキャプチャカードの音声プロパティを開き、「このデバイスを聴く」を有効にして再生先を CABLE Input にします。名前を変更した場合は新しい名前を選びます。"
},
{
"zh": "此显卡最多支持 {}X 帧生成;请求未应用",
@@ -12301,6 +12315,13 @@
"en": "This GPU supports up to {}X frame generation; request not applied",
"ja": "この GPU のフレーム生成は最大 {}X です。要求は適用されていません"
},
+ {
+ "zh": "此构建未内置 VB-CABLE 安装包",
+ "src": "src/ui/bridge/VirtualCaptureAudioSetup.cpp",
+ "zh-TW": "此構建未內建 VB-CABLE 安裝包",
+ "en": "This build does not include the VB-CABLE setup package",
+ "ja": "このビルドには VB-CABLE のセットアップパッケージが同梱されていません"
+ },
{
"zh": "此版本不含 PC 串流",
"src": "src/ui/bridge/View.cpp",
@@ -15157,27 +15178,6 @@
"en": "Blue: original restore area; magenta: smoothing area. Turned off automatically for export",
"ja": "青はオリジナル保護の範囲、マゼンタは美肌の範囲です。書き出し時は自動でオフになります"
},
- {
- "zh": "虚拟扬声器",
- "src": "qml/CaptureSourceDialog.qml",
- "zh-TW": "虛擬揚聲器",
- "en": "Virtual speaker",
- "ja": "仮想スピーカー"
- },
- {
- "zh": "虚拟扬声器使用说明",
- "src": "qml/CaptureSourceDialog.qml",
- "zh-TW": "虛擬揚聲器使用說明",
- "en": "Virtual speaker instructions",
- "ja": "仮想スピーカーの使い方"
- },
- {
- "zh": "虚拟扬声器回录 · %1",
- "src": "src/ui/bridge/Capture.cpp",
- "zh-TW": "虛擬揚聲器回錄 · %1",
- "en": "Virtual speaker loopback · %1",
- "ja": "仮想スピーカーのループバック · %1"
- },
{
"zh": "虚拟扬声器回录需要将音频输出设为真实耳机或音箱",
"src": "src/sink/CaptureAudioSession.cpp",
diff --git a/qml/Veyra/CaptureSourceDialog.qml b/qml/Veyra/CaptureSourceDialog.qml
index a5c53ea2..c85d89ee 100644
--- a/qml/Veyra/CaptureSourceDialog.qml
+++ b/qml/Veyra/CaptureSourceDialog.qml
@@ -307,7 +307,7 @@ DialogLayer {
}
}
VRow {
- label: qsTr("虚拟扬声器")
+ label: qsTr("Veyra 虚拟扬声器")
hint: veyra.captureVirtualAudioBusy ? qsTr("正在处理 VB-CABLE 安装器…")
: veyra.captureVirtualAudioInstalled ? qsTr("已检测到 VB-CABLE · 用于转接 Windows 侦听")
: qsTr("可选 · 采集卡直采无声时使用")
@@ -347,11 +347,11 @@ DialogLayer {
cardWidth: 510
property int operation: 0
function showFor(value) { operation = value; open() }
- title: operation === 2 ? qsTr("卸载虚拟扬声器")
- : operation === 1 ? qsTr("安装虚拟扬声器") : qsTr("虚拟扬声器使用说明")
+ title: operation === 2 ? qsTr("卸载 Veyra 虚拟扬声器")
+ : operation === 1 ? qsTr("安装 Veyra 虚拟扬声器") : qsTr("Veyra 虚拟扬声器使用说明")
text: operation === 2
? qsTr("先在 Windows 中关闭采集卡的“侦听此设备”,或把目标改回原设备。确认后打开 VB-Audio 安装器,选择 Remove Driver 并按提示重启。其他使用 VB-CABLE 的软件也会失去这条音频通路。")
- : qsTr("此功能使用 VB-Audio 的 VB-CABLE(捐赠软件)。首次安装需管理员确认,完成后按安装器提示重启。\n\n1. 在 Windows“录制”里打开采集卡音频的属性,在“侦听”中勾选“侦听此设备”,播放目标选 CABLE Input。")
+ : qsTr("此功能使用 VB-Audio 的 VB-CABLE(捐赠软件),可从内置安装包离线安装。首次安装需管理员确认,完成后按提示重启。\n\n1. 在 Windows“录制”里打开采集卡音频的属性,勾选“侦听此设备”,播放目标选 CABLE Input。如果已改名,请选择改后的名称。")
acceptText: operation === 2 ? qsTr("确认卸载") : operation === 1 ? qsTr("确认安装") : qsTr("完成")
onAccepted: { if (operation !== 0) veyra.setupCaptureVirtualAudio(operation === 2) }
Connections {
@@ -376,7 +376,7 @@ DialogLayer {
objectName: "capture-virtual-audio-follow-up"
visible: virtualAudioGuide.operation !== 2
Layout.fillWidth: true
- text: qsTr("2. 回到 Veyra,在“音频监听”选“虚拟扬声器回录”,再连接采集。\n3. 在 Veyra 的音频设置中选真实耳机或音箱,可继续使用音画同步。")
+ text: qsTr("2. 回到 Veyra,在“音频监听”选“Veyra 虚拟扬声器”,再连接采集。音频输出选真实耳机或音箱,即可使用音画同步。\n\n可选改名:在 Windows 声音的“播放”页打开 CABLE Input 的属性,在“常规”里改成“Veyra 采集音频”。")
color: Theme.t2
font.family: Theme.fontUi
font.pixelSize: Theme.fsBody
diff --git a/src/ui/bridge/Capture.cpp b/src/ui/bridge/Capture.cpp
index bb8e275a..daac3881 100644
--- a/src/ui/bridge/Capture.cpp
+++ b/src/ui/bridge/Capture.cpp
@@ -196,7 +196,7 @@ QVariantList QmlPlayerBridge::captureAudioInputs() const {
{"label", d.hasEmbeddedAudio ? tr("视频设备内置音频(已检测)") : tr("尝试视频设备内置音频")}};
for (size_t i = 0; i < impl_->captureAudio.size(); ++i) {
const auto& device = impl_->captureAudio[i];
- const auto label = device.virtualSpeaker ? tr("虚拟扬声器回录 · %1").arg(utf8Of(device.name))
+ const auto label = device.virtualSpeaker ? tr("Veyra 虚拟扬声器 · %1").arg(utf8Of(device.name))
: QStringLiteral("[%1] %2").arg(device.wasapi ? QStringLiteral("WASAPI") : QStringLiteral("DirectShow"), utf8Of(device.name));
out << QVariantMap{{"id", int(i)}, {"label", label}};
}
diff --git a/src/ui/bridge/VirtualCaptureAudioSetup.cpp b/src/ui/bridge/VirtualCaptureAudioSetup.cpp
index c96a3e53..35b3815e 100644
--- a/src/ui/bridge/VirtualCaptureAudioSetup.cpp
+++ b/src/ui/bridge/VirtualCaptureAudioSetup.cpp
@@ -3,15 +3,13 @@
#include <QCryptographicHash>
#include <QDir>
#include <QFile>
-#include <QNetworkReply>
-#include <QNetworkRequest>
#include <windows.h>
#include <shellapi.h>
namespace veyra::ui {
namespace {
-constexpr qsizetype downloadLimit = 2 * 1024 * 1024;
-constexpr auto packageUrl = "https://download.vb-audio.com/Download_CABLE/VBCABLE_Driver_Pack46.zip";
+constexpr qsizetype packageLimit = 2 * 1024 * 1024;
+constexpr auto packageResource = ":/optional-drivers/VBCABLE_Driver_Pack46.zip";
constexpr auto packageHash = "bc44e8974191a5a2427d6c979e2dab08dbb09925f3f435dfa2f0ba3e45b6eb90";
constexpr auto installerHash = "734c35dfa6d98f48782a451633ceb471166ec70d60482fd89a1123d0ee3c4f41";
@@ -25,8 +23,7 @@ QString systemProgram(const QString& name) {
VirtualCaptureAudioSetup::VirtualCaptureAudioSetup(QObject* parent) : QObject(parent) {
deadline_.setSingleShot(true);
connect(&deadline_, &QTimer::timeout, this, [this] {
- if (reply_) reply_->abort();
- else if (extractor_.state() != QProcess::NotRunning) extractor_.kill();
+ if (extractor_.state() != QProcess::NotRunning) extractor_.kill();
});
connect(&extractor_, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) {
if (error == QProcess::FailedToStart)
@@ -51,10 +48,6 @@ VirtualCaptureAudioSetup::VirtualCaptureAudioSetup(QObject* parent) : QObject(pa
}
VirtualCaptureAudioSetup::~VirtualCaptureAudioSetup() {
- if (reply_) {
- reply_->disconnect(this);
- reply_->abort();
- }
extractor_.disconnect(this);
if (extractor_.state() != QProcess::NotRunning) {
extractor_.kill();
@@ -71,6 +64,16 @@ VirtualCaptureAudioSetup::~VirtualCaptureAudioSetup() {
void VirtualCaptureAudioSetup::start(const QString& dataDirectory) {
if (busy()) return;
+ QFile package(QString::fromLatin1(packageResource));
+ if (!package.open(QIODevice::ReadOnly)) {
+ emit completed(tr("此构建未内置 VB-CABLE 安装包"), true);
+ return;
+ }
+ const auto bytes = package.read(packageLimit + 1);
+ if (QCryptographicHash::hash(bytes, QCryptographicHash::Sha256).toHex() != packageHash) {
+ emit completed(tr("内置 VB-CABLE 安装包校验失败"), true);
+ return;
+ }
if (!QDir().mkpath(dataDirectory)) {
emit completed(tr("无法创建虚拟扬声器安装目录"), true);
return;
@@ -80,46 +83,14 @@ void VirtualCaptureAudioSetup::start(const QString& dataDirectory) {
finish(tr("无法创建虚拟扬声器安装目录"), true);
return;
}
- QNetworkRequest request{QUrl(QString::fromLatin1(packageUrl))};
- request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
- request.setRawHeader("User-Agent", "Veyra-Virtual-Audio-Setup");
- reply_ = network_.get(request);
- reply_->setReadBufferSize(downloadLimit + 1);
- connect(reply_, &QIODevice::readyRead, this, [this] {
- download_ += reply_->read(downloadLimit + 1 - download_.size());
- if (download_.size() > downloadLimit) reply_->abort();
- });
- connect(reply_, &QNetworkReply::finished, this, &VirtualCaptureAudioSetup::downloadFinished);
- deadline_.start(30000);
- emit busyChanged();
-}
-
-void VirtualCaptureAudioSetup::downloadFinished() {
- deadline_.stop();
- auto* reply = reply_;
- reply_ = nullptr;
- if (reply->isOpen() && download_.size() <= downloadLimit)
- download_ += reply->read(downloadLimit + 1 - download_.size());
- const bool ok = reply->error() == QNetworkReply::NoError &&
- reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200;
- reply->deleteLater();
- if (!ok) {
- finish(tr("下载 VB-Audio 安装包失败,请检查网络后重试"), true);
- return;
- }
- if (QCryptographicHash::hash(download_, QCryptographicHash::Sha256).toHex() != packageHash) {
- finish(tr("VB-Audio 安装包校验失败,请从官网获取"), true);
- return;
- }
const auto archive = staging_->filePath(QStringLiteral("driver.zip"));
QFile file(archive);
- if (!file.open(QIODevice::WriteOnly) || file.write(download_) != download_.size() || !file.flush()) {
+ if (!file.open(QIODevice::WriteOnly) || file.write(bytes) != bytes.size() || !file.flush()) {
file.close();
finish(tr("无法保存虚拟扬声器安装包"), true);
return;
}
file.close();
- download_.clear();
const auto tar = systemProgram(QStringLiteral("tar.exe"));
if (tar.isEmpty()) {
finish(tr("找不到 Windows 解压工具"), true);
@@ -127,6 +98,7 @@ void VirtualCaptureAudioSetup::downloadFinished() {
}
deadline_.start(15000);
extractor_.start(tar, {QStringLiteral("-xf"), archive, QStringLiteral("-C"), staging_->path()});
+ if (busy()) emit busyChanged();
}
void VirtualCaptureAudioSetup::launchInstaller() {
@@ -162,7 +134,6 @@ void VirtualCaptureAudioSetup::launchInstaller() {
void VirtualCaptureAudioSetup::finish(const QString& message, bool warning) {
deadline_.stop();
- download_.clear();
staging_.reset();
emit busyChanged();
emit completed(message, warning);
diff --git a/src/ui/bridge/VirtualCaptureAudioSetup.h b/src/ui/bridge/VirtualCaptureAudioSetup.h
index 175b93dc..135895aa 100644
--- a/src/ui/bridge/VirtualCaptureAudioSetup.h
+++ b/src/ui/bridge/VirtualCaptureAudioSetup.h
@@ -1,6 +1,5 @@
#pragma once
-#include <QNetworkAccessManager>
#include <QObject>
#include <QProcess>
#include <QTemporaryDir>
@@ -22,13 +21,9 @@ signals:
void busyChanged();
void completed(const QString& message, bool warning);
private:
- void downloadFinished();
void launchInstaller();
void finish(const QString& message, bool warning);
- QNetworkAccessManager network_;
- QNetworkReply* reply_ = nullptr;
- QByteArray download_;
QProcess extractor_;
QTimer deadline_;
QWinEventNotifier installer_;