Skip to content

Version 1.0 rc - #97

Closed
1313 wants to merge 264 commits into
mainfrom
version-1.0-rc
Closed

Version 1.0 rc#97
1313 wants to merge 264 commits into
mainfrom
version-1.0-rc

Conversation

@1313

@1313 1313 commented Nov 27, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

1313 added 28 commits November 27, 2025 16:39
- Add comprehensive usage documentation
- Add quick start examples
- Document all features and APIs
- Add feature flag documentation
- Update .gitignore for build artifacts
…e iteration

- Add SampleBufferStream for async frame iteration
- AsyncSCStream::new() returns (stream, frames) tuple
- Use frames.next().await for async frame processing
- Separate sync (SCStream) and async (AsyncSCStream) APIs
- Update 06_async example to demonstrate new pattern
- Rename SampleBufferStream to AsyncSampleIterator
- Integrate iterator directly into AsyncSCStream struct
- Simplify API: stream.next().await instead of frames.next().await
- Add buffered_count(), clear_buffer(), try_next() methods
- Update example to use simplified API
- Add sc_shareable_content_get_sync() to Swift bridge
- Swift handles async-to-sync conversion with DispatchSemaphore
- Remove complex Rust callback/Arc/Mutex/Condvar machinery
- Simplify SCShareableContentOptions to just two options
- AsyncSCShareableContent wraps sync API with BlockingFuture
- Add sc_shareable_content_get_async() to Swift with callback + user_data
- AsyncSCShareableContent uses callback-based FFI (no thread spawn)
- AsyncSCStream.next() is true async (no blocking)
- start_capture/stop_capture remain sync (fast operations)
- Remove all BlockingFuture usage
- Sync API uses semaphore-based sync FFI
- Async API uses callback-based async FFI
- Run swiftlint --strict before Swift build
- Relax swiftlint rules for FFI bridge code
- Auto-fix trailing whitespace and formatting
Audio samples may not have buffer data if no audio is playing during capture
- Rename 07_iosurface.rs -> 06_iosurface.rs
- Rename 08_list_content.rs -> 07_list_content.rs
- Consolidate async examples into single 08_async.rs
- Remove redundant async_demo.rs and async_runtime_agnostic.rs
- Add #![allow(clippy::pedantic, clippy::nursery)] to all test files
- Fix clone on Copy type (use copy instead)
- Fix unused variable warning
- Fix iter().cloned().collect() -> to_vec()
- Fix doc comment formatting
- Use is_some_and() instead of map().unwrap_or(false)
- Remove redundant clone
- Add backticks to doc comments for code references
- Replace non-existent save_to_png() with manual PNG encoding
- Use get_rgba_data() and png crate for saving
- Add allow for cast_possible_truncation lint
- Update example numbers (06=iosurface, 07=list_content, 08=async)
- Remove references to deleted async_demo.rs and async_runtime_agnostic.rs
- Update run commands
- Update example list (merged async examples into 08_async.rs)
- Fix async example code to use AsyncSCStream instead of non-existent AsyncSCScreenshotManager
- Remove run_leak_tests.sh references (script was deleted)
- Update async API overview to match actual exports
- Add blanket impl of SCStreamOutputTrait for Fn(CMSampleBuffer, SCStreamOutputType)
- Add ErrorHandler wrapper for closure-based error delegates
- Add comprehensive documentation for add_output_handler methods
- Export ErrorHandler from stream module

Closures can now be used directly:
  stream.add_output_handler(|sample, type| { ... }, SCStreamOutputType::Screen);
- Update 01_basic_capture.rs to show both struct and closure approaches
- Add new 09_closure_handlers.rs example demonstrating:
  - Simple closure handlers
  - Closures with custom dispatch queues
  - ErrorHandler for delegate callbacks
  - Multiple handlers on same stream
- Update examples/README.md with new example
- Update main README.md with new example in list
Add missing exports to prelude for better ergonomics:
- ErrorHandler for closure-based error handling
- SCStreamDelegateTrait for implementing custom delegates
Reorganize the 2200+ line cm.rs into a module directory:
- cm/mod.rs - Module root with re-exports
- cm/frame_status.rs - SCFrameStatus enum
- cm/time.rs - CMTime, CMSampleTimingInfo
- cm/sample_buffer.rs - CMSampleBuffer
- cm/pixel_buffer.rs - CVPixelBuffer, CVPixelBufferLockGuard, CVPixelBufferPool
- cm/audio.rs - AudioBuffer, AudioBufferList, etc.
- cm/block_buffer.rs - CMBlockBuffer
- cm/format_description.rs - CMFormatDescription, codec_types, media_types
- cm/iosurface.rs - IOSurface
- cm/ffi.rs - FFI declarations

All public APIs remain unchanged for backward compatibility.
Split the 1900-line ScreenCaptureKitBridge.swift into separate files:
- Core.swift - Memory management utilities (retain/release)
- ShareableContent.swift - SCShareableContent, SCDisplay, SCWindow, SCRunningApplication
- StreamConfiguration.swift - SCStreamConfiguration
- Stream.swift - SCContentFilter, SCStream delegates and control
- DispatchQueueBridge.swift - Dispatch queue management
- Media.swift - CMSampleBuffer, CVPixelBuffer
- ContentSharingPicker.swift - SCContentSharingPicker (macOS 14.0+)
- RecordingOutput.swift - SCRecordingOutput (macOS 15.0+)
- ScreenshotManager.swift - SCScreenshotManager (macOS 14.0+)

Also:
- Add ffi_string utility module for safer FFI string handling
- Add missing safety doc for ffi_string_from_buffer_or_empty
Integration tests were failing due to mutex poisoning when tests ran
in parallel. Added serial_test crate to ensure tests that use shared
ScreenCaptureKit resources run sequentially.

- Add serial_test dev-dependency
- Add #[serial] attribute to all integration tests
- All tests now pass
Integration tests should be run with --test-threads=1 if needed.
Use if let Ok() pattern instead of unwrap() on mutex locks in test
output handlers to prevent cascade failures when tests run in parallel.
@1313 1313 closed this Nov 27, 2025
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.

8 participants