feat: Windows capture pipeline via GDI BitBlt (purego) - #3
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- pipelines/windows: EnumDisplayMonitors/ListDisplays, BitBlt into a 32bpp top-down DIB section -> packed BGRA frames, ticker FrameStream. No cgo; user32/gdi32 bound via purego like the linux libdrm path. - Platform-gate macos (sckit-go is darwin-only) and windows impls behind build tags with !platform stubs, matching the linux package pattern. - main.go: windows case; socket paths under os.TempDir() on Windows (AF_UNIX is filesystem-backed there), /tmp elsewhere unchanged. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Adds a working Windows pipeline so
capturedruns onruntime.GOOS == "windows"instead of fataling onunsupported platform.pipelines/windows/pipeline.go— implementspipelines.Pipelinewith plain GDI, bound via purego (syscall.NewLazyDLL+purego.RegisterLibFunc, the same no-cgo pattern the linux backend uses for libdrm):ListDisplays:EnumDisplayMonitors+GetMonitorInfoW(callback viapurego.NewCallback); IDs are enumeration indexes, X/Y are virtual-desktop coords so negative offsets work.StartStream→gdiGrabber:GetDC(0)+BitBlt(SRCCOPY|CAPTUREBLT)into a 32bpp top-downCreateDIBSectionbitmap, so pixels are read in place as packed BGRA — noGetDIBitsround trip. Alpha byte is forced to0xFFsince GDI leaves it 0. Frames stream on the same ticker cadence model as the linuxframeStream.SetProcessDPIAwareat bind time so enumeration/capture use physical pixels.Platform gating:
sckit-gousespurego.Dlopen, which only exists on Unix — so themacospackage now sits behind//go:build darwinwith a!darwinstub, matching thelinuxpackage's existingstub_other.gopattern. The windows impl is taggedwindowswith a!windowsstub.main.go:case "windows": windows.New(); socket paths go throughsocketPath(name)→os.TempDir()on Windows (AF_UNIX sockets are filesystem-backed there since Windows 10 17063),/tmpunchanged elsewhere.Verified
Built and run on Windows Server 2022:
info,list-displays(1280x720 display),start-streamat 5fps, and a real1280x720BGRA frame read off the media socket with opaque alpha;stop-streamclean.go vet/go buildpass on windows, linux, and darwin.Link to Devin session: https://app.devin.ai/sessions/5e1930eab2f0494cb95bac679adfd552
Open in Devin Desktop: https://app.devin.ai/desktop/session/5e1930eab2f0494cb95bac679adfd552?variant=devin
Requested by: @spacedouut