Screen backdrop (schema v5/v6) + five-scene catalog + webcam polish: live desktop/game capture as a permanent non-deletable bottom layer (Source.IsBackdrop), auto full-screen game detection (Win32FullScreenDetector) else primary display, GraphicsCapturePicker re-designation, refcounted shared ScreenCaptureManager, Live-only backdrop by policy (HasBackdrop + v5-v6 backfill + EnforceBackdropPolicy, checkbox gone), SceneCatalog (Starting/Live/BRB/Chat/Ending) with + button re-adding missing scenes, webcam mid-session transparent-container fix (GetPreviewBitmap propagation), Chat half-screen-area cap, 'Add Webcam' always opens the picker (SwapWebcamIdentityAsync, no silent resurrect), WindowsRuntimeMarshal frame-read + 5s-throttled errors, docs updated, tests (65 passing)

This commit is contained in:
2026-08-07 14:15:50 -07:00
parent e037ba027b
commit ad9b3e1e48
27 changed files with 2232 additions and 116 deletions
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Runtime.InteropServices;
using Windows.Graphics.Capture;
namespace ytLive.Services;
/// <summary>
/// Desktop-interop bridges for Graphics Capture that CsWinRT can't project:
/// creating a <see cref="GraphicsCaptureItem"/> from an HMONITOR/HWND via the
/// activation factory's IGraphicsCaptureItemInterop, and wiring the
/// GraphicsCapturePicker to an owner window via IInitializeWithWindow.
/// GUIDs and signatures come from the official Windows GraphicsCapture samples.
/// </summary>
internal static class CaptureInterop
{
private static readonly Guid GraphicsCaptureItemGuid = new("79C3F95B-31F7-4EC2-A464-632EF5D30760");
public static GraphicsCaptureItem CreateForMonitor(IntPtr hmonitor)
{
var interop = GraphicsCaptureItem.As<IGraphicsCaptureItemInterop>();
return GraphicsCaptureItem.FromAbi(interop.CreateForMonitor(hmonitor, GraphicsCaptureItemGuid));
}
public static GraphicsCaptureItem CreateForWindow(IntPtr hwnd)
{
var interop = GraphicsCaptureItem.As<IGraphicsCaptureItemInterop>();
return GraphicsCaptureItem.FromAbi(interop.CreateForWindow(hwnd, GraphicsCaptureItemGuid));
}
public static void SetWindowOwner(GraphicsCapturePicker picker, IntPtr hwnd)
{
var interop = (IInitializeWithWindow)(object)picker;
interop.Initialize(hwnd);
}
[ComImport]
[Guid("3628E81B-3CAC-4C60-B7F4-23CE0E0C3356")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface IGraphicsCaptureItemInterop
{
IntPtr CreateForWindow([In] IntPtr window, [In] ref Guid iid);
IntPtr CreateForMonitor([In] IntPtr monitor, [In] ref Guid iid);
}
[ComImport]
[Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface IInitializeWithWindow
{
void Initialize(IntPtr hwnd);
}
}