Commit dc68e89
fix(stream-config): pin BGRA as default pixel format (#145)
Apple's stock SCStreamConfiguration() no longer guarantees a BGRA
default — on macOS 26 / Apple Silicon the runtime silently switched
to kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ('420v') unless
the caller explicitly overrides pixelFormat. That broke consumers
that assumed packed BGRA samples (the long-standing documented
default for this crate) and produced unrecognisable images when
client code read the Y luma plane as if it were BGRA.
Pin pixelFormat = kCVPixelFormatType_32BGRA inside the Swift bridge
sc_stream_configuration_create so SCStreamConfiguration::new() and
::default() deliver a stable BGRA wire format across macOS versions.
The preset path (sc_stream_configuration_create_with_preset) is
intentionally untouched — presets pick their own pixel format
(e.g. HDR 10-bit formats).
Add test_default_pixel_format_is_bgra to lock the guarantee in, plus
docstrings on PixelFormat::BGRA and set_pixel_format describing the
new contract.
Fixes #145
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 6b34309 commit dc68e89
4 files changed
Lines changed: 45 additions & 1 deletion
File tree
- src/stream/configuration
- swift-bridge/Sources/ScreenCaptureKitBridge
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
13 | 31 | | |
14 | 32 | | |
15 | 33 | | |
| |||
0 commit comments