CapSoftware / scap

High-performance, cross-platform screen capture library in Rust.
https://crates.io/crates/scap
Other
238 stars 46 forks source link

feat: improves API design #82

Closed clearlysid closed 6 months ago

clearlysid commented 6 months ago

Changes:

Pranav2612000 commented 6 months ago

options.targets is now options.target and accepts an Option instead of Vec

We kept it as Vec to allow the user to pass multiple targets ( for e.g two application windows ).

clearlysid commented 6 months ago

@Pranav2612000 I had mentioned this change here, thought your green check mark meant you approve 😅 https://discord.com/channels/1044321624545046569/1189167062019477567/1244658459396280435

Pranav2612000 commented 6 months ago

https://discord.com/channels/1044321624545046569/1189167062019477567/1244658459396280435

Yup! My bad. Looking at the code now made me remember this scenario. Also I'm not sure how windows does it, but for Mac we won't need to spawn a new capturer for each target. ScreenCaptureKit APIs accept multiple targets.

clearlysid commented 6 months ago

Also I'm not sure how windows does it, but for Mac we won't need to spawn a new capturer for each target. ScreenCaptureKit APIs accept multiple targets.

I checked this as well — It can't accept "multiple" targets in a conventional sense. You can only ever capture a single display at a time, the multiple targets are only for:

  1. specific windows you want to include OR
  2. specific windows you want to exclude.

Case 1: not relevant for us at the moment since we only want individual window capture Case 2: we have accounted for using excluded_targets option.

Reference here: https://developer.apple.com/documentation/screencapturekit/sccontentfilter See each topic under "Creating a filter"