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

test: cover playback display matrices and BMD connection persistence

Veyra Goal Agent25601e44607c
diff --git a/scripts/acceptance/rotation-video-probe.qml b/scripts/acceptance/rotation-video-probe.qml
new file mode 100644
index 00000000..cf0e7e40
--- /dev/null
+++ b/scripts/acceptance/rotation-video-probe.qml
@@ -0,0 +1,38 @@
+import QtQuick
+Item {
+ id: probe
+ property var appWindow: Window.window
+ property var paths: []
+ property int index: -1
+ property int ticks: 0
+ property bool recorded: false
+ function openNext() {
+ appWindow.page = "min"; appWindow.width = 720
+ appWindow.x = 50; appWindow.y = 50
+ veyra.openPath(paths[index]); ticks = 0; recorded = false
+ }
+ Timer {
+ interval: 150; repeat: true; running: true
+ onTriggered: {
+ try {
+ ++probe.ticks
+ if (probe.index < 0) {
+ if (probe.ticks < 3) return
+ veyra.setPreference("reducedMotion", true)
+ veyra.muted = true; veyra.nrEnabled = false; veyra.srEnabled = false
+ veyra.fgEnabled = false; veyra.colorEnabled = false; veyra.videoHdr = false
+ probe.index = 0; probe.openNext(); return
+ }
+ if (veyra.failed || probe.ticks > 100) throw new Error("video failed or timed out")
+ if (!probe.recorded && probe.ticks >= 14 && veyra.running && !veyra.applying) {
+ console.log("GUI_ROTATION " + JSON.stringify({index:probe.index,aspect:veyra.previewAspect}))
+ probe.recorded = true; probe.ticks = 0
+ } else if (probe.recorded && probe.ticks > 8) {
+ ++probe.index
+ if (probe.index >= probe.paths.length) { console.log("GUI_ROTATION_DONE"); veyra.stopPlayback(); Qt.quit(); return }
+ probe.openNext()
+ }
+ } catch(e) { console.error("GUI_ROTATION_FAIL " + e.message); Qt.exit(3) }
+ }
+ }
+}
diff --git a/scripts/acceptance/rotation-video-test.py b/scripts/acceptance/rotation-video-test.py
new file mode 100644
index 00000000..d2971de7
--- /dev/null
+++ b/scripts/acceptance/rotation-video-test.py
@@ -0,0 +1,103 @@
+"""Sample the actual native video HWND while playing display-matrix fixtures.
+Only this private test window is captured; product playback has no readback.
+"""
+from pathlib import Path
+import argparse,ctypes,hashlib,json,os,re,shutil,subprocess,time
+from ctypes import wintypes as W
+from PIL import ImageGrab
+p=argparse.ArgumentParser(description=__doc__)
+p.add_argument('variant',choices=('before','after'))
+p.add_argument('--task',required=True)
+p.add_argument('--donor-app',type=Path,required=True)
+p.add_argument('--media-dir',type=Path,required=True)
+a=p.parse_args();assert re.fullmatch(r'[a-z0-9-]+',a.task)
+base=Path('E:/项目/Veyra');root=Path(__file__).resolve().parents[2]
+stage=base/'tests'/a.task/('rotation-'+a.variant);log=base/'logs'/a.task/('rotation-'+a.variant+'-'+time.strftime('%H%M%S'));log.mkdir()
+temp=base/'tmp'/a.task/log.name;temp.mkdir(parents=True)
+running=subprocess.check_output(['tasklist','/fo','csv','/nh'],text=True,encoding='mbcs',errors='replace')
+assert not any(line.lower().startswith('"veyra') for line in running.splitlines()),'Another player is active'
+if not stage.exists():
+ for source in a.donor_app.rglob('*'):
+ rel=source.relative_to(a.donor_app)
+ if rel.parts[0] in ('logs','scratch') or (rel.parts[0]=='runtime_local' and len(rel.parts)>1 and rel.parts[1].startswith('user-data')):continue
+ dest=stage/rel
+ if source.is_dir():dest.mkdir(parents=True,exist_ok=True)
+ else:
+ dest.parent.mkdir(parents=True,exist_ok=True)
+ if rel.parts[0]=='qml':shutil.copy2(source,dest)
+ else:os.link(source,dest)
+qml=stage/'qml/Veyra/Main.qml';original=qml.read_bytes()
+angles=(0,90,180,270,0)
+paths=[str(a.media_dir/f'rotation{angle}.mp4') for angle in angles]
+assert all(Path(path).is_file() for path in paths)
+probe=stage/'qml/Veyra/RotationVideoProbe.qml';shutil.copy2(root/'scripts/acceptance/rotation-video-probe.qml',probe)
+text=original.decode('utf8');at=text.rfind('}')
+qml.write_text(text[:at]+'\nLoader { source:"RotationVideoProbe.qml"; onLoaded:item.paths='+json.dumps(paths,ensure_ascii=False)+' }\n'+text[at:],'utf8')
+profile=base/'tests'/a.task/('rotation-profile-'+a.variant+'-'+log.name);profile.mkdir()
+(profile/'qml-preferences.v1.json').write_text(json.dumps(dict(autoResume=False,prewarmEnhancement=False,gpuPriority='normal',overlayCompat='off')),'utf8')
+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_','QML_'))}
+env.update(TEMP=str(temp),TMP=str(temp),CUDA_CACHE_PATH=str(temp/'cuda'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',VEYRA_LOG_FILE=str(log/'engine.log'))
+u=ctypes.WinDLL('user32',use_last_error=True)
+u.SetProcessDpiAwarenessContext.argtypes=[ctypes.c_void_p];u.SetProcessDpiAwarenessContext(ctypes.c_void_p(-4))
+callback=ctypes.WINFUNCTYPE(W.BOOL,W.HWND,W.LPARAM)
+u.EnumWindows.argtypes=[callback,W.LPARAM];u.EnumChildWindows.argtypes=[W.HWND,callback,W.LPARAM]
+u.GetWindowThreadProcessId.argtypes=[W.HWND,ctypes.POINTER(W.DWORD)];u.GetClassNameW.argtypes=[W.HWND,W.LPWSTR,ctypes.c_int]
+u.GetWindowRect.argtypes=[W.HWND,ctypes.POINTER(W.RECT)];u.GetParent.argtypes=[W.HWND];u.GetParent.restype=W.HWND
+u.SetWindowPos.argtypes=[W.HWND,W.HWND,ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_int,W.UINT]
+
+
+def video_window(pid):
+ found=[]
+ @callback
+ def visit(hwnd,_):
+ owner=W.DWORD();u.GetWindowThreadProcessId(hwnd,ctypes.byref(owner))
+ if owner.value==pid:
+ name=ctypes.create_unicode_buffer(256);u.GetClassNameW(hwnd,name,256)
+ if name.value=='VeyraQmlVideoHost':found.append(hwnd)
+ return True
+ @callback
+ def top(hwnd,_):visit(hwnd,0);u.EnumChildWindows(hwnd,visit,0);return True
+ u.EnumWindows(top,0);assert len(set(found))==1
+ return found[0]
+
+
+command=[str(stage/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','min','--size','720x500','--exit-after','80000']
+rows=[];seen=set();references=None;proc=None;start=time.monotonic()
+try:
+ with (log/'console.log').open('wb') as stream:
+ proc=subprocess.Popen(command,cwd=stage,env=env,stdout=stream,stderr=subprocess.STDOUT)
+ while proc.poll() is None:
+ if time.monotonic()-start>90:raise TimeoutError('Rotation GUI deadline')
+ text=(log/'console.log').read_text('utf8',errors='replace')
+ for match in re.findall(r'GUI_ROTATION (\{[^\r\n]+\})',text):
+ row=json.loads(match);index=row['index']
+ if index in seen:continue
+ seen.add(index);hwnd=video_window(proc.pid)
+ u.SetWindowPos(u.GetParent(hwnd),W.HWND(-1),0,0,0,0,0x0013)
+ rect=W.RECT();assert u.GetWindowRect(hwnd,ctypes.byref(rect))
+ image=ImageGrab.grab(bbox=(rect.left,rect.top,rect.right,rect.bottom),all_screens=True)
+ image.save(log/f'rotation-{index}-{angles[index]}.png')
+ points=[(.25,.25),(.75,.25),(.25,.75),(.75,.75)]
+ values=[sum(image.getpixel((int(x*image.width),int(y*image.height)))[:3])/3 for x,y in points]
+ if references is None:
+ references=values;assert all(references[k]-references[k+1]>25 for k in range(3)),values
+ order={0:(0,1,2,3),90:(2,0,3,1),180:(3,2,1,0),270:(1,3,0,2)}[angles[index]]
+ expected=[references[k] for k in order]
+ row.update(angle=angles[index],samples=values,expected=expected,passed=max(abs(x-y) for x,y in zip(values,expected))<15,
+ hwndExtent=[image.width,image.height])
+ rows.append(row);print(json.dumps(row),flush=True)
+ time.sleep(.08)
+ rc=proc.returncode
+finally:
+ if proc is not None and proc.poll() is None:
+ proc.terminate();proc.wait(timeout=10)
+ qml.write_bytes(original);probe.unlink(missing_ok=True)
+text=(log/'console.log').read_text('utf8',errors='replace')
+completed=rc==0 and len(rows)==len(angles) and 'GUI_ROTATION_DONE' in text and 'GUI_ROTATION_FAIL' not in text
+passed=completed and (all(row['passed'] for row in rows) if a.variant=='after' else all(row['passed'] for row in rows if row['angle']==0) and all(not row['passed'] for row in rows if row['angle']!=0))
+result=dict(passed=passed,completed=completed,variant=a.variant,command=command,rows=rows,
+ exeSha256=hashlib.sha256((stage/'veyra_qml_ui.exe').read_bytes()).hexdigest(),scope='Actual GUI/native video pixels, SDR synthetic display-matrix files; no NR/FG enabled')
+(log/'receipt.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),'utf8')
+(base/'reports'/a.task/('rotation-'+a.variant+'.json')).write_text(json.dumps(dict(passed=passed,receipt=str(log/'receipt.json')),indent=2),'utf8')
+print('RESULT',passed,log,flush=True)
+raise SystemExit(not passed)
diff --git a/tests/unit/UiContractTests.cpp b/tests/unit/UiContractTests.cpp
index ab1e3be1..a392ef8b 100644
--- a/tests/unit/UiContractTests.cpp
+++ b/tests/unit/UiContractTests.cpp
@@ -10,6 +10,7 @@
#include "veyra/sink/AudioGain.h"
#include "veyra/engine/PreviewView.h"
#include "veyra/source/CaptureAudioClock.h"
+#include "veyra/source/DeckLinkInputConnection.h"
#include <iostream>
#include <vector>
#include <stdexcept>
@@ -157,6 +158,11 @@ int wmain(int argc,wchar_t** argv){try{
ui::CapturePreferenceStore store(argv[1]);ui::CapturePreferences p{L"\\\\?\\usb#video-\u91c7\u96c6",L"1920:1080:166833:{SUBTYPE}:RGB32",L"{audio-endpoint}",-3,2};
require(store.load().videoPath.empty(),"fresh capture preference empty");require(store.save(p),"capture preference atomic save");
const auto restored=store.load();require(restored.videoPath==p.videoPath&&restored.formatKey==p.formatKey&&restored.audioPath==p.audioPath&&restored.audioMode==p.audioMode&&restored.colorOverride==p.colorOverride,"capture stable identifiers and Unicode round trip");
+ for(uint32_t connection:{1u,2u}){
+ auto native=p;native.videoPath=source::decklink::inputConnectionPath(L"decklink-native:p:0000000000000123:0",connection);native.formatKey=L"decklink:auto";
+ require(store.save(native),"save BMD explicit connection using existing preference format");
+ const auto resumed=store.load();require(resumed.videoPath==native.videoPath&&resumed.formatKey==native.formatKey&&source::decklink::inputConnectionSelection(resumed.videoPath).connection==connection,"resume keeps exact HDMI or SDI connection and automatic signal mode");
+ }
for(double fps:{0.0,29.97,30.0,40.0,50.0,60.0}){p.requestedFps=fps;require(store.save(p)&&store.load().requestedFps==fps,"device capture rate survives restart");}
p.requestedFps=-1;require(!store.save(p),"invalid capture rate not persisted");
p.requestedFps=0;p.colorOverride=5;p.deviceColors={{L"card-A",5},{L"card-B",10}};