[PR #259] [CLOSED] Add ScreenCaptureKit screen capture for Mac Catalyst #256

Closed
opened 2026-03-02 04:00:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/eerimoq/moblin/pull/259
Author: @Copilot
Created: 2/28/2026
Status: Closed

Base: mac-catalystHead: copilot/add-mac-catalyst-screen-capture


📝 Commits (3)

  • 5529003 Initial plan
  • c9ef4fe Add ScreenCaptureKit-based screen capture for macCatalyst
  • 352b12f Address code review: add clarifying comments

📊 Changes

3 files changed (+145 additions, -13 deletions)

View changed files

Moblin/Various/MacScreenCapture.swift (+102 -0)
📝 Moblin/Various/Model/Model.swift (+8 -0)
📝 Moblin/Various/Model/ModelScreenCapture.swift (+35 -13)

📄 Description

Mac Catalyst has no broadcast extension support, so the existing ReplayKit-based screen capture is non-functional. This adds in-process screen capture via ScreenCaptureKit, wired into the existing buffered video pipeline. The "Screen capture" video source option already exists in scenes/widgets UI — this makes it work on Mac Catalyst.

Changes

  • Moblin/Various/MacScreenCapture.swift (new) — SCStream wrapper capturing the primary display at 2x (Retina) resolution, 30 FPS, BGRA. Delivers CMSampleBuffer frames via delegate. Entire file is #if targetEnvironment(macCatalyst).

  • Moblin/Various/Model/ModelScreenCapture.swift — Extracted shared helpers (handleScreenCaptureStarted/Stopped/SampleBuffer) and split delegate conformance by platform: MacScreenCaptureDelegate on macCatalyst (zero latency, in-process), SampleBufferReceiverDelegate on iOS (0.2s latency for ReplayKit IPC).

  • Moblin/Various/Model/Model.swift — Added macScreenCapture property and conditional setup in setupSampleBufferReceiver() to start ScreenCaptureKit on macCatalyst instead of the Unix socket listener.

Design

Follows the AVCaptureSession pattern (direct in-process capture) rather than the iOS approach (out-of-process broadcast extension + socket IPC). Frames feed into the same addBufferedVideo/appendBufferedVideoSampleBuffer pipeline used by all non-camera video sources.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/eerimoq/moblin/pull/259 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 2/28/2026 **Status:** ❌ Closed **Base:** `mac-catalyst` ← **Head:** `copilot/add-mac-catalyst-screen-capture` --- ### 📝 Commits (3) - [`5529003`](https://github.com/eerimoq/moblin/commit/55290035cf5926f0a1cee643320bc4db776c092d) Initial plan - [`c9ef4fe`](https://github.com/eerimoq/moblin/commit/c9ef4fecef19316f055dc6163f9db534797d15b7) Add ScreenCaptureKit-based screen capture for macCatalyst - [`352b12f`](https://github.com/eerimoq/moblin/commit/352b12f3926063137481010d33e7d4cc225a493f) Address code review: add clarifying comments ### 📊 Changes **3 files changed** (+145 additions, -13 deletions) <details> <summary>View changed files</summary> ➕ `Moblin/Various/MacScreenCapture.swift` (+102 -0) 📝 `Moblin/Various/Model/Model.swift` (+8 -0) 📝 `Moblin/Various/Model/ModelScreenCapture.swift` (+35 -13) </details> ### 📄 Description Mac Catalyst has no broadcast extension support, so the existing ReplayKit-based screen capture is non-functional. This adds in-process screen capture via ScreenCaptureKit, wired into the existing buffered video pipeline. The "Screen capture" video source option already exists in scenes/widgets UI — this makes it work on Mac Catalyst. ### Changes - **`Moblin/Various/MacScreenCapture.swift`** (new) — `SCStream` wrapper capturing the primary display at 2x (Retina) resolution, 30 FPS, BGRA. Delivers `CMSampleBuffer` frames via delegate. Entire file is `#if targetEnvironment(macCatalyst)`. - **`Moblin/Various/Model/ModelScreenCapture.swift`** — Extracted shared helpers (`handleScreenCaptureStarted/Stopped/SampleBuffer`) and split delegate conformance by platform: `MacScreenCaptureDelegate` on macCatalyst (zero latency, in-process), `SampleBufferReceiverDelegate` on iOS (0.2s latency for ReplayKit IPC). - **`Moblin/Various/Model/Model.swift`** — Added `macScreenCapture` property and conditional setup in `setupSampleBufferReceiver()` to start ScreenCaptureKit on macCatalyst instead of the Unix socket listener. ### Design Follows the AVCaptureSession pattern (direct in-process capture) rather than the iOS approach (out-of-process broadcast extension + socket IPC). Frames feed into the same `addBufferedVideo`/`appendBufferedVideoSampleBuffer` pipeline used by all non-camera video sources. <!-- START COPILOT CODING AGENT TIPS --> --- 🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:00:56 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/moblin#256
No description provided.