I'm currently using the objc2
crates, specifically the following crates:
objc2_foundation
objc2_core_video
objc2_av_foundation
Im trying to set the video settings for an AVCaptureVideoDataOutput
instance to use the kCVPixelFormatType_32BGRA
pixel format.
Here is my code:
use objc2_foundation::{NSString, NSNumber, NSDictionary};
use objc2_core_video::kCVPixelFormatType_32BGRA;
use objc2_av_foundation::AVCaptureVideoDataOutput;
fn main() {
unsafe {
let output = AVCaptureVideoDataOutput::new();
let pixel_format_key = NSString::from_str("kCVPixelBufferPixelFormatTypeKey");
let pixel_format_value = NSNumber::new_u32(kCVPixelFormatType_32BGRA);
let video_settings = NSDictionary::from_slices::<NSString>(
&[pixel_format_key.as_ref()],
&[pixel_format_value.as_ref()],
);
output.setVideoSettings(Some(&video_settings));
}
}
Thanks!!