I play with the AVScreenShack example from the Apple website (Xcode project), which captures the desktop and displays the capture in the window in quasi-real mode.
I modified the project a bit and inserted this line of code:
-(void)captureOutput:(AVCaptureOutput*) captureOutput didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer fromConnection:(AVCaptureConnection*) connection { ... }
My question is: How do I convert an instance of CMSampleBufferRef to CGImageRef?
Thanks.
objective-c xcode avfoundation macos
user1884325
source share