Skip to content

feat: Windows capture pipeline via GDI BitBlt (purego) - #3

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789654183-windows-gdi
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789654183-windows-gdi

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Adds a working Windows pipeline so captured runs on runtime.GOOS == "windows" instead of fataling on unsupported platform.

pipelines/windows/pipeline.go — implements pipelines.Pipeline with plain GDI, bound via purego (syscall.NewLazyDLL + purego.RegisterLibFunc, the same no-cgo pattern the linux backend uses for libdrm):

  • ListDisplays: EnumDisplayMonitors + GetMonitorInfoW (callback via purego.NewCallback); IDs are enumeration indexes, X/Y are virtual-desktop coords so negative offsets work.
  • StartStreamgdiGrabber: GetDC(0) + BitBlt(SRCCOPY|CAPTUREBLT) into a 32bpp top-down CreateDIBSection bitmap, so pixels are read in place as packed BGRA — no GetDIBits round trip. Alpha byte is forced to 0xFF since GDI leaves it 0. Frames stream on the same ticker cadence model as the linux frameStream.
  • SetProcessDPIAware at bind time so enumeration/capture use physical pixels.
  • DXGI Desktop Duplication (GPU-side, dirty rects, cursor) is the intended follow-up for performance; GDI is the spike path that gets the socket pipeline working end-to-end.

Platform gating: sckit-go uses purego.Dlopen, which only exists on Unix — so the macos package now sits behind //go:build darwin with a !darwin stub, matching the linux package's existing stub_other.go pattern. The windows impl is tagged windows with a !windows stub.

main.go: case "windows": windows.New(); socket paths go through socketPath(name)os.TempDir() on Windows (AF_UNIX sockets are filesystem-backed there since Windows 10 17063), /tmp unchanged elsewhere.

Verified

Built and run on Windows Server 2022: info, list-displays (1280x720 display), start-stream at 5fps, and a real 1280x720 BGRA frame read off the media socket with opaque alpha; stop-stream clean. go vet/go build pass 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

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

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 5b55f473-8216-4717-8aec-8e8fb5f3f597

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant