mac-virtualcam: Switch pixel format of camera extension to BGRA

BGRA was used by default in Apple's example code and is also already
supported by OBS.
This commit is contained in:
PatTheMav 2023-08-31 15:21:17 +02:00 committed by Ryan Foster
parent 83c4f5383e
commit f8f2c6d989

View file

@ -52,7 +52,7 @@ class OBSCameraDeviceSource: NSObject, CMIOExtensionDeviceSource {
let dimensions = CMVideoDimensions(width: 1920, height: 1080)
CMVideoFormatDescriptionCreate(
allocator: kCFAllocatorDefault,
codecType: kCVPixelFormatType_32ARGB,
codecType: kCVPixelFormatType_32BGRA,
width: dimensions.width,
height: dimensions.height,
extensions: nil,
@ -179,7 +179,7 @@ class OBSCameraDeviceSource: NSObject, CMIOExtensionDeviceSource {
bitsPerComponent: 8,
bytesPerRow: rowBytes,
space: CGColorSpaceCreateDeviceRGB(),
bitmapInfo: CGImageAlphaInfo.premultipliedFirst.rawValue
bitmapInfo: CGImageAlphaInfo.noneSkipFirst.rawValue | CGBitmapInfo.byteOrder32Little.rawValue
)!
let graphicsContext = NSGraphicsContext(cgContext: cgContext, flipped: false)