Skip to content

Commit ec6c7ea

Browse files
1313Copilot
andcommitted
feat: add SCContentFilterBuilder::try_build and fix CI/release flow
Code review fixes (P0-P3): - Add non-breaking SCContentFilterBuilder::try_build() -> SCResult; build() is now a thin panicking wrapper. - Fix compile breaks that failed CI: example 01 `let mut config` (feature-gated allow(unused_mut)), missing CGRect / CMSampleBufferSCExt imports in tests, gate macos_14_4-only async test. - Document async drop-oldest delivery, swallowed interior-NUL setter behavior, and SCStream::drop teardown ordering. - Enable unsafe_op_in_unsafe_fn + missing_debug_implementations lints and wrap the resulting unsafe ops. - Add tests/ffi_layout_tests.rs ABI size/align assertions for repr(C) structs. - Version drift: README/lib.rs say 6; stamp stale coverage docs; correct the dependency claim in README; remove stale .bak examples. Release-plz / CI flow: - clippy gate now uses --all-features --all-targets -- -D warnings. - Bump release-plz/action v0.5.128 -> v0.5.129. - Add concurrency group to the release job. - Update deprecated Node20 actions: checkout@v4->v5, cache@v4->v5. Verified: clippy (all features/targets, -D warnings) clean, cargo fmt --check clean, tests green at async,macos_26_0 and async. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 52c11d3 commit ec6c7ea

21 files changed

Lines changed: 297 additions & 161 deletions

.github/workflows/ci.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
runs-on: macos-26
2727
name: Lint
2828
steps:
29-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v5
3030
- name: Setup Rust
3131
uses: dtolnay/rust-toolchain@stable
3232
with:
3333
components: clippy, rustfmt
3434
- name: Cache cargo
35-
uses: actions/cache@v4
35+
uses: actions/cache@v5
3636
with:
3737
path: |
3838
~/.cargo/registry
@@ -42,7 +42,7 @@ jobs:
4242
restore-keys: |
4343
${{ runner.os }}-lint-cargo-
4444
- name: Run clippy
45-
run: cargo clippy --all-features -- -D warnings
45+
run: cargo clippy --all-features --all-targets -- -D warnings
4646
- name: Check formatting
4747
run: cargo fmt --check
4848

@@ -87,13 +87,13 @@ jobs:
8787
env:
8888
TARGET_FLAG: ${{ matrix.cross_target && format('--target {0}', matrix.cross_target) || '' }}
8989
steps:
90-
- uses: actions/checkout@v4
90+
- uses: actions/checkout@v5
9191
- name: Setup Rust
9292
uses: dtolnay/rust-toolchain@stable
9393
with:
9494
targets: ${{ matrix.cross_target || '' }}
9595
- name: Cache cargo
96-
uses: actions/cache@v4
96+
uses: actions/cache@v5
9797
with:
9898
path: |
9999
~/.cargo/registry
@@ -137,11 +137,11 @@ jobs:
137137
name: Leak Check - ${{ matrix.name }}
138138
needs: [lint]
139139
steps:
140-
- uses: actions/checkout@v4
140+
- uses: actions/checkout@v5
141141
- name: Setup Rust
142142
uses: dtolnay/rust-toolchain@stable
143143
- name: Cache cargo
144-
uses: actions/cache@v4
144+
uses: actions/cache@v5
145145
with:
146146
path: |
147147
~/.cargo/registry
@@ -172,14 +172,14 @@ jobs:
172172
group: release-plz-${{ github.ref }}
173173
cancel-in-progress: false
174174
steps:
175-
- uses: actions/checkout@v4
175+
- uses: actions/checkout@v5
176176
with:
177177
fetch-depth: 0
178178
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
179179
- name: Setup Rust
180180
uses: dtolnay/rust-toolchain@stable
181181
- name: Run release-plz
182-
uses: release-plz/action@v0.5.128
182+
uses: release-plz/action@v0.5.129
183183
with:
184184
command: release-pr
185185
env:
@@ -193,15 +193,18 @@ jobs:
193193
environment: release
194194
permissions:
195195
contents: write
196+
concurrency:
197+
group: release-plz-publish-${{ github.ref }}
198+
cancel-in-progress: false
196199
steps:
197-
- uses: actions/checkout@v4
200+
- uses: actions/checkout@v5
198201
with:
199202
fetch-depth: 0
200203
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
201204
- name: Setup Rust
202205
uses: dtolnay/rust-toolchain@stable
203206
- name: Run release-plz
204-
uses: release-plz/action@v0.5.128
207+
uses: release-plz/action@v0.5.129
205208
with:
206209
command: release
207210
env:

COVERAGE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ScreenCaptureKit SDK Coverage
22

3+
> **Snapshot — not a live coverage status.** This document records a point-in-time
4+
> audit performed against `screencapturekit` **v3.1.1**. It has **not** been
5+
> re-verified against the current crate version (6.x) and should be read as a
6+
> historical audit, not an up-to-date certification.
7+
38
This document records the `screencapturekit` v3.1.1 coverage audit against Apple's `ScreenCaptureKit.framework` from Xcode 26.2 (`MacOSX26.2.sdk`).
49

