-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mac-avcapture: Use list-based format selector #10895
base: master
Are you sure you want to change the base?
Conversation
plugins/mac-avcapture/OBSAVCapture.h
Outdated
/// Compare two `AVCaptureDeviceFormat`s for purposes of sorting in the properties window. | ||
static NSComparator const OBSAVCaptureDeviceFormatCompare = | ||
^NSComparisonResult(AVCaptureDeviceFormat *a, AVCaptureDeviceFormat *b) { | ||
CMVideoDimensions aDimensions = CMVideoFormatDescriptionGetDimensions(a.formatDescription); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried calculating a "bandwidth" for each format (which would necessarily include resolution, number of planes, size per plane, colour depth, etc.) so you get a nice single numerical value representing a format and then you can just compare the value of A
and B
.
Also the default names for custom comparators in Swift is lhs
and rhs
, which I'd prefer here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried calculating a "bandwidth" for each format (which would necessarily include resolution, number of planes, size per plane, colour depth, etc.) so you get a nice single numerical value representing a format and then you can just compare the value of A and B.
This seems like a nice idea, I'll just have to look into the specifics. Adjusted argument names for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought here so I don't forget; the sort order may also want to cleanly delineate aspect ratio in some way at the top level; i.e. all 16:9 formats separated from all 4:3 formats, etc; all landscape ratios separate from all portrait and square ratios that might exist too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some code-specific comments, overall I'd like to see more discussion about:
- Presentation of the formats in the dropdown (@Warchamp7 got some ideas there?)
- How to "upgrade" existing source configurations
de521d2
to
af5e538
Compare
Couple misc changes:
Secondly, added a migration routine in Hopefully this should be in a pretty good state now. Was intending to squash at the end, just let know if you want me to squash whenever. |
Description
Updates the properties window for macOS
mac-avcapture
sources to use a unified list-based format selector when in the non-preset mode. Also adds a contextual warning in the properties window to show when a device has macOS system effects active.The frame rate selector is retained, so that we can continue to have explicit control over the device frame rate. The list selectors for resolution, color space, pixel format and video range, however, have all been consolidated inside the single format selector.
Motivation and Context
#9344 provided a much-needed update to the Video Capture Device source on macOS and added a lower-latency Capture Card Device source. A number of factors, however, have conspired to make the new version of the source harder to use, for both novice and adept users:
This PR aims to simplify and improve the UI for the source while also reducing the complexity of the property selection code.
Additionally, the new effects warning in the properties window should help to alleviate some user confusion. On macOS, enabling an effect such as Studio Light or Portrait mode for one video input will often enable them on all inputs (filed as FB13302833). Users are often confused to see webcam effects on e.g. capture card inputs. With this PR, the source properties window displays a warning for active system effects, which should make this issue more apparent.
How Has This Been Tested?
Tested locally on an M1 Max machine running the macOS Sequoia beta with all video capture devices on hand, including the built-in webcam, Continuity Camera from an iPhone, a virtual camera, and a single capture card from a popular brand, to ensure both OBS source types remained in good working order.
Types of changes
Checklist: