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++

fix: smooth playback UI, custom rates, subtitle text and fullscreen restore

Veyra Goal Agente6aa7839b28a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 947e549d..0dd4e9f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -643,6 +643,10 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
add_executable(veyra_repair_contract_tests tests/unit/RepairContractTests.cpp)
add_executable(veyra_subtitle_loading_tests tests/integration/SubtitleLoadingTests.cpp)
+ add_executable(veyra_subtitle_text_tests tests/integration/SubtitleTextTests.cpp)
+ target_compile_features(veyra_subtitle_text_tests PRIVATE cxx_std_20)
+ target_compile_options(veyra_subtitle_text_tests PRIVATE /utf-8)
+ target_link_libraries(veyra_subtitle_text_tests PRIVATE veyra_engine)
add_executable(veyra_screenshot_combination_tests tests/integration/ScreenshotCombinationTests.cpp)
target_link_libraries(veyra_screenshot_combination_tests PRIVATE veyra_engine)
target_compile_features(veyra_screenshot_combination_tests PRIVATE cxx_std_20)
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index e3444f6e..dd1948e6 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -814,6 +814,21 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin
});
}
+ // Focus changes are diagnostic only: they never pause playback, change the
+ // selected effects, or reduce submission cadence. Keep the actual throughput
+ // and Windows process throttle state alongside field reports of background lag.
+ QObject::connect(window, &QWindow::activeChanged, &app, [window, &controller] {
+ const auto s=controller.snapshot();
+ PROCESS_POWER_THROTTLING_STATE throttle{};
+ throttle.Version=PROCESS_POWER_THROTTLING_CURRENT_VERSION;
+ const bool known=GetProcessInformation(GetCurrentProcess(),ProcessPowerThrottling,&throttle,sizeof(throttle));
+ const DWORD error=known?0:GetLastError();
+ veyra::log::info("app-focus",std::format(
+ "active={} running={} transport={} sourceFps={:.2f} submitFps={:.2f} nr={} sr={} fg={} powerKnown={} control=0x{:X} state=0x{:X} err={}",
+ window->isActive(),s.running,int(s.transport),s.nominalSourceFps,s.submissionFps.value_or(-1),
+ s.nrActive,s.srActive,s.fgActive,known,throttle.ControlMask,throttle.StateMask,error));
+ });
+
// Reparent the native window under the QML window and keep it in step. The
// host item is looked up by objectName so the QML side owns the layout and
// this side only follows it.
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md
index 762f1a73..9976e20c 100644
--- a/docs/CURRENT_STATUS.md
+++ b/docs/CURRENT_STATUS.md
@@ -1,5 +1,13 @@
# 当前项目状态 / Current Status
+## 2026-10-04 倍速、字幕、UI 热路径与专业布局修复(本地)
+
+隔离分支 `codex/playback-smoothness-20261004` 沿用此前本地 RTSS 修复:自定义文件倍速 0.25~4.00(两位小数、保音调);内嵌字幕按 FFmpeg ASS rectangle 的固定八字段头部解析,正文逗号/多行保留,并修复 VTT CRLF。能力查询缓存并拆分通知,稳定播放不再反复查磁盘/重建效果菜单;保留组件替换发现和统一灰色入口。
+专业模式输入信息只放顶部,输出分辨率紧邻;底部移除重复标签,窄窗口进度与按钮分行。倍速菜单的窗口 mask、上方边界、提示覆盖与非激活浮条输入焦点已修复。实际发现并修复最大化→全屏→退出丢失最大化状态;普通窗口尺寸、全屏控制条隐藏/菜单保留/锁定回归通过。
+产品 Release 构建成功;音频18组、外置/内嵌5字幕轨30作者cue、三行overlay、硬件能力56组及真实Qt倍速/菜单/720–1600宽度回归通过。组件临时缺失/恢复时灰色菜单更新通过,原运行库字节恢复。本机RTX5070/616.56:软件UI后台DLSS6X提交180fps、16ms Timer采样中位16ms(旧2.0.3约41.5ms);VFG4X中位115提交fps,不保证120。
+**严重后台掉帧仍未复现、根因未确认。** 原始前后台样本不支持宣称因失焦大幅下降;PresentMon ETW采集被Windows权限拒绝,未取得显示事件,软件提交FPS不能冒充实屏结果。增加焦点/实际吞吐/进程节流状态日志,未改驱动/系统调度设置,未新增AMD实卡验收。所有11条非PR Issue及评论重新核对,未找到单独全屏故障描述,具体编号/现象待用户补充。
+本地完整NVIDIA候选将在 `E:/项目/Veyra/test-packages/playback-smoothness-20261004/` 封存;产品显示 `2.0.3-smoothfix`,源码/逐文件manifest/验收索引独立。未合入main或替换GitHub2.0.3,桌面原修改保留。方案、命令和失败修正见 WORKLOG 与 PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md。
+
## 2026-10-04 RTSS 现场误提示与重启循环已修复(本地)
隔离分支 codex/rtss-restart-loop-20261004:查明并停止Agent旧测试遗漏的RTSS加载器;软件判活增加RTSS.exe存活条件,过滤孤立hook/残留映射。接受兼容重启携带本次启动意图,避免重复弹窗;用户关闭/强制渲染器/OBS选择保持。
diff --git a/docs/PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md b/docs/PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md
new file mode 100644
index 00000000..8dc3adb7
--- /dev/null
+++ b/docs/PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md
@@ -0,0 +1,33 @@
+# 自定义倍速、字幕与 2.0.3 流畅度修复
+
+用户于 2026-10-04 要求:增加自定义播放倍速;修复 Issue #18 的内嵌 SRT 逗号截断及多行丢失;排查并修复 2.0.3 相比 2.0.2 的 UI/播放卡顿,以及失去前台焦点后严重掉帧。先存档、写方案、创建分支,再修改产品。
+
+## 存档、范围与授权
+
+- 基线 `fb8e5001a7ba8424aeddda002d9ca19a79e68f2f`,包含此前已实测的本地 RTSS 误报/重启循环修复;正式 2.0.3 为 `f82f6499ff0db9c36953bcafb752b9be2d7fca4d`。本轮不能把本地修复写成已公开发布。
+- 工作区 `E:/项目/Veyra/worktrees/field-upgrade-20261003`,分支 `codex/playback-smoothness-20261004`,开工标签 `checkpoint/pre-playback-smoothness-20261004`。
+- 存档 `E:/项目/Veyra/archives/playback-smoothness-20261004/source-before.bundle` 已 verify,SHA256 `7902EE2EB74629F7A642FD7FBFB7936DD1747827683184E9A49ED0B2D4C8AF26`。该目录另保存两个工作区开工 status;桌面 64 项用户修改保留。
+- 当前请求授权这些功能必要的 QML/bridge/字幕解析与字幕共享 overlay、播放/音频倍速、UI 热路径、Windows 计时/线程调度/呈现接点和针对性测试/CMake。本授权覆盖这些接点的历史 UI-only 冻结;只修本次问题,不扩改 NR/颜色/导出算法,不接入 HDR/Dolby PR,不派子 Agent,不 merge/push/Release/关机。
+- 所有新产物使用 `E:/项目/Veyra/{archives,build,tests,logs,tmp,test-packages}/playback-smoothness-20261004`;测试进程最多 300 秒、构建最多 900 秒,TEMP/TMP 仅子进程。现有 SDK/runtime/model/patched FFmpeg 身份和源码隔离保持。
+
+## 实施顺序
+
+1. **先测回归**:同机、同素材、同效果、独立 profile 对照正式 2.0.2/2.0.3 与当前候选。记录实际 UI Timer 延迟、主线程热点、CPU/GPU 处理/提交帧率、过期帧、可见/最小化/失去焦点等状态。实际切换到另一窗口验证,失焦不等同最小化。不因等待变慢就伪造高 FPS 或关闭增强。
+2. **自定义倍速**:共用播放速度按钮增加“自定义…”入口及数值弹窗,保留原四档;接受 0.25–4.00 倍的有限数值,小数支持 1.3/1.8。UI、引擎和音频层共用同一范围判断。仅文件预览变速,源 PTS 坐标、保音调音频、seek/reset 和导出不变;非法值明确拒绝,显示实际生效值。
+3. **字幕**:构造包含正文逗号、2/3 行、空行、UTF-8 中文和 ASS 样式的外置/内嵌字幕夹具,先留下当前失败证据。按真实 FFmpeg AVSubtitle 形态分离头部与正文,不再扫描正文逗号;多行丢失根据实际解码/清洗/overlay 文本定位。回归 SRT/ASS/SSA/WebVTT、主副字幕、时间与 seek,不用绕开逗号或压成单行掩盖缺陷。
+4. **流畅度修复**:对照 v2.0.2→v2.0.3 的变化定位热点,优先移除 UI 高频同步系统/磁盘查询和重复重建;核对 RTSS 软件 UI 与渲染覆盖范围。针对可见后台播放验证 Windows timer/调度/呈现状态。每项修复先有证据,保留合理的不可见/最小化节能行为,不全局改系统/驱动设置,也不以强制高进程优先级掩盖锁竞争。
+5. **构建与交付**:真实产品构建、必要 CPU/Qt/音频/字幕回归和前后台 GPU 播放对比通过后制作本地完整 NVIDIA 候选,遵守显卡分包规则及独立 manifest;未进行的 AMD/主机/驱动/实屏延迟验收如实列出。
+
+## 完成门槛与记录
+
+自定义输入在极简/专业两处真实生效,非法/取消保持原值;内嵌字幕示例完整出现在真实 overlay;实际可见后台播放没有由失焦触发的大幅吞吐下降;同设置 UI/视频表现与 2.0.2 基线对照,报告采样窗口和实测分位值。算力不足的高档仍如实显示实际吞吐,不能保证任意硬件/效果达到任意刷新率。所有失败、修复、命令和证据追加到本方案及 WORKLOG;发布仍待用户新指令。
+
+2026-10-04 用户追加截图“ui遮挡”:极简浮动条打开倍速菜单仍有“播放速度”提示盖住菜单。代码还确认 CineBar.menuOpen 没包含倍速菜单,导致 FullscreenBar 的本地窗口 mask 仍只覆盖控制条/提示带;倍速菜单也未使用该条统一的上方边界。增加倍速弹窗状态、统一菜单边界并在弹窗期间隐藏提示。自定义输入使用 Qt 6.8 已支持的 Popup.Window,避免非激活浮动窗口阻止键盘输入及 mask 裁剪。该追加授权只扩展共享 CineBar 接点,不改整体界面。
+
+当前状态:功能代码与 UI 热路径修复已构建;真实内嵌/外置字幕 5 条轨道、音频 18 组及真实 PTS 倍速回归已通过。原始 UI 基线与候选对照确认缓存/选择通知改动有效。后台掉帧仍未复现,不能宣称已找到根因或根治;继续针对性测试和诊断。用户 Esc 停止电脑自动操作后,不再自动点击窗口。
+
+2026-10-04 用户追加专业模式布局与全屏排查:底部删除重复的源格式,输出分辨率只在顶部源格式旁显示,进度条保留连续可拖动空间;窄窗口顶部必要时分两行,不能通过遮挡按钮凑宽度。本次只扩展 ProPage 的信息布局接点。重新读取仓库所有 11 条非 PR Issue 和评论:#12 是极简控制条/鼠标/窗口尺寸/下拉宽度建议,未找到单独全屏故障复现描述,已询问用户具体编号/现象。先做真实 Qt 产品窗口全屏进入/退出、控制条隐藏/菜单保留、锁定与窗口尺寸恢复回归,不凭不存在的 Issue 宣称已修复全屏问题。
+
+产品全屏/布局回归 layout-fullscreen-v1 实际发现:最大化→全屏→退出错误恢复到普通窗口;720px 专业窗口的底部 seek 宽度为 0。扩展 Main.qml 的全屏状态保存/恢复接点;ProPage 的窄底栏分为进度与操作两行。失败原始日志保留,以同一产品测试重跑确认。
+
+收尾证据:最终native-tests.json全部exit0;组件临时缺失/恢复真实QML灰色菜单通过、字节原样恢复。动作会强制刷新缓存,所以2s计时器比较“上次报告给QML”的值,避免漏通知。软件UI后台DLSS6X 16ms Timer采样中位16/p95 23、180提交fps;VFG4X中档中位115提交fps/Timer16ms,不称恒定120。PresentMon ETW针对自有PID的采集被本机权限拒绝(exit6/0rows),没有提权或改系统;严重后台掉帧的根因仍待现场复现。功能/布局回归和干净本地包按最终构建再确认,交付索引存test-packages/task/DELIVERY.json。
diff --git a/docs/SUBTITLE_ENGINE_2026-09-16.md b/docs/SUBTITLE_ENGINE_2026-09-16.md
index 944d2ddf..32d53d24 100644
--- a/docs/SUBTITLE_ENGINE_2026-09-16.md
+++ b/docs/SUBTITLE_ENGINE_2026-09-16.md
@@ -14,9 +14,12 @@
粗斜体、描边、阴影、对齐、边距)、`[Events]`(时间、样式索引、`\N`/`\n` 换行、
`{\...}` 覆盖块剥离、`\an` 与 `\pos` 提取)。注释行(`Comment:`)跳过。
- **内嵌字幕轨**(Matroska/MP4…):`loadEmbeddedSubtitleTracks()` 用 FFmpeg 逐轨解码
- (subrip/ass/ssa/mov_text/webvtt)。实测 FFmpeg 在 Matroska 里给的是
- `Layer,0,Style,Name,ML,MR,MV,Effect,Text` 形态(时间在 block 上),也兼容标准 ASS rect
- 形态——两种前缀都会被正确剥离,且不会吃掉字幕正文里的逗号。
+ (subrip/ass/ssa/mov_text/webvtt)。2026-10-04 修正旧记录:FFmpeg 的 `AVSubtitleRect.ass`
+ 是 `ReadOrder,Layer,Style,Name,ML,MR,MV,Effect,Text`,固定八个头部分隔符;旧实现把
+ 正文逗号继续当头部分隔符,Issue #18 的逗号截断/多行丢失确实存在。现在只剥离
+ ASS rectangle 的八字段头部,plain text 不剥头,正文逗号及换行保留。五条真实
+ 外置/内嵌 SRT/ASS/VTT 轨道的 30 个作者 cue 逐字及时间比对通过,三行 overlay
+ 栅格/实际播放器字幕通过;证据见 PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md。
图形字幕(PGS/DVB)本构建**没有解码器**:轨道照样列出并标注"不支持",不静默消失。
- **索引查找**:`rebuildIndex()` 建立按开始时间排序的数组,`cuesAt()` 二分 + 回扫,
取代原来的"每帧线性扫描全部 cue"(长字幕文件不再白烧 CPU);同一时刻多条 cue
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index e719104d..b610d8cb 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,19 @@
# Veyra 工作记录
+## 2026-10-04 自定义倍速、字幕、UI流畅度与专业布局/全屏恢复
+
+- 用户要求自定义倍速、修复#18、排查2.0.3相比2.0.2的UI卡顿与失焦掉帧,后追加倍速菜单遮挡、专业重复输入/输出标签及全屏检查。先从fb8e500开codex/playback-smoothness-20261004,checkpoint/pre-playback-smoothness-20261004;source-before.bundle verify/SHA7902EE2E…AF26,archive保存桌面/隔离区初始status。桌面64项修改不动,main仍354b1c6;当前只本地修复与包,无merge/push/Release/关机,无子Agent。方案 PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md,独立scope guard保护本轮接点。
+- 真实复现字幕:subtitle-before原外置SRT/ASS通过,VTT CRLF与两内嵌轨正文失败;旧stripDialoguePrefix继续扫描正文逗号,吞掉前句/多行。改为只对AVSubtitleRect.ass消费八头部分隔符,plain text原样,不压成一行;VTT去行末CR。`playback-smoothness-fixtures.py`造6作者cue(英中/多逗号/2–3行)+两内嵌轨;`playback-smoothness-tests.py`最终audio-rates-v3 18/18、subtitle-after-v2 5轨30cue逐字/时间、overlay-v3三行栅格/cache/style、i18n-v2、availability-v1 56/0均exit0。实际产品暂停seek9.5s输出完整三行正文。
+- 倍速两处共享0.25–4.00有限值判断,原1/1.5/2/3保留,加自定义两位小数窗口;实际PTS速度1.3/1.8/0.25/4/1,非法4.01/NaN及取消保持原值。声音18组测完整输出时长/PTS/连续性/0overrun,440Hz中段保音调;初次0.25测试把SoundTouch头尾静音计入零交叉造成436.7Hz误判,修正测量窗口且保留全时长断言,原audio-rates-v1失败日志保留。不能将它当产品音调错误。
+- UI热路径证据:2.0.2已有snapshot→fgChoices通知;2.0.3新增能力表/文件查询消费这个逐帧信号,造成反复磁盘探测/嵌套map/菜单重建。现改缓存+2s/操作/语言刷新,能力专用NOTIFY,FG ceiling/provider实际改变才通知。收尾修正动作先刷新缓存可能漏通知的边界:计时器比较上次报告map。`playback-smoothness-capability.py`在自己的stage移走/恢复未启用VFG组件,真实QML灰色菜单变更通过,DLL SHA270cf4…a795保持,原正式文件不动。
+- `playback-smoothness-baseline.py`独立profile同2K30对照:Timer16ms中位,2.0.2无效果后台16ms,旧2.0.3无效果后半段与初次编译重叠,不能公平引用最坏延迟。稳定候选无效果16ms;旧2.0.3软件UI DLSS6X后台p50 41.5/p95 60、180提交fps;候选软件UI p50 16/p95 23、180提交fps,稳定fgChoices通知0。候选GPU DLSS6X实际前/后台180,覆盖窗口最大化遮盖短测也保持;VFG4X中档后台p50 16/p95 22,中位115提交fps,有真实过期生成帧,不能说稳定120/240。12–140秒窗口(75秒样本止于75),计数/状态/原始日志见acceptance-summary.json,不将Timer间隔当渲染FPS。
+- 后台严重掉帧尚未复现;原始NR+RTX4K+DLSS2、DLSS6、软件UI前后台不能确认失焦根因,热初始化/少量前台样本需区分。Engine已有MMCSS与高精度等待,无盲目提高全局优先级/修改NVIDIA配置。main.cpp只增加app-focus事件的实际吞吐/效果和GetProcessInformation节流mask。`playback-smoothness-presentmon.py`仅过滤自己的PID且禁输入采集,PresentMon2.3.1 SHA364e5d…d30c,exit6/access denied/0rows,player正常exit0;不提权/改用户组/停止他人ETW会话,显示事件与物理延迟未测。
+- 用户Esc停止电脑自动操作之后不再调用Computer Use、不再自动点击窗口;后续Qt产品自测通过API检查自己的窗口。原先实际前后台点击证据保留,未将Qt自测冒充物理键鼠验收。GitHub所有11非PR Issues和各评论读回,#12是极简控制条/鼠标/尺寸/dropdown提议,未发现独立全屏故障描述;用户补充编号/症状问题保持待答,日志issues-fullscreen-audit.json。未发送GitHub评论/关Issue。
+- 专业模式重复底部源标签删除、输出badge移到顶部源格式旁(仍为只读实际输出),窄顶部两行,窄底栏进度/按钮两行。真实Qt 1280宽seek507px、720宽172px、1600宽827px;1280顶部32高、720顶部72高,输入输出相邻/按钮不越界。倍速菜单打开期间提示隐藏、CineBar计入menuOpen,浮条mask532px/菜单209..424px,关闭92px;Popup.Window+Basic.TextField真正取得焦点并应用1.3。先前native-style自定义警告已改Basic解决。
+- layout-fullscreen-v1实际失败:退出全屏丢失原最大化状态,720专业seek0;修复保存Windowed/Maximized并恢复、窄栏分行,v2/v3普通1280×800/最大化恢复、全屏整屏/自动隐藏/菜单保持/锁定退出通过(shell MarkFullscreenWindow hr0)。相关Main/Pro/CineBar接点扩展已先写guard/方案,不扩HDR/Dolby或NR/颜色算法。
+- 构建命令 `py -3.11 -B scripts/acceptance/playback-smoothness-build.py repair-build-v10.log veyra_qml_ui` exit0,沿用发布SDK/Qt6.8.3/patched FFmpeg配置,输出E盘、显示2.0.3-smoothfix。v5曾错误捕获QQmlApplicationEngine并调用snapshot,改捕获controller后v6通过;v7测试target拼错,v8用veyra_ui_i18n_tests通过;原失败构建日志不删除。extract.py --check缺翻译0/placeholder0,仅新增7条翻译。最终产品功能与全屏回归再次检查新bridge,随后封存候选。
+- 全部产物 E:/项目/Veyra/{archives,build,tests,logs,tmp,test-packages}/playback-smoothness-20261004;测试每进程≤300s、构建≤900s,TEMP/TMP只子进程。新运行组件/SDK/模型未入源码Git。本地候选目录/应用源码ZIP/patch及最终审计回执后续追加,不能把后台根因或未做实卡验收写成完成。
+
## 2026-10-04 RTSS 误提示、重启循环与真实安装参数验收
- 用户反馈已发布 NVIDIA2.0.3 未开小飞机仍反复要求重启,并提供 E:/App/RivaTuner Statistics Server 要求真实启动/多参数测试。先从 main354b1c6 开 codex/rtss-restart-loop-20261004,checkpoint/pre-rtss-restart-loop-20261004,外部 source-before.bundle verify/SHA08679242…dd2;不改桌面旧工作树、原正式包、main 或用户 profile。方案 RTSS_RESTART_LOOP_PLAN_2026-10-04.md。
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 90aa0736..5b26814f 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -13518,6 +13518,55 @@
"zh-TW": ";本次匯出使用 AMD FSR 超解析",
"en": "; this export uses AMD FSR super resolution",
"ja": ";今回の書き出しは AMD FSR 超解像を使用します"
+ },
+ {
+ "zh": "自定义…",
+ "src": "qml/Veyra/PlaybackRateButton.qml",
+ "zh-TW": "自訂…",
+ "en": "Custom…",
+ "ja": "カスタム…"
+ },
+ {
+ "zh": "自定义播放速度",
+ "src": "qml/Veyra/PlaybackRateDialog.qml",
+ "zh-TW": "自訂播放速度",
+ "en": "Custom playback speed",
+ "ja": "カスタム再生速度"
+ },
+ {
+ "zh": "播放倍速",
+ "src": "qml/Veyra/PlaybackRateDialog.qml",
+ "zh-TW": "播放倍速",
+ "en": "Playback speed",
+ "ja": "再生速度"
+ },
+ {
+ "zh": "范围 0.25~4.00 倍,保持原有音调",
+ "src": "qml/Veyra/PlaybackRateDialog.qml",
+ "zh-TW": "範圍 0.25~4.00 倍,保持原有音調",
+ "en": "Range 0.25–4.00×, preserving pitch",
+ "ja": "範囲 0.25~4.00 倍、音程を維持"
+ },
+ {
+ "zh": "请输入 0.25~4.00 之间的倍速",
+ "src": "qml/Veyra/PlaybackRateDialog.qml",
+ "zh-TW": "請輸入 0.25~4.00 之間的倍速",
+ "en": "Enter a speed between 0.25 and 4.00",
+ "ja": "0.25~4.00 の速度を入力してください"
+ },
+ {
+ "zh": "当前播放状态无法修改倍速",
+ "src": "qml/Veyra/PlaybackRateDialog.qml",
+ "zh-TW": "目前播放狀態無法修改倍速",
+ "en": "Playback speed cannot be changed in the current state",
+ "ja": "現在の再生状態では速度を変更できません"
+ },
+ {
+ "zh": "应用",
+ "src": "qml/Veyra/PlaybackRateDialog.qml",
+ "zh-TW": "套用",
+ "en": "Apply",
+ "ja": "適用"
}
]
}
diff --git a/include/veyra/engine/PlaybackRate.h b/include/veyra/engine/PlaybackRate.h
new file mode 100644
index 00000000..d3e1ccb5
--- /dev/null
+++ b/include/veyra/engine/PlaybackRate.h
@@ -0,0 +1,10 @@
+#pragma once
+#include <cmath>
+
+namespace veyra::engine {
+inline constexpr double kMinPlaybackRate=.25;
+inline constexpr double kMaxPlaybackRate=4.;
+inline bool validPlaybackRate(double rate) {
+ return std::isfinite(rate)&&rate>=kMinPlaybackRate&&rate<=kMaxPlaybackRate;
+}
+}
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index 4116e40f..b5d7ccfa 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -69,7 +69,7 @@ class QmlPlayerBridge : public QObject {
// --- frame generation settings ----------------------------------------
Q_PROPERTY(QString fgBackendName READ fgBackendName WRITE setFgBackendName NOTIFY settingsChanged)
Q_PROPERTY(int vfgQuality READ vfgQuality WRITE setVfgQuality NOTIFY settingsChanged)
- Q_PROPERTY(QVariantList fgBackendChoices READ fgBackendChoices CONSTANT)
+ Q_PROPERTY(QVariantList fgBackendChoices READ fgBackendChoices NOTIFY effectCapabilitiesChanged)
Q_PROPERTY(QString fgProviderText READ fgProviderText NOTIFY fgChoicesChanged)
Q_PROPERTY(int fgMaxMultiplier READ fgMaxMultiplier NOTIFY snapshotChanged)
Q_PROPERTY(bool fgEnabled READ fgEnabled WRITE setFgEnabled NOTIFY chainChanged)
@@ -111,9 +111,9 @@ class QmlPlayerBridge : public QObject {
Q_PROPERTY(QString captureDeviceLabel READ captureDeviceLabel NOTIFY captureChanged)
Q_PROPERTY(bool captureForceSdr READ captureForceSdr WRITE setCaptureForceSdr NOTIFY settingsChanged)
Q_PROPERTY(bool amdNrGpu READ amdNrGpu CONSTANT)
- Q_PROPERTY(QVariantMap effectCapabilities READ effectCapabilities NOTIFY fgChoicesChanged)
- Q_PROPERTY(QVariantList nrRuntimeChoices READ nrRuntimeChoices NOTIFY fgChoicesChanged)
- Q_PROPERTY(QVariantList srBackendChoices READ srBackendChoices NOTIFY fgChoicesChanged)
+ Q_PROPERTY(QVariantMap effectCapabilities READ effectCapabilities NOTIFY effectCapabilitiesChanged)
+ Q_PROPERTY(QVariantList nrRuntimeChoices READ nrRuntimeChoices NOTIFY effectCapabilitiesChanged)
+ Q_PROPERTY(QVariantList srBackendChoices READ srBackendChoices NOTIFY effectCapabilitiesChanged)
Q_PROPERTY(bool captureFlipVertical READ captureFlipVertical WRITE setCaptureFlipVertical NOTIFY settingsChanged)
// P4-e: the full capture connection, as the 1.4.4 panel: device details and
// formats come from asynchronous DirectShow queries (never on the UI thread),
@@ -359,6 +359,8 @@ class QmlPlayerBridge : public QObject {
Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY snapshotChanged)
Q_PROPERTY(double playbackSpeed READ playbackSpeed NOTIFY snapshotChanged)
Q_PROPERTY(double playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY snapshotChanged)
+ Q_PROPERTY(double minimumPlaybackRate READ minimumPlaybackRate CONSTANT)
+ Q_PROPERTY(double maximumPlaybackRate READ maximumPlaybackRate CONSTANT)
// True while the engine has not yet applied what the UI asked for. The UI
// shows the pending value and marks it, rather than lying about the state.
Q_PROPERTY(bool applying READ applying NOTIFY snapshotChanged)
@@ -695,6 +697,8 @@ public:
void setMuted(bool value);
double playbackSpeed() const;
double playbackRate() const;
+ double minimumPlaybackRate() const;
+ double maximumPlaybackRate() const;
void setPlaybackRate(double rate);
bool nrEnabled() const;
@@ -1044,6 +1048,7 @@ signals:
void thumbnailSourceChanged(const QString& path);
void settingsChanged();
void fgChoicesChanged();
+ void effectCapabilitiesChanged();
void chainChanged();
void recentFilesChanged();
void presetsChanged();
diff --git a/qml/Veyra/CineBar.qml b/qml/Veyra/CineBar.qml
index 11ef6642..77575af1 100644
--- a/qml/Veyra/CineBar.qml
+++ b/qml/Veyra/CineBar.qml
@@ -25,7 +25,7 @@ Rectangle {
// Set by FullscreenBar so upward menus stop above the playback pill.
property real menuBottomLimit: -1
// Any popover needs the owner window's full mask, not just the preset menu.
- readonly property bool menuOpen: presetMenu.visible || ccMenu.visible || audioMenu.visible || loadMenu.visible
+ readonly property bool menuOpen: presetMenu.visible || ccMenu.visible || audioMenu.visible || loadMenu.visible || playbackRate.menuOpen
// The pointer is over the pill.
readonly property bool hovered: barHover.hovered
readonly property bool seekPreviewOpen: seekMouse.containsMouse && seekMouse.enabled
@@ -183,7 +183,7 @@ Rectangle {
CBtn { glyph: "fwd10"; onTapped: veyra.seekBy(10) }
CBtn { glyph: "music"; onTapped: audioMenu.openAt(this, "up") }
- PlaybackRateButton { objectName: "cine-playback-rate" }
+ PlaybackRateButton { id: playbackRate; objectName: "cine-playback-rate"; menuBottomLimit: bar.menuBottomLimit }
}
// .seekrow: mono times either side of the rail.
diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qml
index eb4c0006..b27b8948 100644
--- a/qml/Veyra/Main.qml
+++ b/qml/Veyra/Main.qml
@@ -371,6 +371,7 @@ Window {
// Set before the visibility changes: Windows resizes the window first, and the
// cinema rule would otherwise snap that fullscreen size back to the film.
property bool fullTarget: false
+ property int fullRestoreVisibility: Window.Windowed
property bool fullLocked: false
// Fullscreen quick-adjust panel (Home): the list mode's inspector on the left
// of the picture, with the performance orbs. List mode only.
@@ -396,8 +397,14 @@ Window {
return
}
fullLocked = false
- fullTarget = !fullscreen
- visibility = fullTarget ? Window.FullScreen : Window.Windowed
+ if (!fullscreen) {
+ fullRestoreVisibility = maximized ? Window.Maximized : Window.Windowed
+ fullTarget = true
+ visibility = Window.FullScreen
+ } else {
+ fullTarget = false
+ visibility = fullRestoreVisibility
+ }
veyra.logUi("ui-fullscreen", "enabled=" + fullscreen)
}
diff --git a/qml/Veyra/PlaybackRateButton.qml b/qml/Veyra/PlaybackRateButton.qml
index 67766dc0..fee32634 100644
--- a/qml/Veyra/PlaybackRateButton.qml
+++ b/qml/Veyra/PlaybackRateButton.qml
@@ -8,8 +8,10 @@ Rectangle {
radius: 8
visible: veyra.hasSource && !veyra.isCapture && veyra.duration > 0
enabled: veyra.running
+ property real menuBottomLimit: -1
+ readonly property bool menuOpen: rateMenu.visible || customRate.visible
color: hover.hovered ? Qt.rgba(1, 1, 1, 0.10) : "transparent"
- readonly property string rateLabel: Number(veyra.playbackRate || 1).toString() + "×"
+ readonly property string rateLabel: Number(veyra.playbackRate || 1).toFixed(2).replace(/\.?0+$/, "") + "×"
Text {
anchors.centerIn: parent
text: control.rateLabel
@@ -19,13 +21,19 @@ Rectangle {
}
HoverHandler { id: hover; cursorShape: Qt.PointingHandCursor }
TapHandler { onTapped: rateMenu.openAt(control, "up") }
- ToolTip.visible: hover.hovered
+ ToolTip.visible: hover.hovered && !control.menuOpen
ToolTip.text: qsTr("播放速度")
VMenu {
id: rateMenu
objectName: control.objectName + "-menu"
+ aboveLimit: control.menuBottomLimit
title: qsTr("播放速度")
items: [1, 1.5, 2, 3].map(r => ({ label: r + "×", rate: r, checked: Number(veyra.playbackRate || 1) === r }))
- onPicked: (i, o) => veyra.playbackRate = o.rate
+ .concat([{ label: qsTr("自定义…"), custom: true, checked: [1,1.5,2,3].indexOf(Number(veyra.playbackRate)) < 0 }])
+ onPicked: (i, o) => {
+ if (o.custom) customRate.open()
+ else veyra.playbackRate = o.rate
+ }
}
+ PlaybackRateDialog { id: customRate; objectName: control.objectName + "-custom" }
}
diff --git a/qml/Veyra/PlaybackRateDialog.qml b/qml/Veyra/PlaybackRateDialog.qml
new file mode 100644
index 00000000..d7aaa467
--- /dev/null
+++ b/qml/Veyra/PlaybackRateDialog.qml
@@ -0,0 +1,64 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Controls.Basic as Basic
+import QtQuick.Layouts
+
+Popup {
+ id: dialog
+ parent: Overlay.overlay
+ // The cinema controls live in a non-activating, masked tool window. An
+ // independent popup accepts keyboard focus and cannot be cut off by its mask.
+ popupType: Popup.Window
+ width: Math.min(360, parent ? parent.width-32 : 360)
+ height: body.implicitHeight+32
+ x: parent ? (parent.width-width)/2 : 0
+ y: parent ? (parent.height-height)/2 : 0
+ padding: 16
+ modal: true
+ dim: true
+ focus: true
+ closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
+ property string errorText: ""
+ function applyRate() {
+ if (!input.acceptableInput) { errorText=qsTr("请输入 0.25~4.00 之间的倍速"); return }
+ const rate=Number(input.text)
+ veyra.playbackRate=rate
+ if (Math.abs(veyra.playbackRate-rate)>0.000001) { errorText=qsTr("当前播放状态无法修改倍速"); return }
+ close()
+ }
+ onOpened: {
+ errorText=""
+ input.text=Number(veyra.playbackRate).toFixed(2)
+ input.forceActiveFocus(); input.selectAll()
+ }
+ background: Rectangle {
+ objectName: "videoCover"
+ property real coverRadius: 16
+ radius: 16; color: Theme.dialog
+ border.width: 1; border.color: Theme.stroke2
+ }
+ contentItem: ColumnLayout {
+ id: body
+ spacing: 14
+ Text { text: qsTr("自定义播放速度"); color: Theme.t1; font.family: Theme.fontUi; font.pixelSize: Theme.fsH2; font.weight: Font.DemiBold }
+ Text { text: qsTr("范围 0.25~4.00 倍,保持原有音调"); color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: Theme.fsBody }
+ Basic.TextField {
+ id: input
+ objectName: dialog.objectName+"-input"
+ Accessible.name: qsTr("播放倍速")
+ Layout.fillWidth: true
+ color: Theme.t1; font.family: Theme.fontMono; font.pixelSize: 18
+ selectByMouse: true
+ validator: DoubleValidator { bottom: veyra.minimumPlaybackRate; top: veyra.maximumPlaybackRate; decimals: 2; notation: DoubleValidator.StandardNotation; locale: "C" }
+ background: Rectangle { radius: 8; color: Theme.bgOuter; border.width: 1; border.color: input.activeFocus ? Theme.t2 : Theme.stroke2 }
+ onAccepted: dialog.applyRate()
+ }
+ Text { Layout.fillWidth: true; visible: dialog.errorText.length>0; text: dialog.errorText; color: Theme.t2; font.family: Theme.fontUi; wrapMode: Text.WordWrap }
+ RowLayout {
+ Layout.fillWidth: true
+ Item { Layout.fillWidth: true }
+ VButton { objectName: dialog.objectName+"-cancel"; text: qsTr("取消"); onClicked: dialog.close() }
+ VButton { objectName: dialog.objectName+"-apply"; text: qsTr("应用"); primary: true; onClicked: dialog.applyRate() }
+ }
+ }
+}
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index a18e4809..8f4f5700 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -359,55 +359,84 @@ VPage {
}
}
- // --- header (32px) ----------------------------------------------------
- RowLayout {
+ // Source and output belong together; the transport stays clear for seeking.
+ Item {
id: head
+ objectName: "pro-header"
visible: !root.overlay
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 14
- height: 32
- spacing: 8
+ readonly property bool compact: width < 972
+ height: compact ? 72 : 32
- // pages-pro.js data-srcbtn: what is playing, with a chevron for the menu.
- VButton {
- id: sourceBtn
- objectName: "pro-source-button"
- iconName: veyra.sourceKind === "ps5" ? "gamepad" : veyra.sourceKind === "moonlight" ? "cast" : veyra.sourceKind === "xbox" ? "gamepad" : veyra.sourceKind === "screen" ? "monitor"
- : veyra.sourceKind === "image" ? "image" : veyra.sourceKind === "file" ? "film" : "video"
- text: veyra.sourceTitle.length > 0 ? veyra.sourceTitle : qsTr("片源")
- maxTextWidth: 260
- trailingIcon: "down"
- onClicked: sourceMenu.openAt(this, "down")
- }
- // "1080p60 · YUY2 · SDR": reported values only.
- VTag {
- objectName: "pro-format-tag"
- text: veyra.sourceFormatText.length > 0 ? veyra.sourceFormatText : qsTr("未打开")
- }
- Item { Layout.fillWidth: true }
+ RowLayout {
+ id: sourceInfo
+ objectName: "pro-source-info"
+ anchors.left: parent.left
+ anchors.top: parent.top
+ width: head.compact ? head.width : Math.max(0, head.width - headActions.width - 16)
+ height: 32
+ spacing: 8
- // View toggle. Choosing 节点 asks first, because switching rebuilds the
- // whole processing chain (design note: 切换需要确认,会重建处理链).
- VSeg {
- objectName: "pro-mode-switch"
- options: [{ id: "list", label: qsTr("列表"), icon: "list" }, { id: "node", label: qsTr("节点"), icon: "nodes" }]
- current: veyra.nodeMode === 1 ? "node" : "list"
- onPicked: id => {
- const target = id === "node" ? 1 : 0
- if (target === veyra.nodeMode) { if (target === 1) root.requestPage("node"); return }
- switchDialog.targetMode = target
- switchDialog.open()
+ // pages-pro.js data-srcbtn: what is playing, with a chevron for the menu.
+ VButton {
+ id: sourceBtn
+ objectName: "pro-source-button"
+ iconName: veyra.sourceKind === "ps5" ? "gamepad" : veyra.sourceKind === "moonlight" ? "cast" : veyra.sourceKind === "xbox" ? "gamepad" : veyra.sourceKind === "screen" ? "monitor"
+ : veyra.sourceKind === "image" ? "image" : veyra.sourceKind === "file" ? "film" : "video"
+ text: veyra.sourceTitle.length > 0 ? veyra.sourceTitle : qsTr("片源")
+ maxTextWidth: Math.max(36, Math.min(260, sourceInfo.width - formatTag.implicitWidth
+ - (outputTag.visible ? outputTag.implicitWidth + 8 : 0) - 74))
+ trailingIcon: "down"
+ onClicked: sourceMenu.openAt(this, "down")
}
+ // "1080p60 · YUY2 · SDR": reported values only.
+ VTag {
+ id: formatTag
+ objectName: "pro-format-tag"
+ text: veyra.sourceFormatText.length > 0 ? veyra.sourceFormatText : qsTr("未打开")
+ }
+ VTag {
+ id: outputTag
+ objectName: "pro-output-summary"
+ visible: veyra.outputSummary.length > 0
+ text: qsTr("输出 ") + veyra.outputSummary.replace("x", "×")
+ }
+ Item { Layout.fillWidth: true }
}
- VButton { iconName: "camera"; text: qsTr("截图"); onClicked: veyra.takeScreenshot() }
- VButton {
- id: presetBtn
- iconName: "layers"
- trailingIcon: "down"
- text: qsTr("预设:") + veyra.currentPresetName
- onClicked: presetMenu.openAt(this, "down")
+
+ RowLayout {
+ id: headActions
+ objectName: "pro-header-actions"
+ anchors.right: parent.right
+ y: head.compact ? 40 : 0
+ height: 32
+ spacing: 8
+
+ // View toggle. Choosing 节点 asks first, because switching rebuilds the
+ // whole processing chain (design note: 切换需要确认,会重建处理链).
+ VSeg {
+ objectName: "pro-mode-switch"
+ options: [{ id: "list", label: qsTr("列表"), icon: "list" }, { id: "node", label: qsTr("节点"), icon: "nodes" }]
+ current: veyra.nodeMode === 1 ? "node" : "list"
+ onPicked: id => {
+ const target = id === "node" ? 1 : 0
+ if (target === veyra.nodeMode) { if (target === 1) root.requestPage("node"); return }
+ switchDialog.targetMode = target
+ switchDialog.open()
+ }
+ }
+ VButton { iconName: "camera"; text: qsTr("截图"); onClicked: veyra.takeScreenshot() }
+ VButton {
+ id: presetBtn
+ iconName: "layers"
+ trailingIcon: "down"
+ text: qsTr("预设:") + veyra.currentPresetName
+ maxTextWidth: 180
+ onClicked: presetMenu.openAt(this, "down")
+ }
}
}
@@ -420,7 +449,7 @@ VPage {
anchors.top: head.bottom
anchors.topMargin: 10
width: root.width - 376 - 14 * 2 - 10
- height: root.height - 14 - 32 - 10 - 172 - 10 - 14
+ height: root.height - 14 - head.height - 10 - 172 - 10 - 14
radius: Theme.rCard
color: Theme.card
border.width: 1
@@ -434,7 +463,7 @@ VPage {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
- height: parent.height - 34
+ height: parent.height - transport.height
// Drawing an NR protection region: the native video window lets the
// pointer through, so this catches the drag; the outline itself is
// drawn by the bridge on a layered child of the video window.
@@ -494,143 +523,158 @@ VPage {
}
}
- // .vbar: mono transport row with source/output tags.
- RowLayout {
+ // Transport controls; source/output details are in the header.
+ Item {
+ id: transport
+ objectName: "pro-transport"
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
- height: 34
+ readonly property bool compact: width < 520
+ height: compact ? 68 : 34
anchors.leftMargin: 10
anchors.rightMargin: 10
- spacing: 10
- Item {
- implicitWidth: 28; implicitHeight: 28
- VIcon {
- anchors.centerIn: parent
- name: (veyra.running && !veyra.paused) ? "pause" : "play"
+ RowLayout {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.rightMargin: transport.compact ? 0 : playbackActions.width + 10
+ height: 34
+ spacing: 10
+ Item {
+ implicitWidth: 28; implicitHeight: 28
+ VIcon {
+ anchors.centerIn: parent
+ name: (veyra.running && !veyra.paused) ? "pause" : "play"
+ color: Theme.t2
+ }
+ HoverHandler { cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: veyra.togglePlayPause() }
+ }
+ Text {
+ text: veyra.positionText
color: Theme.t2
+ font.family: Theme.fontMono
+ font.pixelSize: Theme.fsSmall
}
- HoverHandler { cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.togglePlayPause() }
- }
- Text {
- text: veyra.positionText
- color: Theme.t2
- font.family: Theme.fontMono
- font.pixelSize: Theme.fsSmall
- }
- Item {
- id: proSeekArea
- objectName: "pro-seek"
- Layout.fillWidth: true
- implicitHeight: 14
- Rectangle {
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width
- height: 3
- radius: 9
- color: Qt.rgba(1, 1, 1, 0.14)
+ Item {
+ id: proSeekArea
+ objectName: "pro-seek"
+ Layout.fillWidth: true
+ implicitHeight: 14
Rectangle {
- width: parent.width * proSeekArea.frac
- height: parent.height
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width
+ height: 3
radius: 9
+ color: Qt.rgba(1, 1, 1, 0.14)
+ Rectangle {
+ width: parent.width * proSeekArea.frac
+ height: parent.height
+ radius: 9
+ color: "#FFFFFF"
+ }
+ }
+ // Press or drag anywhere on the rail: the picture follows the
+ // pointer (a seek every 120 ms) and lands on release.
+ property bool scrubbing: false
+ property real scrubFrac: 0
+ readonly property real frac: scrubbing ? scrubFrac : Math.max(0, Math.min(1, veyra.progress))
+ Rectangle {
+ width: 11; height: 11; radius: 5.5
color: "#FFFFFF"
+ anchors.verticalCenter: parent.verticalCenter
+ x: proSeekArea.frac * proSeekArea.width - width / 2
+ visible: proSeekMouse.containsMouse || proSeekArea.scrubbing
}
- }
- // Press or drag anywhere on the rail: the picture follows the
- // pointer (a seek every 120 ms) and lands on release.
- property bool scrubbing: false
- property real scrubFrac: 0
- readonly property real frac: scrubbing ? scrubFrac : Math.max(0, Math.min(1, veyra.progress))
- Rectangle {
- width: 11; height: 11; radius: 5.5
- color: "#FFFFFF"
- anchors.verticalCenter: parent.verticalCenter
- x: proSeekArea.frac * proSeekArea.width - width / 2
- visible: proSeekMouse.containsMouse || proSeekArea.scrubbing
- }
- Timer {
- id: proScrubSeek
- interval: 120
- onTriggered: if (proSeekArea.scrubbing) veyra.seekTo(proSeekArea.scrubFrac * veyra.duration)
- }
- MouseArea {
- id: proSeekMouse
- anchors.fill: parent
- hoverEnabled: true
- enabled: veyra.duration > 0 && !veyra.isCapture
- cursorShape: Qt.PointingHandCursor
- preventStealing: true
- function fracAt(x) { return Math.max(0, Math.min(1, x / Math.max(1, proSeekArea.width))) }
- onPressed: mouse => { proSeekArea.scrubFrac = fracAt(mouse.x); proSeekArea.scrubbing = true; proScrubSeek.start() }
- onPositionChanged: mouse => {
- if (!proSeekArea.scrubbing) return
- proSeekArea.scrubFrac = fracAt(mouse.x)
- if (!proScrubSeek.running) proScrubSeek.start()
+ Timer {
+ id: proScrubSeek
+ interval: 120
+ onTriggered: if (proSeekArea.scrubbing) veyra.seekTo(proSeekArea.scrubFrac * veyra.duration)
}
- onReleased: mouse => {
- proScrubSeek.stop()
- const target = fracAt(mouse.x) * veyra.duration
- proSeekArea.scrubbing = false
- veyra.seekTo(target)
+ MouseArea {
+ id: proSeekMouse
+ anchors.fill: parent
+ hoverEnabled: true
+ enabled: veyra.duration > 0 && !veyra.isCapture
+ cursorShape: Qt.PointingHandCursor
+ preventStealing: true
+ function fracAt(x) { return Math.max(0, Math.min(1, x / Math.max(1, proSeekArea.width))) }
+ onPressed: mouse => { proSeekArea.scrubFrac = fracAt(mouse.x); proSeekArea.scrubbing = true; proScrubSeek.start() }
+ onPositionChanged: mouse => {
+ if (!proSeekArea.scrubbing) return
+ proSeekArea.scrubFrac = fracAt(mouse.x)
+ if (!proScrubSeek.running) proScrubSeek.start()
+ }
+ onReleased: mouse => {
+ proScrubSeek.stop()
+ const target = fracAt(mouse.x) * veyra.duration
+ proSeekArea.scrubbing = false
+ veyra.seekTo(target)
+ }
+ onCanceled: { proScrubSeek.stop(); proSeekArea.scrubbing = false }
}
- onCanceled: { proScrubSeek.stop(); proSeekArea.scrubbing = false }
+ }
+ Text {
+ text: veyra.durationText
+ color: Theme.t2
+ font.family: Theme.fontMono
+ font.pixelSize: Theme.fsSmall
}
}
- Text {
- text: veyra.durationText
- color: Theme.t2
- font.family: Theme.fontMono
- font.pixelSize: Theme.fsSmall
- }
- VTag { visible: veyra.sourceRateText.length > 0; text: qsTr("源 ") + veyra.sourceRateText }
- PlaybackRateButton { objectName: "pro-playback-rate" }
- VTag { visible: veyra.outputSummary.length > 0; text: qsTr("输出 ") + veyra.outputSummary.replace("x", "×") }
- VTag {
- objectName: "pro-fg-tag"
- visible: veyra.hasSource
- kind: veyra.fgEnabled ? "acc" : ""
- text: veyra.fgEnabled ? veyra.fgMultiplier + "X" : qsTr("补帧关")
- }
- // Subtitle and audio-track menus (field request 2026-10-01), the same menus as the
- // 极简 pill's, beside the fullscreen button.
- component BarButton: Item {
- id: barBtn
- property string glyph: ""
- property string tip: ""
- signal tapped()
- implicitWidth: 28; implicitHeight: 28
- VIcon { anchors.centerIn: parent; name: barBtn.glyph; color: barHover.hovered ? Theme.t1 : Theme.t2 }
- HoverHandler { id: barHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: barBtn.tapped() }
- ToolTip.visible: barHover.hovered
- ToolTip.text: barBtn.tip
- }
- BarButton {
- id: proCcButton
- objectName: "pro-subtitles"
- glyph: "cc"
- tip: qsTr("字幕")
- visible: veyra.hasSource && !veyra.isCapture
- onTapped: proCcMenu.openAt(proCcButton, "up")
- }
- BarButton {
- id: proAudioButton
- objectName: "pro-audio-tracks"
- glyph: "music"
- tip: qsTr("音轨")
- visible: veyra.hasSource && !veyra.isCapture
- onTapped: proAudioMenu.openAt(proAudioButton, "up")
- }
- // Fullscreen, at the picture's bottom-right corner where players put it.
- Item {
- objectName: "pro-fullscreen"
- implicitWidth: 28; implicitHeight: 28
- VIcon { anchors.centerIn: parent; name: "max"; color: fullHover.hovered ? Theme.t1 : Theme.t2 }
- HoverHandler { id: fullHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: root.requestFullscreen() }
- ToolTip.visible: fullHover.hovered
- ToolTip.text: qsTr("全屏(双击画面 / F11)· 全屏后按 Home 打开快速调节")
+ RowLayout {
+ id: playbackActions
+ objectName: "pro-transport-actions"
+ anchors.right: parent.right
+ y: transport.compact ? 34 : 0
+ height: 34
+ spacing: 10
+ PlaybackRateButton { objectName: "pro-playback-rate" }
+ VTag {
+ objectName: "pro-fg-tag"
+ visible: veyra.hasSource
+ kind: veyra.fgEnabled ? "acc" : ""
+ text: veyra.fgEnabled ? veyra.fgMultiplier + "X" : qsTr("补帧关")
+ }
+ // Subtitle and audio-track menus (field request 2026-10-01), the same menus as the
+ // 极简 pill's, beside the fullscreen button.
+ component BarButton: Item {
+ id: barBtn
+ property string glyph: ""
+ property string tip: ""
+ signal tapped()
+ implicitWidth: 28; implicitHeight: 28
+ VIcon { anchors.centerIn: parent; name: barBtn.glyph; color: barHover.hovered ? Theme.t1 : Theme.t2 }
+ HoverHandler { id: barHover; cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: barBtn.tapped() }
+ ToolTip.visible: barHover.hovered
+ ToolTip.text: barBtn.tip
+ }
+ BarButton {
+ id: proCcButton
+ objectName: "pro-subtitles"
+ glyph: "cc"
+ tip: qsTr("字幕")
+ visible: veyra.hasSource && !veyra.isCapture
+ onTapped: proCcMenu.openAt(proCcButton, "up")
+ }
+ BarButton {
+ id: proAudioButton
+ objectName: "pro-audio-tracks"
+ glyph: "music"
+ tip: qsTr("音轨")
+ visible: veyra.hasSource && !veyra.isCapture
+ onTapped: proAudioMenu.openAt(proAudioButton, "up")
+ }
+ // Fullscreen, at the picture's bottom-right corner where players put it.
+ Item {
+ objectName: "pro-fullscreen"
+ implicitWidth: 28; implicitHeight: 28
+ VIcon { anchors.centerIn: parent; name: "max"; color: fullHover.hovered ? Theme.t1 : Theme.t2 }
+ HoverHandler { id: fullHover; cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: root.requestFullscreen() }
+ ToolTip.visible: fullHover.hovered
+ ToolTip.text: qsTr("全屏(双击画面 / F11)· 全屏后按 Home 打开快速调节")
+ }
}
}
}
diff --git a/qml/Veyra/qmldir b/qml/Veyra/qmldir
index feec1a16..69314fb6 100644
--- a/qml/Veyra/qmldir
+++ b/qml/Veyra/qmldir
@@ -1,5 +1,6 @@
module Veyra
PlaybackRateButton 1.0 PlaybackRateButton.qml
+PlaybackRateDialog 1.0 PlaybackRateDialog.qml
singleton Theme 1.0 Theme.qml
VAccordion 1.0 VAccordion.qml
VSubGroup 1.0 VSubGroup.qml
diff --git a/scripts/acceptance/playback-smoothness-background.py b/scripts/acceptance/playback-smoothness-background.py
new file mode 100644
index 00000000..4425ac38
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-background.py
@@ -0,0 +1,8 @@
+"""An empty owned window for actual Windows foreground/occlusion testing."""
+import tkinter as tk
+root=tk.Tk()
+root.title('Veyra background playback test')
+root.geometry('320x140+40+40')
+tk.Label(root,text='Veyra focus-loss test window\nOwned test; no user settings changed',padx=12,pady=28).pack()
+root.after(270000,root.destroy)
+root.mainloop()
diff --git a/scripts/acceptance/playback-smoothness-baseline.py b/scripts/acceptance/playback-smoothness-baseline.py
new file mode 100644
index 00000000..d85e5d94
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-baseline.py
@@ -0,0 +1,76 @@
+"""Launch one owned, isolated real-player comparison; no desktop input is sent."""
+from pathlib import Path
+import json
+import os
+import shutil
+import subprocess
+import sys
+
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra'); TASK='playback-smoothness-20261004'
+sources={
+ '202':BASE/'releases/2.0.2/Veyra-2.0.2-win64-portable',
+ '203':BASE/'releases/release-2.0.3-20261004/Veyra-2.0.3-NVIDIA-win64-portable',
+ 'fixed':BASE/'test-packages/rtss-restart-loop-20261004/Veyra-2.0.3-rtssfix-NVIDIA-win64-portable',
+ 'candidate':BASE/'releases/release-2.0.3-20261004/Veyra-2.0.3-NVIDIA-win64-portable',
+}
+version,mode,label=sys.argv[1:4]
+run=BASE/'tests'/TASK/label; logs=BASE/'logs'/TASK/label; tmp=BASE/'tmp'/TASK/label
+for p in (run,logs,tmp):p.mkdir(parents=True,exist_ok=False)
+app=run/'app'; source=sources[version]
+def copy(src,dst):
+ # Only immutable dependencies are linked. Mutable QML/config/log/EXE files
+ # always have independent bytes, never overwrite published files via a link.
+ path=Path(src)
+ if path.suffix.lower() in {'.dll','.hsaco','.ptx','.onnx','.f16','.bin','.cubin'}:
+ os.link(src,dst)
+ else:shutil.copy2(src,dst)
+ return dst
+shutil.copytree(source,app,copy_function=copy,ignore=shutil.ignore_patterns('*.log','logs','data','profiles'))
+if version=='candidate':
+ shutil.copy2(BASE/'build'/TASK/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe')
+ shutil.copytree(ROOT/'qml',app/'qml',dirs_exist_ok=True)
+main=app/'qml/Veyra/Main.qml'; text=main.read_text(encoding='utf8'); at=text.rfind('}')
+media=BASE/'tests/rtss-restart-loop-20261004/rtss-stress-2k30.mp4'
+probe=(ROOT/'scripts/acceptance/playback-smoothness-probe.qml').as_uri()
+if mode=='functional':
+ probe=(ROOT/'scripts/acceptance/playback-smoothness-functional.qml').as_uri()
+ media=BASE/'tests'/TASK/'fixtures/golden.mkv'
+if mode=='layout':
+ probe=(ROOT/'scripts/acceptance/playback-smoothness-layout.qml').as_uri()
+if mode=='capability':
+ probe=(ROOT/'scripts/acceptance/playback-smoothness-capability.qml').as_uri()
+limit='; item.limit=75' if 'short' in sys.argv[4:] and mode not in ('functional','layout') else ''
+loader='\n Loader { source: '+json.dumps(probe)+'; onLoaded: { item.media='+json.dumps(str(media).replace('\\','/'))+'; item.mode='+json.dumps(mode)+limit+' } }\n'
+main.write_text(text[:at]+loader+text[at:],encoding='utf8')
+profile=run/'profile'; profile.mkdir()
+(profile/'preferences.json').write_text(json.dumps({'language':'zh-CN','overlayCompat':'off'}),encoding='utf8')
+env=os.environ.copy()
+for k in ('QSG_RHI_BACKEND','QT_QUICK_BACKEND','VEYRA_DATA_DIR','VEYRA_RUNTIME_DIR','VEYRA_QML_UI_PROBE'):
+ env.pop(k,None)
+env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(logs/'player.log'),
+ QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1')
+if 'software' in sys.argv[4:]:env['QT_QUICK_BACKEND']='software'
+with (logs/'console.log').open('xb') as out:
+ proc=subprocess.Popen([str(app/'veyra_qml_ui.exe'),'--data-dir',str(profile),
+ '--page','pro','--exit-after','270000'],cwd=app,env=env,stdout=out,stderr=subprocess.STDOUT)
+receipt={'pid':proc.pid,'version':version,'mode':mode,'app':str(app),'logs':str(logs),'label':label}
+helper=ROOT/'scripts/acceptance/playback-smoothness-background.py'
+with (logs/'helper.log').open('xb') as out:
+ helper_proc=subprocess.Popen([sys.executable,'-B',str(helper)],cwd=tmp,env=env,stdout=out,stderr=subprocess.STDOUT)
+receipt['helperPid']=helper_proc.pid
+(run/'launch.json').write_text(json.dumps(receipt,indent=2),encoding='utf8')
+print(json.dumps(receipt),flush=True)
+if '--wait' in sys.argv[4:]:
+ try:code=proc.wait(timeout=280)
+ except subprocess.TimeoutExpired:
+ proc.kill();proc.wait(timeout=5);code=124
+ finally:
+ if helper_proc.poll() is None:helper_proc.terminate();helper_proc.wait(timeout=5)
+ receipt['exitCode']=code
+ log=(logs/'player.log').read_text(encoding='utf8',errors='replace')
+ marker={'functional':'PLAYBACK_FUNCTION_PASS','layout':'PLAYBACK_LAYOUT_FULLSCREEN_PASS','capability':'PLAYBACK_CAPABILITY_PASS'}.get(mode)
+ receipt['passed']=code==0 and (marker is None or marker in log) and not any(x in log for x in ('PLAYBACK_FUNCTION_FAIL','PLAYBACK_LAYOUT_FAIL','PLAYBACK_CAPABILITY_FAIL','ReferenceError:','TypeError:'))
+ (run/'result.json').write_text(json.dumps(receipt,indent=2),encoding='utf8')
+ print(json.dumps(receipt),flush=True)
+ raise SystemExit(0 if receipt['passed'] else 1)
diff --git a/scripts/acceptance/playback-smoothness-build.py b/scripts/acceptance/playback-smoothness-build.py
new file mode 100644
index 00000000..3ba78c43
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-build.py
@@ -0,0 +1,35 @@
+"""Fresh scoped build, preserving the released dependency configuration."""
+import os
+from pathlib import Path
+import subprocess
+import sys
+
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra'); TASK='playback-smoothness-20261004'
+BUILD,TMP,LOGS=(BASE/part/TASK for part in ('build','tmp','logs'))
+guard=ROOT/'scripts/acceptance/playback-smoothness-control.py'
+subprocess.run([sys.executable,'-B',str(guard)],check=True)
+for p in (BUILD,TMP,LOGS):p.mkdir(parents=True,exist_ok=True)
+settings=[]
+for line in (BASE/'build/release-2.0.3-20261004/CMakeCache.txt').read_text(encoding='utf8').splitlines():
+ if ':' not in line or '=' not in line or line.startswith(('#','//')):continue
+ keytype,value=line.split('=',1); key,kind=keytype.split(':',1)
+ if kind in ('INTERNAL','STATIC') or key=='VEYRA_DISPLAY_VERSION':continue
+ if key.startswith('VEYRA_') or key in ('CMAKE_PREFIX_PATH','CMAKE_MAKE_PROGRAM','PROTOC','PKG_CONFIG_EXECUTABLE'):
+ settings.append(f'set({key} [[{value}]] CACHE {kind} "Released dependency" FORCE)')
+settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.3-smoothfix]] CACHE STRING "Local playback repair" FORCE)')
+(TMP/'dependencies.cmake').write_text('\n'.join(settings),encoding='utf8')
+targets=sys.argv[2:] or ['veyra_qml_ui']
+assert all(t.replace('_','').isalnum() for t in targets)
+cmd=TMP/'build.cmd'
+cmd.write_text('@echo off\nchcp 65001 >nul\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\n"%TASK_CMAKE%" --preset x64-release -S "%TASK_ROOT%" -B "%TASK_BUILD%" -C "%TASK_TMP%\\dependencies.cmake"\nif errorlevel 1 exit /b 5\n"%TASK_CMAKE%" --build "%TASK_BUILD%" --parallel 6 --target '+' '.join(targets)+'\nexit /b %errorlevel%\n',encoding='ascii')
+env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP),VSLANG='1033',TASK_ROOT=str(ROOT),
+ TASK_BUILD=str(BUILD),TASK_TMP=str(TMP),TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')
+log=LOGS/sys.argv[1]
+with log.open('x',encoding='utf8') as out:
+ try:code=subprocess.run(['cmd.exe','/d','/c',str(cmd)],cwd=ROOT,env=env,stdout=out,stderr=subprocess.STDOUT,timeout=890).returncode
+ except subprocess.TimeoutExpired:code=124
+print('BUILD',code,log)
+print('\n'.join(log.read_text(encoding='utf8',errors='replace').splitlines()[-18:]))
+subprocess.run([sys.executable,'-B',str(guard)],check=True)
+raise SystemExit(code)
diff --git a/scripts/acceptance/playback-smoothness-capability.py b/scripts/acceptance/playback-smoothness-capability.py
new file mode 100644
index 00000000..b28f22bd
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-capability.py
@@ -0,0 +1,39 @@
+"""Remove/restore only an owned staged link; runtime bytes and the release stay intact."""
+import hashlib
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+import time
+
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra');TASK='playback-smoothness-20261004'
+env=os.environ.copy();env.update(TEMP=str(BASE/'tmp'/TASK),TMP=str(BASE/'tmp'/TASK))
+proc=subprocess.Popen([sys.executable,'-B',str(ROOT/'scripts/acceptance/playback-smoothness-baseline.py'),
+ 'candidate','capability','capability-v1','--wait'],cwd=ROOT,env=env,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True,encoding='utf8')
+receipt=json.loads(proc.stdout.readline());print(json.dumps(receipt),flush=True)
+app=Path(receipt['app']).resolve()
+assert app.is_relative_to((BASE/'tests'/TASK).resolve())
+src=app/'runtime/nvidia-vfg/nvVFXVideoFrameGeneration.dll'
+missing=src.with_suffix('.dll.disabled')
+assert src.is_file() and not missing.exists()
+before=hashlib.sha256(src.read_bytes()).hexdigest()
+log=Path(receipt['logs'])/'player.log'
+def wait_marker(marker):
+ deadline=time.monotonic()+12
+ while time.monotonic()<deadline and proc.poll() is None:
+ if log.exists() and marker in log.read_text(encoding='utf8',errors='replace'):return
+ time.sleep(.03)
+ raise RuntimeError('Missing marker '+marker)
+try:
+ wait_marker('PLAYBACK_CAPABILITY_READY')
+ src.rename(missing)
+ wait_marker('PLAYBACK_CAPABILITY_MISSING_PASS')
+ missing.rename(src)
+ output=proc.communicate(timeout=45)[0];print(output.strip(),flush=True)
+ assert proc.returncode==0,proc.returncode
+finally:
+ if missing.exists():missing.rename(src)
+ assert hashlib.sha256(src.read_bytes()).hexdigest()==before
+print('RUNTIME BYTES RESTORED',before)
diff --git a/scripts/acceptance/playback-smoothness-capability.qml b/scripts/acceptance/playback-smoothness-capability.qml
new file mode 100644
index 00000000..51c1b409
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-capability.qml
@@ -0,0 +1,45 @@
+import QtQuick
+Item {
+ id: test
+ property string media: ""
+ property string mode: "capability"
+ property bool available: veyra.effectCapabilities.vfg.available
+ property int phase: 0
+ property int ticks: 0
+ property double started: 0
+ function require(ok,why) {
+ if(ok)return
+ console.error("PLAYBACK_CAPABILITY_FAIL",why)
+ timer.stop();Qt.quit();throw new Error(why)
+ }
+ Timer {
+ id: timer;interval:200;running:true;repeat:true
+ onTriggered: {
+ ++test.ticks;test.require(test.ticks<150,"30-second deadline")
+ if(test.phase===0){
+ veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false
+ test.require(test.available,"VFG must initially be present on the test GPU")
+ console.log("PLAYBACK_CAPABILITY_READY");test.started=Date.now();test.phase=1;return
+ }
+ if(test.phase===1){
+ if(Date.now()-test.started<400)return
+ veyra.lowLatency=!veyra.lowLatency
+ console.log("PLAYBACK_CAPABILITY_ACTION_READ",veyra.effectCapabilities.vfg.available,test.available)
+ test.require(!veyra.effectCapabilities.vfg.available,"missing component not found by action validation")
+ test.started=Date.now();test.phase=2;return
+ }
+ if(test.phase===2){
+ if(test.available){test.require(Date.now()-test.started<6000,"QML binding stayed enabled after missing component");return}
+ const choice=veyra.fgBackendChoices.filter(c=>c.id==="vfg")[0]
+ test.require(choice.disabled,"missing VFG menu not gray")
+ console.log("PLAYBACK_CAPABILITY_MISSING_PASS");test.started=Date.now();test.phase=3;return
+ }
+ if(test.phase===3){
+ if(!test.available){test.require(Date.now()-test.started<6000,"QML binding never saw restored component");return}
+ const choice=veyra.fgBackendChoices.filter(c=>c.id==="vfg")[0]
+ test.require(!choice.disabled,"restored VFG menu stays gray")
+ console.log("PLAYBACK_CAPABILITY_PASS");Qt.quit()
+ }
+ }
+ }
+}
diff --git a/scripts/acceptance/playback-smoothness-control.py b/scripts/acceptance/playback-smoothness-control.py
new file mode 100644
index 00000000..8fcbe4dd
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-control.py
@@ -0,0 +1,28 @@
+"""Bound this local repair to playback rate, subtitles and measured smoothness."""
+from pathlib import Path
+import subprocess
+
+ROOT = Path(__file__).resolve().parents[2]
+BASE = 'fb8e5001a7ba8424aeddda002d9ca19a79e68f2f'
+MAIN = '354b1c6e39ba0f62b2e6aac4c161f682dea9c2ff'
+allowed = {
+ 'src/ui/QmlPlayerBridge.cpp', 'include/veyra/ui/QmlPlayerBridge.h',
+ 'include/veyra/ui/PlaybackPowerGuard.h', 'include/veyra/engine/PlaybackRate.h',
+ 'src/engine/EngineController.cpp', 'src/engine/Subtitles.cpp',
+ 'src/sink/WasapiAudioSink.cpp', 'apps/veyra/ui/SubtitleOverlay.cpp',
+ 'apps/veyra-qml/main.cpp', 'qml/Veyra/PlaybackRateButton.qml',
+ 'qml/Veyra/PlaybackRateDialog.qml', 'qml/Veyra/qmldir',
+ 'qml/Veyra/CineBar.qml', 'qml/Veyra/ProPage.qml', 'qml/Veyra/Main.qml',
+ 'tests/integration/AudioPlaybackRateTests.cpp',
+ 'tests/integration/SubtitleTextTests.cpp', 'tests/integration/SubtitleOverlayTests.cpp',
+ 'CMakeLists.txt', 'i18n/catalog.json', 'docs/WORKLOG.md', 'docs/CURRENT_STATUS.md',
+ 'docs/PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md', 'docs/SUBTITLE_ENGINE_2026-09-16.md',
+}
+git = ['git', '-c', 'core.safecrlf=false']
+paths = set(subprocess.check_output([*git, 'diff', '--name-only', BASE], cwd=ROOT).decode().splitlines())
+paths.update(subprocess.check_output([*git, 'ls-files', '--others', '--exclude-standard'], cwd=ROOT).decode().splitlines())
+assert not [p for p in paths if p not in allowed and not p.startswith('scripts/acceptance/playback-smoothness-')], paths
+assert not [p for p in paths if Path(p).suffix.lower() in {'.dll', '.exe', '.lib', '.pdb', '.hsaco', '.ptx', '.onnx', '.bin', '.f16'}]
+assert subprocess.check_output(['git', 'rev-parse', 'main'], cwd=ROOT).decode().strip() == MAIN
+subprocess.run([*git, 'diff', '--check'], cwd=ROOT, check=True)
+print('Playback repair scope PASS:', len(paths), 'source paths; main unchanged')
diff --git a/scripts/acceptance/playback-smoothness-deliver.py b/scripts/acceptance/playback-smoothness-deliver.py
new file mode 100644
index 00000000..2a43c9dd
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-deliver.py
@@ -0,0 +1,100 @@
+"""Create an isolated complete NVIDIA candidate from verified manifest files."""
+import hashlib
+import importlib.util
+import json
+import os
+from pathlib import Path
+import shutil
+import subprocess
+import sys
+
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra');TASK='playback-smoothness-20261004';LABEL='2.0.3-smoothfix'
+OUT=BASE/'test-packages'/TASK;LOGS=BASE/'logs'/TASK;TMP=BASE/'tmp'/TASK
+APP=OUT/('Veyra-'+LABEL+'-NVIDIA-win64-portable')
+PUBLISHED=BASE/'releases/release-2.0.3-20261004/Veyra-2.0.3-NVIDIA-win64-portable'
+
+def digest(path):
+ with path.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
+def write(path,data):path.write_text(json.dumps(data,ensure_ascii=False,indent=2)+'\n',encoding='utf8')
+def module(name,path):
+ spec=importlib.util.spec_from_file_location(name,path)
+ result=importlib.util.module_from_spec(spec);spec.loader.exec_module(result);return result
+
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/playback-smoothness-control.py')],cwd=ROOT,check=True)
+assert not subprocess.check_output(['git','status','--porcelain'],cwd=ROOT).strip(),'Commit reviewed source before packaging'
+commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT).decode().strip()
+assert all(r['passed'] for r in json.loads((LOGS/'native-tests.json').read_text(encoding='utf8')))
+for test in ('functional-v5-final','layout-fullscreen-v4-final','capability-v1','candidate-software-v2-final','candidate-vfg4-v2-final'):
+ assert json.loads((BASE/'tests'/TASK/test/'result.json').read_text(encoding='utf8'))['passed'],test
+pkg=module('smooth_qml_package',ROOT/'scripts/package-qml-release.py')
+vendor=module('smooth_vendor_package',ROOT/'scripts/package-vendor-release.py')
+old=json.loads((PUBLISHED/'package-manifest.json').read_text(encoding='utf8'))
+OUT.mkdir(parents=True,exist_ok=False);APP.mkdir()
+for row in old['files']:
+ src=PUBLISHED/row['path'];dst=APP/row['path']
+ assert src.stat().st_size==row['size'] and digest(src)==row['sha256'],('Published identity',row['path'])
+ pkg.validate_payload(row['path']);dst.parent.mkdir(parents=True,exist_ok=True)
+ shutil.copyfile(src,dst)
+shutil.copyfile(BASE/'build'/TASK/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')
+shutil.copytree(ROOT/'qml/Veyra',APP/'qml/Veyra',dirs_exist_ok=True)
+docs=('PLAYBACK_SMOOTHNESS_PLAN_2026-10-04.md','SUBTITLE_ENGINE_2026-09-16.md',
+ 'RTSS_RESTART_LOOP_PLAN_2026-10-04.md','RTSS_COMPAT_2026-10-03.md')
+for name in docs:
+ dst=APP/'docs'/name;dst.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(ROOT/'docs'/name,dst)
+(APP/'本地修复说明.md').write_text('''# Veyra 2.0.3-smoothfix 本地测试包(NVIDIA)
+
+运行本目录的 veyra_qml_ui.exe,基础依赖与已审计运行组件齐全。
+
+- 自定义文件播放速度 0.25~4.00 倍,支持两位小数,保持原有音调。
+- 修复内嵌字幕正文逗号被吃掉、两行/三行字幕缺失及 VTT 的 CRLF。
+- 能力查询不再随播放快照反复访问磁盘/重建菜单,保留替换组件发现与灰色入口。
+- 专业模式只在顶部保留输入信息,输出分辨率放在旁边;窄窗口进度与按钮分行。
+- 修复倍速菜单裁剪/提示覆盖;自定义窗口可接受键盘输入。
+- 最大化窗口退出全屏后恢复最大化,普通窗口恢复原尺寸。
+- 包含此前本地 RTSS 误报与兼容重启循环修复。
+
+RTX5070 / 616.56 短测:音频18组、字幕30个作者cue、硬件能力56组,
+真实Qt播放/自定义倍速/字幕/菜单/720–1600宽度/全屏恢复均通过。
+软件UI后台DLSS6X提交约180fps、UI计时采样中位16ms;VFG4X提交中位约115fps。
+这些是软件提交/计时指标,不能当作屏幕实际刷新率或端到端延迟。
+用户报告的严重后台掉帧尚未复现,未找到根因;显示ETW采集被本机权限拒绝。
+新增焦点/吞吐/系统进程节流日志可辅助进一步定位。未新增AMD实卡验收。
+
+此包未合入 main,未上传/替换 GitHub 2.0.3;与原正式包分开保存。
+运行库字节、许可证与GPU分包规则保持;不包含AMD NR、SDK、测试媒体、个人配置或日志。
+源码ZIP在上级目录,原依赖源码沿用已发布2.0.3资产。完整证据在本机logs任务目录。
+''',encoding='utf8')
+names=vendor.check_vendor(APP,'NVIDIA')
+for name in names:
+ pkg.validate_payload(name)
+ if name.startswith('qml/Veyra/') and name.endswith('.qml'):
+ assert 'scripts/acceptance/' not in (APP/name).read_text(encoding='utf8',errors='ignore'),'Acceptance loader in product'
+changed=[r['path'] for r in old['files'] if digest(APP/r['path'])!=r['sha256']]
+allowed={'veyra_qml_ui.exe','docs/RTSS_COMPAT_2026-10-03.md'}
+allowed.update(p for p in subprocess.check_output(['git','diff','--name-only','f82f6499ff0db9c36953bcafb752b9be2d7fca4d',commit],cwd=ROOT).decode().splitlines() if p.startswith('qml/Veyra/'))
+assert set(changed)<=allowed,changed
+rows=[dict(path=f.relative_to(APP).as_posix(),size=f.stat().st_size,sha256=digest(f)) for f in sorted(APP.rglob('*')) if f.is_file() and f.name!='package-manifest.json']
+source_name='Veyra-'+LABEL+'-veyra-source.zip'
+manifest={k:v for k,v in old.items() if k!='files'}
+manifest.update(candidate=LABEL,displayVersion=LABEL,baseCommit=commit,sourceArchiveCommit=commit,
+ worktreeDirty=False,releaseReady=False,localOnly=True,publishedBase='f82f6499ff0db9c36953bcafb752b9be2d7fca4d',
+ correspondingSource=dict(application='../'+source_name,dependencies=old['correspondingSource']['dependencies'],
+ instructions='docs/BUILD_2.0.3.md',displayVersionOverride='-DVEYRA_DISPLAY_VERSION='+LABEL),files=rows)
+write(APP/'package-manifest.json',manifest)
+audit=TMP/'smooth-package-audit.py'
+original=(ROOT/'scripts/acceptance/release-2.0.3-package-audit.py').read_text(encoding='utf8')
+assert original.count("TASK='release-2.0.3-20261004'")==1
+audit.write_text(original.replace("TASK='release-2.0.3-20261004'","TASK='"+TASK+"'"),encoding='utf8')
+env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP))
+subprocess.run([sys.executable,'-B',str(audit),str(APP),'NVIDIA','local-package-audit'],env=env,check=True,timeout=150)
+source=pkg.source_snapshot(OUT,LABEL,digest(APP/'veyra_qml_ui.exe'))
+patch=subprocess.check_output(['git','diff','--binary','354b1c6e39ba0f62b2e6aac4c161f682dea9c2ff',commit],cwd=ROOT)
+(BASE/'archives'/TASK/'repair-source.patch').write_bytes(patch)
+write(OUT/'DELIVERY.json',dict(candidate=LABEL,app=str(APP/'veyra_qml_ui.exe'),appSHA256=digest(APP/'veyra_qml_ui.exe'),
+ sourceCommit=commit,source=str(OUT/source_name),sourceSHA256=source['sha256'],
+ packageManifestSHA256=digest(APP/'package-manifest.json'),payloadFiles=len(rows),
+ changedPublishedPayload=changed,localOnly=True,releaseReady=False,
+ backgroundRootCauseFound=False,logs=str(LOGS),
+ limitation='RTX5070/616.56 short tests; severe background drops not reproduced; ETW display events unavailable without privileges; AMD real hardware not tested'))
+print('PLAYBACK LOCAL DELIVERY PASS',commit,len(rows),OUT,flush=True)
diff --git a/scripts/acceptance/playback-smoothness-fixtures.py b/scripts/acceptance/playback-smoothness-fixtures.py
new file mode 100644
index 00000000..064e83bc
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-fixtures.py
@@ -0,0 +1,27 @@
+"""Generate authored comma/multiline subtitles, an MKV and a PCM tempo fixture."""
+from pathlib import Path
+import os
+import shutil
+import subprocess
+
+BASE=Path('E:/项目/Veyra'); TASK='playback-smoothness-20261004'
+OUT=BASE/'tests'/TASK/'fixtures'; TMP=BASE/'tmp'/TASK/'fixtures'; LOGS=BASE/'logs'/TASK
+for p in (OUT,TMP,LOGS):p.mkdir(parents=True,exist_ok=True)
+text=['It is over, Sauron.','Ka-Zar, I warn you!','Your reign of terror over\nthe Savage Land ends now!',
+ 'I am Zaladane,\nHigh Priestess of\nthe Sun God, Garokk.','中文,第一行\nEnglish, second line\n第三行, 原样保留',
+ 'A, B, C, D, E, F, G, H, I, J, K.']
+def clock(s,sep=','):return f'00:00:{s:06.3f}'.replace('.',sep)
+srt='\n\n'.join(f'{i+1}\n{clock(i*3)} --> {clock(i*3+2.5)}\n{t}' for i,t in enumerate(text))+'\n'
+(OUT/'golden.srt').write_text(srt,encoding='utf8')
+(OUT/'golden.vtt').write_text('WEBVTT\n\n'+srt.replace(',000','.000').replace(',500','.500'),encoding='utf8')
+header='[Script Info]\nScriptType: v4.00+\nPlayResX: 1920\nPlayResY: 1080\n[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\nStyle: Default,Arial,28,&H00FFFFFF,&H000000FF,&H00000000,&H80000000,0,0,0,0,100,100,0,0,1,2,0,2,10,10,10,1\n[Events]\nFormat: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n'
+events=[]
+for i,t in enumerate(text):events.append(f'Dialogue: 0,0:00:{i*3:05.2f},0:00:{i*3+2.5:05.2f},Default,,0,0,0,,'+t.replace('\n',r'\N'))
+(OUT/'golden.ass').write_text(header+'\n'.join(events)+'\n',encoding='utf8')
+env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP))
+ffmpeg=shutil.which('ffmpeg'); assert ffmpeg
+with (LOGS/'fixtures.log').open('x',encoding='utf8') as out:
+ args=['-hide_banner','-y','-i',str(BASE/'tests/rtss-restart-loop-20261004/rtss-stress-2k30.mp4'),'-i',str(OUT/'golden.srt'),'-i',str(OUT/'golden.ass'),'-t','20','-map','0:v','-map','1:s','-map','2:s','-c','copy',str(OUT/'golden.mkv')]
+ subprocess.run([ffmpeg,*args],env=env,stdout=out,stderr=subprocess.STDOUT,timeout=60,check=True)
+ subprocess.run([ffmpeg,'-hide_banner','-y','-f','lavfi','-i','sine=frequency=440:sample_rate=48000:duration=5','-c:a','pcm_s16le',str(OUT/'tone.wav')],env=env,stdout=out,stderr=subprocess.STDOUT,timeout=30,check=True)
+print(OUT)
diff --git a/scripts/acceptance/playback-smoothness-functional.qml b/scripts/acceptance/playback-smoothness-functional.qml
new file mode 100644
index 00000000..3b3ac681
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-functional.qml
@@ -0,0 +1,141 @@
+import QtQuick
+import QtQuick.Controls
+import Veyra
+Item {
+ id: test
+ property var appWindow: Window.window
+ property string media: ""
+ property string mode: ""
+ property int phase: 0
+ property int waited: 0
+ property int rateIndex: 0
+ property var rates: [1.3,1.8,.25,4,1]
+ property double started: 0
+ property double position: 0
+ property bool subtitleSeen: false
+ property var barWindow: null
+ property var actualRateMenu: null
+ property var actualRateDialog: null
+ function require(ok,message) {
+ if(ok)return
+ console.error("PLAYBACK_FUNCTION_FAIL",phase,message,veyra.statusText)
+ timer.stop(); Qt.quit(); throw new Error(message)
+ }
+ function find(item,name,depth) {
+ if(!item)return null
+ depth=depth || 0
+ if(depth>20)return null
+ if(item.objectName===name)return item
+ const children=item.data || item.contentData || item.children || []
+ for(let k=0;k<children.length;++k){const found=find(children[k],name,depth+1);if(found)return found}
+ if(item.contentItem)return find(item.contentItem,name,depth+1)
+ return null
+ }
+ PlaybackRateDialog { id: rateDialog; objectName: "acceptance-rate" }
+ Connections {
+ target: veyra
+ function onSubtitleTextChanged() { console.log("PLAYBACK_SUBTITLE",JSON.stringify(veyra.subtitleText)) }
+ function onNotice(text,error) { console.log("PLAYBACK_FUNCTION_NOTICE",text,error) }
+ }
+ Timer {
+ id: timer
+ interval: 200; running: true; repeat: true
+ onTriggered: {
+ ++test.waited
+ if(test.waited>600){test.require(false,"120-second deadline");return}
+ if(!test.media.length)return
+ test.require(!veyra.failed,"source failed")
+ if(test.phase===0){
+ veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false
+ veyra.openPath(test.media);test.phase=1;return
+ }
+ if(test.phase===1){
+ if(!veyra.running||veyra.position<.3||veyra.applying)return
+ test.require(veyra.effectCapabilities.nr4.available===false,"NVIDIA must keep AMD NR unavailable")
+ test.require(veyra.effectCapabilities.fsr4.available===false,"NVIDIA must keep FSR4 FG unavailable")
+ test.phase=2;return
+ }
+ if(test.phase===2){
+ if(!veyra.subtitleText.includes("It is over, Sauron."))return
+ test.subtitleSeen=true;veyra.togglePlayPause();veyra.seekTo(9.5);test.phase=3;return
+ }
+ if(test.phase===3){
+ if(Math.abs(veyra.position-9.5)>.2||!veyra.paused)return
+ if(veyra.subtitleText!=="I am Zaladane,\nHigh Priestess of\nthe Sun God, Garokk.")return
+ console.log("PLAYBACK_SUBTITLE_THREE_LINES_PASS",JSON.stringify(veyra.subtitleText))
+ test.started=Date.now();test.phase=4;return
+ }
+ if(test.phase===4){
+ // Leave the true native overlay visible long enough to inspect.
+ if(Date.now()-test.started<4500)return
+ veyra.seekTo(0);veyra.togglePlayPause();test.phase=5;return
+ }
+ if(test.phase===5){
+ if(veyra.paused||veyra.applying||veyra.position>1.0)return
+ rateDialog.open();const input=test.find(rateDialog.contentItem,"acceptance-rate-input")
+ test.require(!!input,"custom dialog field missing")
+ input.text=String(test.rates[test.rateIndex]);rateDialog.applyRate()
+ test.require(Math.abs(veyra.playbackRate-test.rates[test.rateIndex])<.000001,"rate was refused")
+ test.phase=6;test.started=Date.now();return
+ }
+ if(test.phase===6){
+ if(Date.now()-test.started<1200)return
+ test.position=veyra.position;test.started=Date.now();test.phase=7;return
+ }
+ if(test.phase===7){
+ if(Date.now()-test.started<1800)return
+ const measured=(veyra.position-test.position)/((Date.now()-test.started)/1000)
+ test.require(Math.abs(measured-test.rates[test.rateIndex])<Math.max(.18,test.rates[test.rateIndex]*.18),"media PTS speed mismatch")
+ console.log("PLAYBACK_RATE_REAL_PASS",test.rates[test.rateIndex],measured,test.appWindow.page)
+ ++test.rateIndex
+ if(test.rateIndex<test.rates.length){veyra.seekTo(0);test.phase=5;return}
+ const before=veyra.playbackRate
+ rateDialog.open();const input=test.find(rateDialog.contentItem,"acceptance-rate-input")
+ input.text="4.01";rateDialog.applyRate()
+ test.require(rateDialog.opened&&veyra.playbackRate===before&&rateDialog.errorText.length>0,"invalid value must keep dialog and actual speed")
+ rateDialog.close();rateDialog.open();input.text="1.8";rateDialog.close()
+ test.require(veyra.playbackRate===before,"cancel changed actual speed")
+ veyra.playbackRate=NaN;test.require(veyra.playbackRate===before,"NaN accepted")
+ test.appWindow.page="min";test.appWindow.toggleFullscreen();test.phase=8;return
+ }
+ if(test.phase===8){
+ if(!test.appWindow.fullscreen)return
+ rateDialog.open();const input=test.find(rateDialog.contentItem,"acceptance-rate-input")
+ input.text="1.8";rateDialog.applyRate()
+ test.require(veyra.playbackRate===1.8,"fullscreen custom rate refused")
+ test.appWindow.toggleFullscreen();test.phase=9;test.started=Date.now();return
+ }
+ if(test.phase===9){
+ if(test.appWindow.fullscreen||Date.now()-test.started<1000)return
+ test.barWindow=test.find(test.appWindow,"fullscreenBar")
+ test.require(!!test.barWindow,"actual floating cinema window missing")
+ const button=test.find(test.barWindow,"cine-playback-rate")
+ test.require(!!button,"actual cinema rate button missing")
+ test.actualRateMenu=test.find(button,"cine-playback-rate-menu")
+ test.actualRateDialog=test.find(button,"cine-playback-rate-custom")
+ test.require(!!test.actualRateMenu&&!!test.actualRateDialog,"actual cinema popups missing")
+ test.actualRateMenu.openAt(button,"up");test.phase=10;test.started=Date.now();return
+ }
+ if(test.phase===10){
+ if(Date.now()-test.started<800)return
+ test.require(test.barWindow.menuOpen,"rate menu omitted from floating-window mask")
+ test.require(test.barWindow.hitRect.height===test.barWindow.height,"menu mask cuts off speed options")
+ test.require(test.actualRateMenu.y+test.actualRateMenu.height<=test.barWindow.menuRoom-15,"rate menu overlaps playback pill")
+ console.log("PLAYBACK_CINEMA_MENU_MASK_PASS",test.barWindow.hitRect.height,test.actualRateMenu.y,test.actualRateMenu.height)
+ test.actualRateMenu.close();test.actualRateDialog.open();test.phase=11;test.started=Date.now();return
+ }
+ if(test.phase===11){
+ if(Date.now()-test.started<800)return
+ const popupWindow=test.actualRateDialog.contentItem.Window.window
+ const field=test.find(test.actualRateDialog.contentItem,"cine-playback-rate-custom-input")
+ test.require(popupWindow!==test.barWindow && !(popupWindow.flags & Qt.WindowDoesNotAcceptFocus),"floating custom entry cannot accept keyboard focus")
+ test.require(field.activeFocus,"custom input has no active focus")
+ field.text="1.3";test.actualRateDialog.applyRate()
+ test.require(veyra.playbackRate===1.3,"actual cinema control did not apply custom rate")
+ console.log("PLAYBACK_CINEMA_MASK_FOCUS_PASS",test.barWindow.hitRect.height,test.actualRateMenu.y,test.actualRateMenu.height)
+ console.log("PLAYBACK_FUNCTION_PASS",test.rates.length,"comma+threeLines+invalid+cancel+fullscreen+vendor-gray")
+ Qt.quit()
+ }
+ }
+ }
+}
diff --git a/scripts/acceptance/playback-smoothness-i18n.py b/scripts/acceptance/playback-smoothness-i18n.py
new file mode 100644
index 00000000..54342816
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-i18n.py
@@ -0,0 +1,20 @@
+"""Add only this repair's user-visible translations, preserving the catalog."""
+import json
+from pathlib import Path
+p=Path(__file__).resolve().parents[2]/'i18n/catalog.json'
+data=json.loads(p.read_text(encoding='utf8'))
+translations=[
+ ('应用','套用','Apply','適用','PlaybackRateDialog.qml'),
+ ('自定义…','自訂…','Custom…','カスタム…','PlaybackRateButton.qml'),
+ ('自定义播放速度','自訂播放速度','Custom playback speed','カスタム再生速度','PlaybackRateDialog.qml'),
+ ('播放倍速','播放倍速','Playback speed','再生速度','PlaybackRateDialog.qml'),
+ ('范围 0.25~4.00 倍,保持原有音调','範圍 0.25~4.00 倍,保持原有音調','Range 0.25–4.00×, preserving pitch','範囲 0.25~4.00 倍、音程を維持','PlaybackRateDialog.qml'),
+ ('请输入 0.25~4.00 之间的倍速','請輸入 0.25~4.00 之間的倍速','Enter a speed between 0.25 and 4.00','0.25~4.00 の速度を入力してください','PlaybackRateDialog.qml'),
+ ('当前播放状态无法修改倍速','目前播放狀態無法修改倍速','Playback speed cannot be changed in the current state','現在の再生状態では速度を変更できません','PlaybackRateDialog.qml'),
+]
+for zh,tw,en,ja,source in translations:
+ old=next((e for e in data['entries'] if e['zh']==zh and not e.get('ctx')),None)
+ if old is None:
+ data['entries'].append(dict(zh=zh,src='qml/Veyra/'+source,**{'zh-TW':tw,'en':en,'ja':ja}))
+p.write_text(json.dumps(data,ensure_ascii=False,indent=1)+'\n',encoding='utf8')
+print('Custom rate translations:',len(translations))
diff --git a/scripts/acceptance/playback-smoothness-layout.qml b/scripts/acceptance/playback-smoothness-layout.qml
new file mode 100644
index 00000000..2c5d7ed4
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-layout.qml
@@ -0,0 +1,119 @@
+import QtQuick
+import QtQuick.Window
+Item {
+ id: test
+ property var win: Window.window
+ property string media: ""
+ property string mode: "layout"
+ property int phase: 0
+ property int ticks: 0
+ property double start: Date.now()
+ property var widths: [1280, 720, 1600]
+ property int index: 0
+ property var bar: null
+ property var menu: null
+ property size before: Qt.size(0,0)
+ function require(ok, why) {
+ if (ok) return
+ console.error("PLAYBACK_LAYOUT_FAIL", phase, why)
+ timer.stop(); Qt.quit(); throw new Error(why)
+ }
+ function find(item,name,depth) {
+ if(!item)return null
+ depth=depth||0
+ if(depth>20)return null
+ if(item.objectName===name)return item
+ const children=item.data||item.contentData||item.children||[]
+ for(let i=0;i<children.length;++i){const f=find(children[i],name,depth+1);if(f)return f}
+ if(item.contentItem)return find(item.contentItem,name,depth+1)
+ return null
+ }
+ function rect(item) {
+ const p=item.mapToItem(null,0,0)
+ return Qt.rect(p.x,p.y,item.width,item.height)
+ }
+ Timer {
+ id: timer
+ interval:200;running:true;repeat:true
+ onTriggered: {
+ ++test.ticks
+ test.require(test.ticks<350,"70-second deadline")
+ if(!test.media.length)return
+ if(test.phase===0){
+ veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false
+ veyra.openPath(test.media);test.phase=1;return
+ }
+ if(test.phase===1){
+ if(!veyra.running||veyra.applying)return
+ test.win.width=test.widths[test.index];test.win.height=800
+ test.start=Date.now();test.phase=2;return
+ }
+ if(test.phase===2){
+ if(Date.now()-test.start<1200)return
+ const header=test.find(test.win,"pro-header")
+ const format=test.find(test.win,"pro-format-tag")
+ const output=test.find(test.win,"pro-output-summary")
+ const actions=test.find(test.win,"pro-header-actions")
+ const seek=test.find(test.win,"pro-seek")
+ test.require(!!header&&!!format&&!!output&&!!actions&&!!seek,"professional controls missing")
+ const a=test.rect(format), b=test.rect(output), h=test.rect(header), c=test.rect(actions)
+ test.require(output.visible&&a.y===b.y&&b.x>=a.x+a.width&&b.x-a.x-a.width<=12,"output is not beside input")
+ test.require(b.x+b.width<=h.x+h.width+1&&c.x>=h.x-1&&c.x+c.width<=h.x+h.width+1,"header controls outside viewport")
+ test.require(!header.compact||c.y>=b.y+b.height,"narrow header rows overlap")
+ test.require(test.widths[test.index]!==1280||seek.width>=200,"seek bar remains crowded")
+ test.require(seek.width>=100,"narrow window has no usable seek bar")
+ console.log("PLAYBACK_PRO_LAYOUT_PASS",test.win.width,seek.width,header.height,JSON.stringify(b))
+ ++test.index
+ if(test.index<test.widths.length){test.phase=1;return}
+ test.win.width=1280;test.win.height=800;test.before=Qt.size(1280,800)
+ test.win.toggleFullscreen();test.start=Date.now();test.phase=3;return
+ }
+ if(test.phase===3){
+ if(Date.now()-test.start<2600)return
+ test.require(test.win.fullscreen,"fullscreen did not enter")
+ test.require(Math.abs(test.win.width-test.win.screen.width)<=2&&Math.abs(test.win.height-test.win.screen.height)<=2,"fullscreen does not cover monitor")
+ test.bar=test.find(test.win,"fullscreenBar")
+ test.require(!!test.bar,"fullscreen bar missing")
+ if(test.bar.hovered)console.log("PLAYBACK_FULLSCREEN_AUTOHIDE_SKIPPED","physical pointer is on controls")
+ else test.require(!test.win.fullControls&&!test.bar.visible,"idle fullscreen controls remain visible")
+ test.win.pointerActivity()
+ const button=test.find(test.bar,"cine-playback-rate")
+ test.menu=test.find(button,"cine-playback-rate-menu")
+ test.require(!!test.menu,"fullscreen rate menu missing")
+ test.menu.openAt(button,"up");test.start=Date.now();test.phase=4;return
+ }
+ if(test.phase===4){
+ if(Date.now()-test.start<2400)return
+ test.require(test.bar.menuOpen&&test.win.fullControls&&test.bar.visible,"open menu was hidden with fullscreen controls")
+ test.require(test.bar.hitRect.height===test.bar.height,"fullscreen menu is clipped")
+ test.menu.close();test.win.toggleLock();test.win.pointerActivity()
+ test.require(test.win.fullLocked&&!test.bar.shown,"locked controls responded to pointer activity")
+ test.win.toggleFullscreen();test.start=Date.now();test.phase=5;return
+ }
+ if(test.phase===5){
+ if(Date.now()-test.start<1200)return
+ test.require(!test.win.fullscreen&&!test.win.fullLocked,"fullscreen exit retained lock")
+ test.require(Math.abs(test.win.width-test.before.width)<=2&&Math.abs(test.win.height-test.before.height)<=2,"windowed geometry did not restore")
+ console.log("PLAYBACK_FULLSCREEN_WINDOWED_PASS",test.win.width,test.win.height)
+ test.win.toggleMaximized();test.start=Date.now();test.phase=6;return
+ }
+ if(test.phase===6){
+ if(Date.now()-test.start<1200)return
+ test.require(test.win.maximized,"maximize failed")
+ test.win.toggleFullscreen();test.start=Date.now();test.phase=7;return
+ }
+ if(test.phase===7){
+ if(Date.now()-test.start<1200)return
+ test.require(test.win.fullscreen,"maximized fullscreen did not enter")
+ test.win.toggleFullscreen();test.start=Date.now();test.phase=8;return
+ }
+ if(test.phase===8){
+ if(Date.now()-test.start<1200)return
+ test.require(test.win.maximized,"fullscreen exit lost the previous maximized state")
+ console.log("PLAYBACK_FULLSCREEN_MAXIMIZED_PASS")
+ console.log("PLAYBACK_LAYOUT_FULLSCREEN_PASS")
+ Qt.quit()
+ }
+ }
+ }
+}
diff --git a/scripts/acceptance/playback-smoothness-package-smoke.py b/scripts/acceptance/playback-smoothness-package-smoke.py
new file mode 100644
index 00000000..3d4e9476
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-package-smoke.py
@@ -0,0 +1,40 @@
+"""Start the sealed package with no SDK/path overrides; keep all runtime data outside."""
+import hashlib
+import json
+import os
+from pathlib import Path
+import subprocess
+
+BASE=Path('E:/项目/Veyra');TASK='playback-smoothness-20261004'
+OUT=BASE/'test-packages'/TASK
+APP=OUT/'Veyra-2.0.3-smoothfix-NVIDIA-win64-portable'
+manifest=json.loads((APP/'package-manifest.json').read_text(encoding='utf8'))
+results=[]
+for mode in ('gpu','software'):
+ run=BASE/'tests'/TASK/('sealed-'+mode);run.mkdir(parents=True,exist_ok=False)
+ tmp=BASE/'tmp'/TASK/('sealed-'+mode);tmp.mkdir(parents=True,exist_ok=False)
+ logs=BASE/'logs'/TASK/('sealed-'+mode);logs.mkdir(parents=True,exist_ok=False)
+ (run/'preferences.json').write_text(json.dumps({'language':'zh-CN','overlayCompat':'off'}),encoding='utf8')
+ env=os.environ.copy()
+ for name in list(env):
+ if name.startswith(('VEYRA_','QML_','QT_','QSG_')):env.pop(name)
+ env.update(TEMP=str(tmp),TMP=str(tmp),PATH=os.environ['WINDIR']+'/System32;'+os.environ['WINDIR'],
+ VEYRA_LOG_FILE=str(logs/'player.log'))
+ if mode=='software':env['QT_QUICK_BACKEND']='software'
+ with (logs/'console.log').open('x',encoding='utf8') as log:
+ code=subprocess.run([str(APP/'veyra_qml_ui.exe'),'--data-dir',str(run),'--page','pro',
+ '--exit-after','12000',str(BASE/'tests'/TASK/'fixtures/golden.mkv')],
+ cwd=APP,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=35).returncode
+ text=(logs/'player.log').read_text(encoding='utf8',errors='replace')
+ assert code==0 and '2.0.3-smoothfix' in text,(mode,code)
+ assert 'the Sun God, Garokk.' in text and 'Sauron.' in text,('actual embedded subtitle',mode)
+ assert not any(x in text for x in ('[ERROR]','[FATAL]','ReferenceError:','TypeError:')),mode
+ for row in manifest['files']:
+ f=APP/row['path']
+ with f.open('rb') as stream:sha=hashlib.file_digest(stream,'sha256').hexdigest()
+ assert f.stat().st_size==row['size'] and sha==row['sha256'],('Payload changed',row['path'])
+ names={f.relative_to(APP).as_posix() for f in APP.rglob('*') if f.is_file()}
+ assert names=={r['path'] for r in manifest['files']}|{'package-manifest.json'},('Unlisted files',names)
+ results.append(dict(mode=mode,exitCode=code,passed=True,logs=str(logs),verifiedPayloadFiles=len(manifest['files'])))
+ print('SEALED PACKAGE SMOKE PASS',mode,len(manifest['files']),flush=True)
+(OUT/'package-smoke.json').write_text(json.dumps(results,indent=2),encoding='utf8')
diff --git a/scripts/acceptance/playback-smoothness-presentmon.py b/scripts/acceptance/playback-smoothness-presentmon.py
new file mode 100644
index 00000000..5aa08306
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-presentmon.py
@@ -0,0 +1,37 @@
+"""Read display events for this owned player only; no input, injection or elevation."""
+import csv
+import hashlib
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra');TASK='playback-smoothness-20261004'
+logs=BASE/'logs'/TASK
+tool=BASE/'deps/rtss-overlay-20261002/Plugins/Client/PresentMonDataProvider/PresentMon-2.3.1-x64.exe'
+env=os.environ.copy();env.update(TEMP=str(BASE/'tmp'/TASK),TMP=str(BASE/'tmp'/TASK))
+launcher=subprocess.Popen([sys.executable,'-B',str(ROOT/'scripts/acceptance/playback-smoothness-baseline.py'),
+ 'candidate','dlss6','candidate-display-v1','short','--wait'],cwd=ROOT,env=env,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True,encoding='utf8')
+line=launcher.stdout.readline();print(line.strip(),flush=True)
+receipt=json.loads(line)
+csv_path=logs/'candidate-display-v1/frames.csv'
+args=[str(tool),'--process_id',str(receipt['pid']),'--session_name','VeyraSmooth-'+str(os.getpid()),
+ '--timed','35','--terminate_after_timed','--terminate_on_proc_exit','--output_file',str(csv_path),
+ '--no_console_stats','--no_track_input','--date_time']
+with (logs/'candidate-display-v1/presentmon-console.log').open('x',encoding='utf8') as out:
+ try:code=subprocess.run(args,env=env,cwd=BASE/'tmp'/TASK,stdout=out,stderr=subprocess.STDOUT,timeout=45).returncode
+ except subprocess.TimeoutExpired:code=124
+tail=launcher.communicate(timeout=280)[0];print(tail.strip(),flush=True)
+rows=[]
+if csv_path.exists():
+ with csv_path.open(encoding='utf-8-sig',newline='') as f:rows=list(csv.DictReader(f))
+result=dict(player=receipt,playerLauncherExit=launcher.returncode,tool=str(tool),
+ toolSHA256=hashlib.sha256(tool.read_bytes()).hexdigest(),toolExit=code,
+ rows=len(rows),columns=list(rows[0]) if rows else [],
+ firstRows=rows[:3],csv=str(csv_path),
+ limitation='ETW display events are not physical screen latency; no desktop input or elevation requested.')
+(logs/'candidate-display-v1/display-result.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')
+print(json.dumps(result,ensure_ascii=False,indent=2))
+raise SystemExit(launcher.returncode or (0 if code==0 and rows else 1))
diff --git a/scripts/acceptance/playback-smoothness-probe.qml b/scripts/acceptance/playback-smoothness-probe.qml
new file mode 100644
index 00000000..a81bdce4
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-probe.qml
@@ -0,0 +1,64 @@
+import QtQuick
+Item {
+ id: probe
+ property var appWindow: Window.window
+ property string media: ""
+ property string mode: "plain"
+ property int limit: 220
+ property int ticks: 0
+ property double previous: 0
+ property var intervals: []
+ property double started: Date.now()
+ property int notifications: 0
+ Connections {
+ target: veyra
+ ignoreUnknownSignals: true
+ function onFgChoicesChanged() { ++probe.notifications }
+ function onNotice(text, error) { console.log("SMOOTH_NOTICE", text, error) }
+ }
+ Timer {
+ interval: 16; running: true; repeat: true
+ onTriggered: {
+ const now = Date.now()
+ if (probe.previous) probe.intervals.push(now - probe.previous)
+ probe.previous = now
+ }
+ }
+ Timer {
+ interval: 1000; running: true; repeat: true
+ onTriggered: {
+ ++probe.ticks
+ if (probe.ticks === 1) {
+ probe.appWindow.width = 1280; probe.appWindow.height = 800
+ veyra.muted = true
+ veyra.nrEnabled = false; veyra.srEnabled = false; veyra.fgEnabled = false
+ if (probe.mode === "heavy") {
+ veyra.nrEnabled = true; veyra.srEnabled = true
+ veyra.videoSrQuality = 4; veyra.srTargetIndex = 2
+ veyra.fgBackendName = "dlss"; veyra.fgMultiplier = 2; veyra.fgEnabled = true
+ }
+ if (probe.mode === "dlss6" || probe.mode === "vfg4") {
+ veyra.fgBackendName = probe.mode === "dlss6" ? "dlss" : "vfg"
+ veyra.fgMultiplier = probe.mode === "dlss6" ? 6 : 4
+ veyra.vfgQuality = 1; veyra.fgEnabled = true
+ }
+ veyra.openPath(probe.media)
+ }
+ const a = probe.intervals.sort((a,b) => a-b)
+ const percentile = p => a.length ? a[Math.min(a.length-1,Math.floor(a.length*p))] : 0
+ console.log("SMOOTH_SAMPLE", JSON.stringify({seconds:(Date.now()-probe.started)/1000,
+ active:probe.appWindow.active, visibility:probe.appWindow.visibility,
+ p50:percentile(.5), p95:percentile(.95), max:percentile(1), count:a.length,
+ fgNotifications:probe.notifications, running:veyra.running, position:veyra.position,
+ fps:veyra.submitFps, detail:veyra.runStatusDetail,
+ nr:veyra.nrActive,sr:veyra.srActive,fg:veyra.fgActive,failed:veyra.failed}))
+ probe.intervals=[]; probe.notifications=0
+ if (probe.ticks === 6 && veyra.effectCapabilities !== undefined) {
+ const begin=Date.now(); let available=0
+ for(let k=0;k<100;++k) available += veyra.effectCapabilities.nr0.available ? 1 : 0
+ console.log("SMOOTH_GETTER_100", Date.now()-begin, available)
+ }
+ if (probe.ticks >= probe.limit) Qt.quit()
+ }
+ }
+}
diff --git a/scripts/acceptance/playback-smoothness-report.py b/scripts/acceptance/playback-smoothness-report.py
new file mode 100644
index 00000000..db6ea1ad
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-report.py
@@ -0,0 +1,49 @@
+"""Summarize actual timer samples and focus states without claiming a root cause."""
+import json
+from pathlib import Path
+import statistics
+
+BASE=Path('E:/项目/Veyra');TASK='playback-smoothness-20261004'
+logs=BASE/'logs'/TASK
+labels=['baseline-202-plain','baseline-203-plain','candidate-plain-v1',
+ 'baseline-203-heavy','baseline-203-dlss6','candidate-dlss6-v1',
+ 'baseline-203-software','candidate-software-v2-final','candidate-vfg4-v2-final']
+report={'sampleWindowSeconds':[12,140],
+ 'metrics':'Qt 16ms Timer interval; engine submitted FPS, not screen scanout',
+ 'backgroundRootCauseFound':False,
+ 'limitations':[
+ 'Baseline203 plain later samples overlapped the initial build; not a fair isolated worst-case comparison.',
+ 'Active/inactive warmup and unequal counts prevent attributing every difference to focus.',
+ 'No physical screen latency/refresh measurement or AMD real-hardware validation.',
+ 'Computer Use stopped by user; final Qt integration tests send no desktop input.'
+ ],'comparisons':[]}
+for label in labels:
+ path=logs/label/'player.log'
+ if not path.exists():continue
+ text=path.read_text(encoding='utf8',errors='replace')
+ samples=[]
+ for line in text.splitlines():
+ if 'SMOOTH_SAMPLE ' not in line:continue
+ sample=json.loads(line.split('SMOOTH_SAMPLE ',1)[1])
+ if 12<=sample['seconds']<=140 and sample['running'] and not sample['failed']:
+ samples.append(sample)
+ groups={}
+ for active in (True,False):
+ chosen=[s for s in samples if s['active']==active]
+ if not chosen:continue
+ groups['foreground' if active else 'background']={
+ 'samples':len(chosen),
+ **{k:statistics.median(s[k] for s in chosen) for k in ('p50','p95','fps','fgNotifications')},
+ 'effects':{k:any(s[k] for s in chosen) for k in ('nr','sr','fg')},
+ 'visibility':sorted(set(s['visibility'] for s in chosen))}
+ getter=[line.split('SMOOTH_GETTER_100 ',1)[1] for line in text.splitlines() if 'SMOOTH_GETTER_100 ' in line]
+ report['comparisons'].append(dict(label=label,log=str(path),groups=groups,getter100=getter))
+report['nativeTests']=json.loads((logs/'native-tests.json').read_text(encoding='utf8'))
+report['functional']=json.loads((BASE/'tests'/TASK/'functional-v5-final/result.json').read_text(encoding='utf8'))
+report['layoutFullscreen']=json.loads((BASE/'tests'/TASK/'layout-fullscreen-v4-final/result.json').read_text(encoding='utf8'))
+report['capabilityReplacement']=json.loads((BASE/'tests'/TASK/'capability-v1/result.json').read_text(encoding='utf8'))
+report['displayEvents']=json.loads((logs/'candidate-display-v1/display-result.json').read_text(encoding='utf8'))
+out=logs/'acceptance-summary.json'
+out.write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n',encoding='utf8')
+print(json.dumps(report['comparisons'],ensure_ascii=False,indent=2))
+print(out)
diff --git a/scripts/acceptance/playback-smoothness-tests.py b/scripts/acceptance/playback-smoothness-tests.py
new file mode 100644
index 00000000..ce945a9c
--- /dev/null
+++ b/scripts/acceptance/playback-smoothness-tests.py
@@ -0,0 +1,31 @@
+"""Bounded native rate, subtitle, overlay, language and hardware-map regressions."""
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+
+BASE=Path('E:/项目/Veyra');TASK='playback-smoothness-20261004'
+build=BASE/'build'/TASK;logs=BASE/'logs'/TASK;tmp=BASE/'tmp'/TASK
+env=os.environ.copy()
+env.update(TEMP=str(tmp),TMP=str(tmp),PATH=';'.join([
+ 'C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64/bin',
+ 'C:/veyra-deps/ffmpeg-ps5-dav1d-installed/bin',
+ 'C:/veyra-deps/tools-installed/x64-windows/bin',env['PATH']]))
+fixtures=BASE/'tests'/TASK/'fixtures'
+cases=[('audio-rates-v3','veyra_audio_playback_rate_tests',[str(fixtures/'tone.wav')]),
+ ('subtitle-after-v2','veyra_subtitle_text_tests',[str(fixtures)]),
+ ('overlay-v3','veyra_subtitle_overlay_tests',[]),
+ ('i18n-v2','veyra_ui_i18n_tests',[]),
+ ('availability-v1','veyra_effect_availability_tests',[])]
+results=[]
+for label,target,args in cases:
+ log=logs/(label+'.log')
+ with log.open('x',encoding='utf8') as out:
+ try:code=subprocess.run([str(build/(target+'.exe')),*args],env=env,cwd=tmp,stdout=out,stderr=subprocess.STDOUT,timeout=250).returncode
+ except subprocess.TimeoutExpired:code=124
+ print(label,code,log,flush=True)
+ results.append(dict(test=target,log=str(log),exitCode=code,passed=code==0))
+assert not (logs/'native-tests.json').exists()
+(logs/'native-tests.json').write_text(json.dumps(results,indent=2),encoding='utf8')
+raise SystemExit(0 if all(r['passed'] for r in results) else 1)
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 240c53aa..31449a8f 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -1,4 +1,5 @@
#include "veyra/engine/EngineController.h"
+#include "veyra/engine/PlaybackRate.h"
#include "veyra/engine/PreviewFrameReadiness.h"
#include "veyra/engine/FgCompatibilityProbe.h"
#include "veyra/engine/VideoPresenter.h"
@@ -76,7 +77,7 @@ void EngineController::dispatch(){
void EngineController::post(std::function<void()> task){ {std::lock_guard lock(mutex_);stop_=true;pending_=std::move(task);}wake_.notify_one(); }
bool EngineController::idle()const{std::lock_guard lock(mutex_);return !busy_&&!pending_;}
bool EngineController::setPlaybackRate(double rate){
- if(rate!=1.0&&rate!=1.5&&rate!=2.0&&rate!=3.0)return false;
+ if(!validPlaybackRate(rate))return false;
std::lock_guard lock(mutex_);
if(!snapshot_.running||snapshot_.capture||snapshot_.image)return false;
if(requestedPlaybackRate_==rate)return true;
diff --git a/src/engine/Subtitles.cpp b/src/engine/Subtitles.cpp
index 9e12999a..eae50978 100644
--- a/src/engine/Subtitles.cpp
+++ b/src/engine/Subtitles.cpp
@@ -261,27 +261,16 @@ SubtitleTrack parseAss(const std::wstring& data,const std::wstring& name,bool ss
return track;
}
-// Matroska/MP4 sometimes hand us a whole ASS dialogue line (Layer,Start,End,
-// Style,...) instead of just the text; keep the text field only.
+// FFmpeg AVSubtitleRect::ass is ReadOrder,Layer,Style,Name,MarginL,MarginR,
+// MarginV,Effect,Text. Consume exactly the eight header separators: commas in
+// Text are authored punctuation, never another header field.
std::wstring stripDialoguePrefix(const std::wstring& raw){
- // Two shapes exist: the FFmpeg AVSubtitle ASS rectangle
- // (Layer,Start,End,Style,Name,ML,MR,MV,Effect,Text) and the Matroska stored
- // form (Layer,0,Style,Name,ML,MR,MV,Effect,Text - the times live in the
- // block, so Start/End collapse into one zero). Both end with an empty
- // Effect field, which is what makes the split unambiguous: subtitle text
- // itself may contain commas.
- std::vector<std::wstring> fields;
size_t start=0;
- for(size_t i=0;i<raw.size()&&fields.size()<10;++i){
- if(raw[i]!=L',')continue;
- fields.push_back(trim(raw.substr(start,i-start)));
- start=i+1;
+ for(int field=0;field<8;++field){
+ const auto comma=raw.find(L',',start);
+ if(comma==std::wstring::npos)return raw;
+ start=comma+1;
}
- if(fields.size()<8)return raw;
- auto numeric=[](const std::wstring& value){if(value.empty())return false;for(wchar_t c:value)if(c<L'0'||c>L'9')return false;return true;};
- const bool matroskaShape=fields.size()>=8&&numeric(fields[0])&&numeric(fields[1])&&numeric(fields[4])&&numeric(fields[5])&&numeric(fields[6])&&fields[7].empty();
- const bool dialogueShape=fields.size()>=9&&numeric(fields[0])&&fields[7].empty()&&fields[8].empty();
- if(!matroskaShape&&!dialogueShape)return raw;
return raw.substr(start);
}
@@ -301,6 +290,7 @@ SubtitleTrack parseVtt(const std::wstring& data,const std::wstring& name){
while(std::getline(lines,line)){
if(line.find(L"-->")!=std::wstring::npos){std::wistringstream back(line);break;}
if(trim(line).empty())break;
+ if(!line.empty()&&line.back()==L'\r')line.pop_back();
if(!cue.text.empty())cue.text+=L'\n';
cue.text+=line;
}
@@ -528,7 +518,7 @@ std::vector<SubtitleTrack> loadEmbeddedSubtitleTracks(const std::wstring& path,s
std::wstring text;
int alignOverride=0;double posX=-1,posY=-1;
const std::wstring raw=entry->ass&&*entry->ass?wide(entry->ass):(entry->text&&*entry->text?wide(entry->text):std::wstring{});
- if(!raw.empty())text=cleanAssText(stripDialoguePrefix(raw),alignOverride,posX,posY);
+ if(!raw.empty())text=cleanAssText(entry->ass&&*entry->ass?stripDialoguePrefix(raw):raw,alignOverride,posX,posY);
if(text.empty())continue;
SubtitleCue cue;
cue.begin=packetSeconds+double(subtitle.start_display_time)/1000.0;
diff --git a/src/sink/WasapiAudioSink.cpp b/src/sink/WasapiAudioSink.cpp
index f92e06f8..6ff27869 100644
--- a/src/sink/WasapiAudioSink.cpp
+++ b/src/sink/WasapiAudioSink.cpp
@@ -1,5 +1,6 @@
#include "veyra/sink/AudioGain.h"
#include "veyra/sink/WasapiAudioSink.h"
+#include "veyra/engine/PlaybackRate.h"
#include <functiondiscoverykeys_devpkey.h>
#include <propvarutil.h>
#pragma comment(lib, "propsys.lib")
@@ -241,7 +242,7 @@ void AudioPipeline::videoPresented(double nextPtsMs)
bool AudioPipeline::setPlaybackRate(double rate)
{
- if(rate!=1.0&&rate!=1.5&&rate!=2.0&&rate!=3.0)return false;
+ if(!engine::validPlaybackRate(rate))return false;
requestedRate_=rate;return true;
}
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index db825fbf..c494c672 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -35,6 +35,7 @@
#include <algorithm>
#include <cmath>
+#include <chrono>
#include <limits>
#include <optional>
#include <span>
@@ -46,6 +47,7 @@
#include "veyra/engine/ColorLookStore.h"
#include "veyra/engine/ColorLut.h"
#include "veyra/engine/Subtitles.h"
+#include "veyra/engine/PlaybackRate.h"
#include "veyra/sink/WasapiAudioSink.h"
#include "veyra/source/CaptureFormatSelection.h"
#include "veyra/source/CaptureFormatRank.h"
@@ -151,7 +153,7 @@ bool exportFileClosed(const QString& path){
}
} // namespace
-static QVariantMap currentEffectCapabilities();
+static QVariantMap currentEffectCapabilities(bool refresh=false);
static QString unavailableEffects(const engine::EnhancementSettings& settings);
static QString disableUnavailableEffects(engine::ChainConfiguration& configuration);
static ui::EffectGpu effectGpu();
@@ -818,7 +820,7 @@ static ui::EffectGpu effectGpu() {
return gpu;
}
-static QVariantMap currentEffectCapabilities() {
+static QVariantMap scanEffectCapabilities() {
using H = ui::HardwareEffect;
const auto gpu = effectGpu();
const auto nr = runtime::localRuntimeDirectory();
@@ -853,6 +855,18 @@ static QVariantMap currentEffectCapabilities() {
add("flow1", H::CrossVendor, true, QObject::tr("需要支持 DirectX 12 的硬件显卡"));
return out;
}
+// All callers are on the bridge/UI thread. Snapshot reads must not perform
+// filesystem probes or rebuild capability maps. Refresh on actions, language
+// changes and a slow timer so user-replaced runtime files remain discoverable.
+static QVariantMap currentEffectCapabilities(bool refresh) {
+ static QVariantMap cached;
+ static QString language;
+ const auto currentLanguage=i18n::current();
+ if(refresh||cached.isEmpty()||language!=currentLanguage){
+ cached=scanEffectCapabilities();language=currentLanguage;
+ }
+ return cached;
+}
static QString fgEffectId(engine::FrameGenerationBackend backend) {
switch (backend) {
case engine::FrameGenerationBackend::Dlss: return "dlss";
@@ -864,7 +878,7 @@ static QString fgEffectId(engine::FrameGenerationBackend backend) {
return {};
}
static QString unavailableEffects(const engine::EnhancementSettings& settings) {
- const auto caps = currentEffectCapabilities();
+ const auto caps = currentEffectCapabilities(true);
QStringList requested;
if (settings.nr) requested << "nr" + QString::number(int(engine::currentNrRuntime(settings.nrRuntime)));
if (settings.sr) requested << "sr" + QString::number(settings.videoSrQuality);
@@ -945,8 +959,22 @@ QVariantList QmlPlayerBridge::srBackendChoices() const {
QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystem::path dataDirectory,
QObject* parent)
: QObject(parent), impl_(std::make_unique<Impl>(engine, std::move(dataDirectory))) {
- connect(this,&QmlPlayerBridge::snapshotChanged,this,&QmlPlayerBridge::fgChoicesChanged);
+ connect(this,&QmlPlayerBridge::snapshotChanged,this,
+ [this,ceiling=fgMaxMultiplier(),text=fgProviderText()]() mutable {
+ const auto nextCeiling=fgMaxMultiplier();const auto nextText=fgProviderText();
+ if(nextCeiling==ceiling&&nextText==text)return;
+ ceiling=nextCeiling;text=nextText;emit fgChoicesChanged();
+ });
connect(this,&QmlPlayerBridge::settingsChanged,this,&QmlPlayerBridge::fgChoicesChanged);
+ auto* capabilityTimer=new QTimer(this);
+ connect(capabilityTimer,&QTimer::timeout,this,[this,reported=currentEffectCapabilities()]() mutable {
+ const auto next=currentEffectCapabilities(true);
+ // An action may have refreshed the cache before this tick. Compare with
+ // the last reported map so that QML still learns about that change.
+ if(next==reported)return;
+ reported=next;emit effectCapabilitiesChanged();emit fgChoicesChanged();
+ });
+ capabilityTimer->start(2000);
impl_->loadPrefs();
impl_->engine.setFullscreenMemoryProtection(impl_->prefBool("fullscreenMemoryProtection",false));
impl_->enumerateGpuAdapters();
@@ -1547,7 +1575,7 @@ QString QmlPlayerBridge::fgProviderText() const {
const auto& s=impl_->snapshot;
if(fgBackendName()==QLatin1String("vfg")){
if(!vfgHardwarePossible())return tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)");
- if(!pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring()))return tr("未找到 VFG 运行组件,请在组件页核对路径");
+ if(!effectCapabilities().value("vfg").toMap().value("available").toBool())return tr("未找到 VFG 运行组件,请在组件页核对路径");
return tr("VFG 支持 2X~8X 和低 / 中 / 高质量;6X~8X 为实验档,高倍高质量会增加处理时间");
}
if(engine::fsrFrameGeneration(s.applied.frameGenerationBackend)&&s.applied.multiplier>1&&!s.fsrProviderVersion.empty())
@@ -3989,6 +4017,8 @@ void QmlPlayerBridge::setMuted(bool value) {
}
double QmlPlayerBridge::playbackSpeed() const { return impl_->snapshot.playbackSpeed; }
double QmlPlayerBridge::playbackRate() const { return impl_->snapshot.playbackRate; }
+double QmlPlayerBridge::minimumPlaybackRate() const { return engine::kMinPlaybackRate; }
+double QmlPlayerBridge::maximumPlaybackRate() const { return engine::kMaxPlaybackRate; }
void QmlPlayerBridge::setPlaybackRate(double rate) {
if(!impl_->engine.setPlaybackRate(rate))return;
impl_->snapshot.playbackRate=rate;emit snapshotChanged();
diff --git a/tests/integration/AudioPlaybackRateTests.cpp b/tests/integration/AudioPlaybackRateTests.cpp
index 53bc2ee6..c19e386b 100644
--- a/tests/integration/AudioPlaybackRateTests.cpp
+++ b/tests/integration/AudioPlaybackRateTests.cpp
@@ -2,6 +2,7 @@
#include <chrono>
#include <cmath>
#include <iostream>
+#include <limits>
#include <thread>
#include <vector>
@@ -12,9 +13,11 @@ int wmain(int argc,wchar_t** argv){
CoInitializeEx(nullptr,COINIT_MULTITHREADED);
using Clock=std::chrono::steady_clock;
bool all=true;
- for(double rate:{1.,1.5,2.,3.})for(double start:{0.,1200.}){
+ for(double rate:{.25,.5,1.,1.3,1.5,1.8,2.,3.,4.})for(double start:{0.,1200.}){
veyra::sink::AudioPipeline audio;
if(!audio.open(argv[1])||!audio.setPlaybackRate(rate))return 1;
+ for(double invalid:{0.,-.5,.249,4.001,std::numeric_limits<double>::infinity(),std::numeric_limits<double>::quiet_NaN()})
+ if(audio.setPlaybackRate(invalid))return 1;
audio.setPaused(false);audio.startThread(nullptr,false,start);
const unsigned channels=audio.pcmFormat().channels;
std::vector<float> block(997*channels),pcm;
@@ -32,8 +35,14 @@ int wmain(int argc,wchar_t** argv){
}
audio.stopThread();
unsigned crossings=0;double energy=0;
- for(size_t i=1;i<pcm.size();++i){if(pcm[i]>=0&&pcm[i-1]<0)++crossings;energy+=pcm[i]*pcm[i];}
- const double hz=pcm.empty()?0:48000.*crossings/pcm.size();
+ // SoundTouch's beginning/end overlap includes silence. Measure pitch
+ // over the middle half, while duration/PTS still cover every sample.
+ const size_t begin=pcm.size()/4,end=pcm.size()*3/4;
+ for(size_t i=1;i<pcm.size();++i){
+ if(i>begin&&i<end&&pcm[i]>=0&&pcm[i-1]<0)++crossings;
+ energy+=pcm[i]*pcm[i];
+ }
+ const double hz=end>begin?48000.*crossings/(end-begin):0;
const double duration=1000.*pcm.size()/48000.;
const bool ok=audio.decodingComplete()&&audio.overruns()==0&&continuous&&
std::abs(first-start)<1&&std::abs(last-5000)<2&&
diff --git a/tests/integration/SubtitleOverlayTests.cpp b/tests/integration/SubtitleOverlayTests.cpp
index 92b4513c..e330eaaa 100644
--- a/tests/integration/SubtitleOverlayTests.cpp
+++ b/tests/integration/SubtitleOverlayTests.cpp
@@ -48,6 +48,10 @@ int main(){
updateSubtitleOverlay(overlay,{stable},view);const auto one=inkBands();
stable.text=L"HHHH\nHHHH";updateSubtitleOverlay(overlay,{stable},view);const auto two=inkBands();
check(one.size()==1&&two.size()==2&&std::abs(one[0]-two[0])<=1&&std::abs(one[0]-two[1])<=1,"two-line cue preserves one-line glyph size even with target one");
+ stable.text=L"HHHH, HHHH\nHHHH, HHHH\nHHHH, HHHH";
+ updateSubtitleOverlay(overlay,{stable},view);
+ check(inkBands().size()==3,"three authored lines with commas survive the real glyph renderer");
+ stable.text=L"HHHH\nHHHH";
view.fitToLines=true;updateSubtitleOverlay(overlay,{stable},view);const auto fitted=inkBands();
check(fitted.size()==2&&fitted[0]<two[0],"explicit fit-to-lines still shrinks text");
view.fitToLines=false;
diff --git a/tests/integration/SubtitleTextTests.cpp b/tests/integration/SubtitleTextTests.cpp
new file mode 100644
index 00000000..5aac917c
--- /dev/null
+++ b/tests/integration/SubtitleTextTests.cpp
@@ -0,0 +1,34 @@
+#include "veyra/engine/Subtitles.h"
+#include <cmath>
+#include <filesystem>
+#include <iostream>
+
+// Golden text is independent of parsing implementation. The MKV contains the
+// same authored cues as the external files, decoded by the actual FFmpeg build.
+int wmain(int argc,wchar_t** argv){
+ if(argc!=2)return 2;
+ const std::filesystem::path root=argv[1];
+ const std::vector<std::wstring> expected={
+ L"It is over, Sauron.", L"Ka-Zar, I warn you!",
+ L"Your reign of terror over\nthe Savage Land ends now!",
+ L"I am Zaladane,\nHigh Priestess of\nthe Sun God, Garokk.",
+ L"中文,第一行\nEnglish, second line\n第三行, 原样保留",
+ L"A, B, C, D, E, F, G, H, I, J, K.",
+ };
+ bool all=true;
+ auto check=[&](const veyra::engine::SubtitleTrack& t){
+ bool ok=t.cues.size()==expected.size();
+ for(size_t k=0;k<std::min(t.cues.size(),expected.size());++k){
+ const auto& c=t.cues[k];
+ const bool match=c.text==expected[k]&&std::abs(c.begin-k*3.)<.03&&std::abs(c.end-(k*3.+2.5))<.03;
+ if(!match)std::cout<<"MISMATCH cue="<<k<<" textChars="<<c.text.size()<<" expected="<<expected[k].size()<<" times="<<c.begin<<".."<<c.end<<'\n';
+ ok&=match;
+ }
+ std::cout<<(ok?"PASS":"FAIL")<<" embedded="<<t.embedded<<" cues="<<t.cues.size()<<'\n';all&=ok;
+ };
+ for(auto name:{L"golden.srt",L"golden.ass",L"golden.vtt"})check(veyra::engine::loadSubtitleFile((root/name).wstring()));
+ auto tracks=veyra::engine::loadEmbeddedSubtitleTracks((root/L"golden.mkv").wstring());
+ if(tracks.size()!=2)all=false;
+ for(const auto& t:tracks)check(t);
+ return all?0:1;
+}