510
## Certification

COVERAGE_AUDIT.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# screencapturekit-rs coverage audit (vs MacOSX26.2.sdk)
22

3+
> Snapshot from the `screencapturekit` v3.1.1 audit pass — historical, not re-verified against 6.x.
4+
35
SDK_PUBLIC_SYMBOLS: 42
46
VERIFIED: 41
57
GAPS: 0

COVERAGE_AUDIT_V2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# screencapturekit-rs coverage audit v2 (vs MacOSX26.2.sdk)
22

3+
> Snapshot from the `screencapturekit` v3.1.1 audit pass — historical, not re-verified against 6.x.
4+
35
SDK_PUBLIC_SYMBOLS: 42
46
VERIFIED: 41
57
GAPS: 0

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ include = [
2626
]
2727

2828
[lints.rust]
29-
# TODO: Enable after adding unsafe blocks inside unsafe fns
30-
# unsafe_op_in_unsafe_fn = "warn"
31-
# TODO: Enable after adding Debug impls to public types
32-
# missing_debug_implementations = "warn"
29+
unsafe_op_in_unsafe_fn = "warn"
30+
missing_debug_implementations = "warn"
3331

3432
[lints.clippy]
3533
pedantic = { level = "warn", priority = -1 }

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- 📸 **Screenshots** + **direct-to-file recording** (macOS 14.0+ / 15.0+)
2727
- 🖱️ **System content picker** UI (macOS 14.0+)
2828
- 🛡️ **Memory safe** — proper retain/release, leak-tested
29-
- 📦 **Zero runtime dependencies**
29+
- 📦 **Minimal dependencies** — only the thin `apple-cf` / `apple-metal` binding crates (no heavy third-party runtime deps)
3030

3131
## Table of Contents
3232

@@ -41,7 +41,7 @@
4141

4242
```toml
4343
[dependencies]
44-
screencapturekit = "5"
44+
screencapturekit = "6"
4545
```
4646

4747
Opt-in features (additive):
@@ -60,7 +60,7 @@ Opt-in features (additive):
6060
`macos_*` features are **cumulative** — enabling `macos_15_0` automatically enables every earlier version. Pick the highest version your minimum-supported macOS will satisfy:
6161

6262
```toml
63-
screencapturekit = { version = "5", features = ["async", "macos_15_0"] }
63+
screencapturekit = { version = "6", features = ["async", "macos_15_0"] }
6464
```
6565

6666
> **Upgrading from 1.x?** See [`docs/MIGRATION.md`](docs/MIGRATION.md#migrating-from-1x-to-20)

examples/01_basic_capture.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
5353
}
5454

5555
// 3. Configure stream (how to capture)
56-
let config = SCStreamConfiguration::new()
56+
#[cfg_attr(not(feature = "macos_14_0"), allow(unused_mut))]
57+
let mut config = SCStreamConfiguration::new()
5758
.with_width(1920)
5859
.with_height(1080)
5960
.with_pixel_format(PixelFormat::BGRA)

src/async_api.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,16 @@ impl AsyncSCShareableContent {
293293
// AsyncSCStream - Async stream with integrated frame iteration
294294
// ============================================================================
295295

296-
/// Async iterator over sample buffers
296+
/// Async iterator over sample buffers.
297+
///
298+
/// # Delivery semantics
299+
///
300+
/// This is a **lossy, bounded** buffer. When the queue is full (`capacity`
301+
/// reached) and a new sample arrives faster than the consumer polls it,
302+
/// the **oldest** buffered sample is dropped to make room for the newest
303+
/// (drop-oldest policy). This keeps latency low and favors fresh frames over
304+
/// stale ones, but means consumers that fall behind will miss intermediate
305+
/// frames rather than blocking the capture callback.
297306
struct AsyncSampleIteratorState {
298307
buffer: std::collections::VecDeque<crate::cm::CMSampleBuffer>,
299308
waker: Option<Waker>,

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
//!
2828
//! ```toml
2929
//! [dependencies]
30-
//! screencapturekit = "4"
30+
//! screencapturekit = "6"
3131
//! ```
3232
//!
3333
//! For async support:
3434
//!
3535
//! ```toml
3636
//! [dependencies]
37-
//! screencapturekit = { version = "4", features = ["async"] }
37+
//! screencapturekit = { version = "6", features = ["async"] }
3838
//! ```
3939
//!
4040
//! ## Quick Start

src/metal.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,6 +2034,8 @@ where
20342034
/// }
20352035
/// ```
20362036
pub unsafe fn setup_metal_view(view: *mut c_void, layer: &MetalLayer) {
2037-
nsview_set_wants_layer(view);
2038-
nsview_set_layer(view, layer.as_ptr());
2037+
unsafe {
2038+
nsview_set_wants_layer(view);
2039+
nsview_set_layer(view, layer.as_ptr());
2040+
}
20392041
}

0 commit comments

Comments
 (0)