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++
List common capture frame rates by default with a show-all switch
Veyra Goal Agent6fb7df2807e6
diff --git a/AGENTS.md b/AGENTS.mdindex d2d62131..b5126557 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,6 +1,6 @@# Veyra 项目 Agent 执行规则-> **2026-10-15 现场修复(Claude)**:用户提交 veyra-qml(56).log(卡顿、未响应后条栏图标消失,重连采集后恢复)与 logs(18).zip(2.0.7 打开采集卡闪退),要求排查修复、汇报后关机。存档 `checkpoint/pre-claude-field-20261015`(main 7571919)与 E 盘 `archives/claude-field-20261015`,分支 `claude/field-20261015`。只改采集格式列表缓存/桥接属性/枚举去重、界面设备重建后图标重绘、采集卡 GPU 失败后自动重连一次、收尾补写 DRED 及三个默认不生效的测试开关(`VEYRA_TEST_CAPTURE_EXTRA_RATES`、`VEYRA_TEST_UI_DEVICE_REMOVE`、`VEYRA_TEST_GPU_FAILURE`)。不改默认 GPU 优先级/NR 版本、运行库、模型、驱动、用户配置;无 merge/push/Release、无子 Agent。长时间变卡与 GPU 卡死根因未定,不宣称已修复。详见 docs/FIELD_FIXES_2026-10-15.md。+> **2026-10-15 现场修复(Claude)**:用户提交 veyra-qml(56).log(卡顿、未响应后条栏图标消失,重连采集后恢复)与 logs(18).zip(2.0.7 打开采集卡闪退),要求排查修复、汇报后关机。存档 `checkpoint/pre-claude-field-20261015`(main 7571919)与 E 盘 `archives/claude-field-20261015`,分支 `claude/field-20261015`。只改采集格式列表缓存/桥接属性/枚举去重、界面设备重建后图标重绘、采集卡 GPU 失败后自动重连一次、收尾补写 DRED 及三个默认不生效的测试开关(`VEYRA_TEST_CAPTURE_EXTRA_RATES`、`VEYRA_TEST_UI_DEVICE_REMOVE`、`VEYRA_TEST_GPU_FAILURE`)。不改默认 GPU 优先级/NR 版本、运行库、模型、驱动、用户配置;无 merge/push/Release、无子 Agent。长时间变卡与 GPU 卡死根因未定,不宣称已修复。用户追加:帧率菜单默认只列常用帧率(±0.15% 含 59.94 类),帧率多的卡出现“显示全部可用帧率”开关(偏好 captureShowAllFrameRates,默认关)。详见 docs/FIELD_FIXES_2026-10-15.md。> **2026-10-13 2.0.7正式发布授权**:用户明确直接采用已验2.0.7-test-r2两个包发布GitHub、六群原图替换、README/Release加知识库、完整说明2.0.6以来变化。按docs/RELEASE_2.0.7_PLAN_2026-10-13.md,只改发布文档/图片和外部文件名,ZIP/EXE/运行组件逐字节保持。允许本地main合入、普通push nrvideo/main与两个标签、主v2.0.7两资产及独立非latest源码归档;保留原赞助/Discord/Ko-fi/width220。69旧树/509脏文件、旧包和旧Release保护,全产物E盘;无子Agent/代发/关机。不伪称包内test标识被去掉,不把混合模型取舍或合成误差包装成普遍画质/提速,也不宣称NV显存/BMD/HDR现场已根治。diff --git a/docs/FIELD_FIXES_2026-10-15.md b/docs/FIELD_FIXES_2026-10-15.mdindex 3237b51b..139ea936 100644--- a/docs/FIELD_FIXES_2026-10-15.md+++ b/docs/FIELD_FIXES_2026-10-15.md@@ -59,6 +59,17 @@- 回归(`logs/claude-field-20261015/unit-final-013928`):capture_format_selection 0 失败、repair_contract 259/0、ui_contract PASS、live_timing PASS、present_sink_lifecycle passed=1 debugErrors=0、settings_transaction passed=1 debugErrors=0、qml_quick 68 通过 0 失败。- 界面脚本:`tmp/claude-field-20261015/{repro_formats.py,gpu_reconnect.py,run_app_prefs.py,stack_sample.py}`。测试前确认没有其他 Veyra 进程。+## 追加(用户 2026-10-15):帧率菜单只列常用帧率,加“显示全部可用帧率”++用户:“不要列出那么多帧率,选也选不过来呀,把常见的帧率加入 比如30 50 60 120 144 240,然后要注意有些卡他报出来的不是整数的比如有些卡的60 是59.94……如果有些二货采集卡会有那么多帧率的情况下,加个勾选显示全部可用帧率好了”。++- 常用帧率:24、25、30、50、60、100、120、144、165、240。驱动报的帧率与其中之一相差不超过 0.15% 就算常用,所以 59.94、29.97、119.88、143.86、239.76 以及 60.00024、240.004 这类非整数都按对应的常用帧率显示(列出驱动的真实值,不改写)。+- 帧率菜单默认只列该分辨率下的常用帧率,同一帧率只列一行;当前选中的帧率始终列出;某个分辨率一个常用帧率都没有时列出全部。两个列表都按帧率从高到低排(跟随信号/设备默认在最前,同帧率逐行在隔行前)。+- 有被隐藏的帧率时,帧率下面出现“显示全部可用帧率”开关(说明里写出隐藏的个数),打开后列出驱动报的全部帧率;开关保存在界面偏好 `captureShowAllFrameRates`,默认关。+- 换分辨率时如果原帧率在新分辨率下没有,改选它的第一个常用帧率,而不是驱动列表的第一行(例如不会落到 1 fps)。+- 代码:`CaptureFormatSelection.h`(`captureCommonFrameRate`、`captureVisibleFrameRates`、`captureDefaultFrameRate`)、桥接 `captureHiddenFrameRates`、`DialogHost.qml` 开关行、四语翻译。+- 验证:单元测试新增 1–120 fps + 59.94 的卡(短列表 8 行 120/100/60/59.94/50/30/25/24、隐藏 113、显示全部 121)、选中的非常用帧率保留、同一 60 fps 两个间隔只列一行、无常用帧率的分辨率全列且不出开关、换分辨率落到 24 而不是 1 fps,全部通过。T911 原样:1080p 7 个帧率(240.004、120、60、59.94、50、30、29.97)全是常用,不出开关,行为不变(`logs/claude-field-20261015/rates-t911-095201`)。模拟每项多报 1–160 fps:1080p 短列表 11 行(240.004 到 24),开关显示隐藏 153 个,打开后 164 行(`rates-160-sorted-095436`、`rates-menu-095540`);英文界面开关行不溢出(`rates-en-095732`)。回归:`logs/claude-field-20261015/unit-rates-final-095820` 全部通过(qml_quick 68/0)。+## 测试包(基于 2.0.7 r2,只替换 veyra_qml_ui.exe、DialogHost.qml、VIcon.qml,不含任何用户设置)- 目录 `E:/项目/Veyra/test-packages/claude-field-20261015/`(DELIVERY.json,打包脚本 `tmp/claude-field-20261015/package.py`,源码 d2239c6)。- 覆盖补丁 `Veyra-2.0.7-test-field-patch.zip`(8120432 字节,SHA256 `fa715aad4a4da09247798ef021c74e6227a4091714b7af3df19ef02def3367c1`):解压到原 2.0.7 文件夹覆盖,NVIDIA/AMD 包通用(两包的 2.0.7 exe 相同),原设置保留。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex ef767463..bc15b012 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -9354,3 +9354,9 @@ v2.0.7 ID 410800361,published_at 2026-10-12T16:24:59Z,latest/非草稿/非- 构建/回归:tmp/claude-field-20261015/build.py,最终 build-20261015-013917,exe a79714fb…;6 组单元/集成测试与 qml_quick 68/0 通过(logs/claude-field-20261015/unit-final-013928);界面脚本证据见 docs/FIELD_FIXES_2026-10-15.md。- 测试包:E:/项目/Veyra/test-packages/claude-field-20261015(覆盖补丁 fa715aad4a4da092…,NVIDIA 8762448fd9ba43cc…,AMD 5573da62692e6a4f…),冷启动通过;SHA256 全文见 docs/FIELD_FIXES_2026-10-15.md。- 不 merge/push/Release,不改默认 GPU 优先级/NR 版本、运行库、模型、驱动、用户配置;无子 Agent。++## 2026-10-15 帧率菜单只列常用帧率(Claude,用户追加)++- 用户要求帧率不要列那么多,默认只列常用帧率(30/50/60/120/144/240 等),注意 59.94 这类非整数,帧率特别多的卡加“显示全部可用帧率”勾选。分支 claude/field-20261015。+- 常用帧率 24/25/30/50/60/100/120/144/165/240,±0.15% 内算同一帧率(含 59.94、60.00024、240.004);默认短列表、同帧率一行、选中帧率保留、无常用帧率时全列,按帧率从高到低;有隐藏时出现开关(偏好 captureShowAllFrameRates,默认关);换分辨率默认落到第一个常用帧率。+- 验证:新增单元测试通过;T911 原样不变(1080p 7 个常用帧率、无开关);模拟 1–160 fps 时 1080p 11 行、隐藏 153、全部 164;英文布局正常;回归 6 组 + qml_quick 68/0 通过(logs/claude-field-20261015/unit-rates-final-095820)。详见 docs/FIELD_FIXES_2026-10-15.md。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex 2e4d8948..d926f6db 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -15730,6 +15730,20 @@"zh-TW": "GPU 已重置,正在自動重新連接擷取卡","en": "The GPU was reset; reconnecting the capture card automatically","ja": "GPU がリセットされました。キャプチャーカードを自動で再接続しています"+ },+ {+ "zh": "显示全部可用帧率",+ "src": "qml/Veyra/DialogHost.qml",+ "zh-TW": "顯示全部可用幀率",+ "en": "Show all available frame rates",+ "ja": "利用可能なフレームレートをすべて表示"+ },+ {+ "zh": "默认只列常用帧率:24、25、30、50、60、100、120、144、165、240(含 59.94 这类非整数帧率)。这张卡另外上报了 %1 个帧率",+ "src": "qml/Veyra/DialogHost.qml",+ "zh-TW": "預設只列常用幀率:24、25、30、50、60、100、120、144、165、240(含 59.94 這類非整數幀率)。這張卡另外回報了 %1 個幀率",+ "en": "Only common frame rates are listed by default: 24, 25, 30, 50, 60, 100, 120, 144, 165, 240 (including non-integer rates such as 59.94). This card reports %1 more",+ "ja": "既定では一般的なフレームレートのみ表示します:24、25、30、50、60、100、120、144、165、240(59.94 などの非整数レートを含む)。このカードはほかに %1 個のフレームレートを報告しています"}]}diff --git a/include/veyra/source/CaptureFormatSelection.h b/include/veyra/source/CaptureFormatSelection.hindex 484c82d9..4d5c91a1 100644--- a/include/veyra/source/CaptureFormatSelection.h+++ b/include/veyra/source/CaptureFormatSelection.h@@ -1,8 +1,10 @@#pragma once#include "veyra/source/CaptureFrameRate.h"#include <algorithm>+#include <cmath>#include <cstdint>#include <format>+#include <iterator>#include <span>#include <vector>@@ -12,7 +14,9 @@ namespace veyra::source {// persisted identity so an old combined selection still restores one type.struct CaptureFormat {int index=0;unsigned width=0,height=0;double fps=0;std::wstring label;std::wstring key;int rank=0;int tier=0;bool driverCurrent=false;std::wstring pixel;std::wstring scan;bool interlaced=false;int64_t interval100ns=0;bool supported=true;bool automatic=false;};enum class CaptureFormatAxis { Resolution, FrameRate };-struct CaptureFormatOption { std::wstring id, label; bool disabled=false, discouraged=false; };+// Frame-rate rows also carry the rate itself and whether it is a common one (see+// captureVisibleFrameRates); the other menus leave those fields at their defaults.+struct CaptureFormatOption { std::wstring id, label; bool disabled=false, discouraged=false; double fps=0; bool interlaced=false, common=true; };inline const CaptureFormat* selectCaptureFormat(std::span<const CaptureFormat> formats,int legacyIndex,std::wstring_view key){for(const auto& format:formats)@@ -67,6 +71,13 @@ inline std::wstring captureResolutionLabel(const CaptureFormat& format){if(format.automatic)return L"自动检测实际信号";return std::format(L"{} × {}",format.width,format.height);}+// The rates people pick. A driver rate counts as one of them within 0.15 %, which also covers+// the 1000/1001 rates cards report instead (59.94 for 60, 29.97 for 30, 119.88 for 120) and+// nominal rates such as 60.00024.+inline bool captureCommonFrameRate(double fps){+ static constexpr double common[]{24,25,30,50,60,100,120,144,165,240};+ return std::any_of(std::begin(common),std::end(common),[fps](double rate){return std::abs(fps-rate)<=rate*0.0015;});+}inline std::wstring captureFrameRateLabel(const CaptureFormat& format){if(format.automatic)return L"跟随实际信号";if(format.fps<=0)return L"设备默认帧率";@@ -104,10 +115,48 @@ inline std::vector<CaptureFormatOption> captureFrameRateOptions(std::span<constauto label=captureFrameRateLabel(format);if(std::any_of(out.begin(),out.end(),[&](const CaptureFormatOption& option){return option.label==label;}))label+=std::format(L" [format {}]",format.index);- out.push_back({id,std::move(label)});+ out.push_back({id,std::move(label),false,false,format.fps,format.interlaced,format.automatic||format.fps<=0||captureCommonFrameRate(format.fps)});}return out;}+// Some drivers list every rate from 1 to 120 fps for each format (logs(18)). The menu shows+// one row per common rate; the rest wait behind 显示全部可用帧率. The selected rate is always+// listed, and a resolution offering no common rate lists everything. Either list runs from the+// highest rate down (signal-following/default rows first; progressive before interlaced).+// `hidden` counts the rows the short list leaves out (0 when there is nothing more to show).+inline std::vector<CaptureFormatOption> captureVisibleFrameRates(const std::vector<CaptureFormatOption>& all,std::wstring_view selected,bool showAll,size_t* hidden=nullptr){+ if(hidden)*hidden=0;+ std::vector<CaptureFormatOption> shown;+ if(std::none_of(all.begin(),all.end(),[](const CaptureFormatOption& option){return option.common;}))shown=all;+ else{+ std::vector<std::pair<long long,bool>> rates;+ for(const auto& option:all){+ const std::pair<long long,bool> rate{std::llround(option.fps*1000),option.interlaced};+ const bool repeat=std::find(rates.begin(),rates.end(),rate)!=rates.end();+ if(option.id!=selected&&(!option.common||repeat))continue;+ shown.push_back(option);if(option.common)rates.push_back(rate);+ }+ if(hidden)*hidden=all.size()-shown.size();+ if(showAll)shown=all;+ }+ std::stable_sort(shown.begin(),shown.end(),[](const CaptureFormatOption& a,const CaptureFormatOption& b){+ if((a.fps<=0)!=(b.fps<=0))return a.fps<=0;+ if(a.fps!=b.fps)return a.fps>b.fps;+ return !a.interlaced&&b.interlaced;+ });+ return shown;+}+// The rate a newly chosen resolution starts with when the current one is missing there: its+// first common rate in list order, or else its first rate. Null when the resolution is unknown.+inline const CaptureFormat* captureDefaultFrameRate(std::span<const CaptureFormat> formats,std::wstring_view resolution){+ const CaptureFormat* first=nullptr;+ for(const auto& f:formats){+ if(captureResolutionId(f)!=resolution)continue;+ if(f.automatic||f.fps<=0||captureCommonFrameRate(f.fps))return &f;+ if(!first)first=&f;+ }+ return first;+}inline std::vector<CaptureFormatOption> capturePixelOptions(std::span<const CaptureFormat> formats,const CaptureFormat* current){std::vector<CaptureFormatOption> out;if(!current)return out;diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex 61a9857f..d5a7a1ff 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -133,6 +133,9 @@ class QmlPlayerBridge : public QObject {Q_PROPERTY(QVariantList captureResolutionOptions READ captureResolutionOptions NOTIFY captureChanged)Q_PROPERTY(QString captureResolutionId READ captureResolutionId WRITE setCaptureResolutionId NOTIFY captureChanged)Q_PROPERTY(QVariantList captureFrameRateOptions READ captureFrameRateOptions NOTIFY captureChanged)+ // Rates the frame-rate menu leaves out unless preferences.captureShowAllFrameRates is on+ // (0: the card offers nothing beyond the common rates, so the switch is not shown).+ Q_PROPERTY(int captureHiddenFrameRates READ captureHiddenFrameRates NOTIFY captureChanged)Q_PROPERTY(QString captureFrameRateId READ captureFrameRateId WRITE setCaptureFrameRateId NOTIFY captureChanged)Q_PROPERTY(QVariantList capturePixelOptions READ capturePixelOptions NOTIFY captureChanged)Q_PROPERTY(QString capturePixelId READ capturePixelId WRITE setCapturePixelId NOTIFY captureChanged)@@ -591,6 +594,7 @@ public:QString captureResolutionId() const;void setCaptureResolutionId(const QString& id);QVariantList captureFrameRateOptions() const;+ int captureHiddenFrameRates() const;QString captureFrameRateId() const;void setCaptureFrameRateId(const QString& id);QVariantList capturePixelOptions() const;diff --git a/qml/Veyra/DialogHost.qml b/qml/Veyra/DialogHost.qmlindex 8f1cbeaf..052651ad 100644--- a/qml/Veyra/DialogHost.qml+++ b/qml/Veyra/DialogHost.qml@@ -355,6 +355,21 @@ Item {onPicked: id => veyra.captureFrameRateId = id}}+ VRow {+ // Some cards list every rate from 1 to 120 fps (logs(18)). The frame-rate menu+ // shows the common rates the card offers; this lists the rest too.+ objectName: "capture-all-rates-row"+ visible: veyra.captureHiddenFrameRates > 0+ label: qsTr("显示全部可用帧率")+ hint: qsTr("默认只列常用帧率:24、25、30、50、60、100、120、144、165、240(含 59.94 这类非整数帧率)。这张卡另外上报了 %1 个帧率").arg(veyra.captureHiddenFrameRates)+ VSwitch {+ objectName: "capture-all-rates"+ enabled: !veyra.captureQueryBusy+ opacity: enabled ? 1 : 0.35+ checked: veyra.preferences.captureShowAllFrameRates === true+ onToggled: checked => veyra.setPreference("captureShowAllFrameRates", checked)+ }+ }VRow {label: qsTr("像素格式")// Never search veyra.captureFormats here: a card can list 15000+ (logs(18)).diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex cb6863e1..1fecf235 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -358,6 +358,7 @@ struct QmlPlayerBridge::Impl {std::chrono::steady_clock::time_point gpuReconnectDue{}, gpuReconnectLast{};struct CaptureListCache { bool valid = false; uint64_t generation = 0; QString language; std::wstring a, b; QVariantList list; };CaptureListCache captureFormatsCache, captureResolutionCache, captureRateCache, capturePixelCache;+ int captureHiddenRates = 0; // set with captureRateCachetemplate <class Build> const QVariantList& captureList(CaptureListCache& cache, const std::wstring& a, const std::wstring& b, Build&& build) {const QString language = i18n::current();if (!cache.valid || cache.generation != captureFormatGeneration || cache.language != language || cache.a != a || cache.b != b) {@@ -2216,16 +2217,28 @@ void QmlPlayerBridge::setCaptureResolutionId(const QString& id) {const auto* sample=source::captureResolutionSample(impl_->captureFormatList,wide);if(!sample){emit notice(tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return;}impl_->captureResolutionChoice=wide;- if(!source::captureRateSample(impl_->captureFormatList,wide,impl_->captureRateChoice))impl_->captureRateChoice=source::captureFrameRateId(*sample);+ // A rate the new resolution lacks becomes its first common rate, not the driver's first row.+ if(!source::captureRateSample(impl_->captureFormatList,wide,impl_->captureRateChoice))+ if(const auto* rate=source::captureDefaultFrameRate(impl_->captureFormatList,wide))impl_->captureRateChoice=source::captureFrameRateId(*rate);impl_->captureFormatKey.clear();if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);emit captureChanged();}QVariantList QmlPlayerBridge::captureFrameRateOptions() const {- return impl_->captureList(impl_->captureRateCache, impl_->captureResolutionChoice, {}, [this] {- return captureChoiceList(source::captureFrameRateOptions(impl_->captureFormatList, source::captureResolutionSample(impl_->captureFormatList, impl_->captureResolutionChoice)));+ // Common rates only unless 显示全部可用帧率 is on (captureVisibleFrameRates).+ const bool all = impl_->prefBool("captureShowAllFrameRates", false);+ return impl_->captureList(impl_->captureRateCache, impl_->captureResolutionChoice, impl_->captureRateChoice + (all ? L"|all" : L""), [this, all] {+ size_t hidden = 0;+ const auto rates = source::captureVisibleFrameRates(source::captureFrameRateOptions(impl_->captureFormatList,+ source::captureResolutionSample(impl_->captureFormatList, impl_->captureResolutionChoice)), impl_->captureRateChoice, all, &hidden);+ impl_->captureHiddenRates = int(hidden);+ return captureChoiceList(rates);});}+int QmlPlayerBridge::captureHiddenFrameRates() const {+ (void)captureFrameRateOptions(); // the count is built with the list+ return impl_->captureHiddenRates;+}QString QmlPlayerBridge::captureFrameRateId() const {return utf8Of(impl_->captureRateChoice);}@@ -5372,7 +5385,7 @@ bool QmlPlayerBridge::setPreference(const QString& key, const QVariant& value) {{"listInspectorWidth", {376, 4000}}};static const QStringList flags{"subtitleEnabled", "subtitleBackground", "subtitleFit","subtitleSecondLanguage", "audioForceStereo", "holdCompare",- "magewellLowLatency", "blackmagicNativeCapture", "cinePillHidden", "exportStopsPlayback", "obsGameCapture", "autoResume", "fullscreenMemoryProtection", "prewarmEnhancement", "hdrFgCompatibility"};+ "magewellLowLatency", "blackmagicNativeCapture", "captureShowAllFrameRates", "cinePillHidden", "exportStopsPlayback", "obsGameCapture", "autoResume", "fullscreenMemoryProtection", "prewarmEnhancement", "hdrFgCompatibility"};QVariant stored;if (ranges.contains(key)) {bool ok = false; const int n = value.toInt(&ok);@@ -5466,6 +5479,7 @@ void QmlPlayerBridge::applyPreference(const QString& key) {value==QLatin1String("high")?gfx::GpuPriority::High:gfx::GpuPriority::Realtime);}if(key==QLatin1String("fullscreenMemoryProtection")){impl_->engine.setFullscreenMemoryProtection(impl_->prefBool("fullscreenMemoryProtection",false));emit snapshotChanged();}+ if(key==QLatin1String("captureShowAllFrameRates"))emit captureChanged();if (key == QLatin1String("audioDevice")) sink::setPreferredRenderEndpoint(impl_->prefString("audioDevice").toStdWString());else if (key == QLatin1String("audioForceStereo")) sink::setForceStereoDownmix(impl_->prefBool("audioForceStereo", false));else if (key == QLatin1String("magewellLowLatency")) source::magewell::setLowLatencyPreference(impl_->prefBool("magewellLowLatency", false));diff --git a/tests/unit/CaptureFormatSelectionTests.cpp b/tests/unit/CaptureFormatSelectionTests.cppindex 8957c3ff..d10868df 100644--- a/tests/unit/CaptureFormatSelectionTests.cpp+++ b/tests/unit/CaptureFormatSelectionTests.cpp@@ -137,5 +137,31 @@ int main(){check(std::any_of(options.begin(),options.end(),[&](const CaptureFormatOption& option){return option.id==format.key;}),"every reported media identity is reachable through linked selectors");}}+ {+ // logs(18): a driver listing 1..120 fps for every format. The menu keeps the common+ // rates (59.94 and 60.00024 count as 60) and hides the rest behind 显示全部可用帧率.+ check(captureCommonFrameRate(60)&&captureCommonFrameRate(60000.0/1001)&&captureCommonFrameRate(60.00024)&&captureCommonFrameRate(29.97)+ &&captureCommonFrameRate(23.976)&&captureCommonFrameRate(143.856)&&captureCommonFrameRate(239.76)&&captureCommonFrameRate(165),"60, 59.94, 60.00024 and the 1000/1001 rates are common");+ check(!captureCommonFrameRate(59)&&!captureCommonFrameRate(61)&&!captureCommonFrameRate(75)&&!captureCommonFrameRate(1),"neighbouring and odd rates are not");+ std::vector<CaptureFormat> many;+ for(int rate=1;rate<=120;++rate){CaptureFormat f{0,1920,1080,double(rate),L"",std::format(L"r{}",rate)};f.interval100ns=(10000000+rate/2)/rate;many.push_back(f);}+ CaptureFormat ntsc{1,1920,1080,60000.0/1001,L"",L"r59.94"};ntsc.interval100ns=166833;many.push_back(ntsc);+ const auto all=captureFrameRateOptions(many,&many[0]);+ size_t hidden=0;+ const auto shortList=captureVisibleFrameRates(all,L"",false,&hidden);+ check(all.size()==121&&shortList.size()==8&&hidden==113,"1..120 fps plus 59.94 lists 24 25 30 50 60 100 120 and 59.94");+ check(std::any_of(shortList.begin(),shortList.end(),[](const CaptureFormatOption& o){return std::abs(o.fps-59.94)<0.01;}),"59.94 keeps its own row next to 60");+ {std::vector<double> order;for(const auto& o:shortList)order.push_back(std::round(o.fps*100)/100);+ check(order==std::vector<double>{120,100,60,59.94,50,30,25,24},"short list runs from the highest rate down");}+ check(captureVisibleFrameRates(all,L"",true).size()==all.size(),"show all lists every reported rate");+ check(captureVisibleFrameRates(all,captureFrameRateId(many[74]),false).size()==9,"a selected uncommon rate (75) stays listed");+ std::vector<CaptureFormat> twice{many[59],many[59]};twice[1].key=L"r60-vih2";twice[1].interval100ns=166666;+ check(captureVisibleFrameRates(captureFrameRateOptions(twice,&twice[0]),L"",false).size()==1,"two intervals for the same 60 fps show one row");+ std::vector<CaptureFormat> odd{{0,1280,1024,75,L"",L"sxga75"},{1,1280,1024,85,L"",L"sxga85"}};+ size_t oddHidden=9;+ check(captureVisibleFrameRates(captureFrameRateOptions(odd,&odd[0]),L"",false,&oddHidden).size()==2&&oddHidden==0,"a resolution without common rates lists everything and shows no switch");+ check(captureDefaultFrameRate(many,L"1920x1080")==&many[23],"a new resolution starts at its first common rate (24), not 1 fps");+ check(captureDefaultFrameRate(odd,L"1280x1024")==&odd[0]&&!captureDefaultFrameRate(odd,L"640x480"),"no common rate: first rate; unknown resolution: none");+ }std::cout<<"capture format selection failures="<<failures<<'\n';return failures?1:0;}