Commit graph

5 commits

Author SHA1 Message Date
PatTheMav 12d25f9a91 mac-avcapture: Fix possible crash if camera uses BGRA format
BGRA or other formats that do not use color primaries will not yield
a valid color primary value. Initializing the CFComparisonResult to a
default value and replacing it only if a non-NULL color primary value
was retrieved avoids a possible crash.
2024-03-08 17:38:40 -05:00
PatTheMav 745f87f21f mac-avcapture: Fix frame rate collection for camera device formats
Some devices will report different framerate ranges for formats that
are identical apart from color primaries. Without taking these into
account, only framerates for one color primary variant would be used
to populate the framerate dropdown in the property view of the camera
source.

Checking for a difference in color primaries when iterating over all
available formats for a device thus requires checking for this
variation and adding the additional frame rate range as well.
2024-02-24 17:38:18 -06:00
PatTheMav 03c42e5b93 mac-avcapture: Fix crash issues on Intel-based Macs and older macOS
Fixes several possible crash issues that might occur on Intel-based Macs
and older macOS versions:

On modern macOS versions (13+) allocated memory is zero-allocated by
default which makes NULL pointer checks work correctly after allocation.

On older macOS versions this is not the case, so the OBSAVCaptureInfo
struct needs to be zero-allocated to ensure the guards in the tick and
render functions bail out correctly.

On Intel-based Macs and/or older macOS versions passing a reference to
the OBSAVCapture instance inside the OBSAVCapture struct can lead to a
crash because of a possible circular reference that cannot be resolved
at runtime.

Passing only a reference of the OBSAVCapture to libobs and incrementing
the retain count at source creation (decrementing in when the source is
destroyed) avoids this issue entirely.
2024-02-20 17:57:09 -05:00
PatTheMav ee28503726 mac-avcapture: Add color format selection for capture card source
Some devices do not support all color formats at all resolutions, but
the capture card source automatically uses an available color format
and compares it against the available format for a specific resolution.

Without being able to change this format, some resolutions do not
work as CMIO will not be able to find a compatible format. Thus the
color format needs to be manually selected for capture card sources
as well.
2024-02-17 19:28:28 -05:00
PatTheMav e284a79b48 mac-avcapture: Update plugin to ObjC and modern APIs
Marks old AVFoundation capture source as deprecated.
2024-01-19 16:56:10 -05:00