VTCompressionOutputCallback
A callback for the system to invoke when it’s finished compressing a frame.
Declaration
typealias VTCompressionOutputCallback = (UnsafeMutableRawPointer?, UnsafeMutableRawPointer?, OSStatus, VTEncodeInfoFlags, CMSampleBuffer?) -> VoidParameters
- outputCallbackRefCon:
The callback’s reference value.
- sourceFrameRefCon:
The frame’s reference value, copied from the
sourceFrameRefConargument to Vtcompressionsessionencodeframe(_:imagebuffer:presentationtimestamp:duration:frameproperties:sourceframerefcon:infoflagsout:). - status:
noErrif compression was successful; an error code if compression wasn’t successful. - infoFlags:
Contains information about the encode operation.
The Asynchronous bit may be set if the encode ran asynchronously.
The Framedropped bit may be set if the frame was dropped.
- sampleBuffer:
Contains the compressed frame if compression was successful and the frame wasn’t dropped; otherwise,
NULL.
Discussion
When you create a compression session, you pass in a callback function to be called for compressed frames. This function is called in decode order (which is not necessarily the same as display order).