VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:completionHandler:)
Decompresses a video frame and calls the provided output closure when decompression completes.
Declaration
func VTDecompressionSessionDecodeFrame(_ session: VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags decodeFlags: VTDecodeFrameFlags, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?, completionHandler: @escaping @Sendable (OSStatus, VTDecodeInfoFlags, CVImageBuffer?, [CMTaggedBuffer]?, CMTime, CMTime) -> Void) -> OSStatusParameters
- session:
The decompression session.
- sampleBuffer:
A Cmsamplebuffer object containing one or more video frames.
- decodeFlags:
A bitfield of directives to the decompression session and decoder.
The Kvtdecodeframe_enableasynchronousdecompression bit indicates whether the video decoder may decompress the frame asynchronously.
The Kvtdecodeframe_enabletemporalprocessing bit indicates whether the decoder may delay calls to the output callback so as to enable processing in temporal (display) order.
If both flags are clear, the decompression shall complete and your output callback function will be called before
VTDecompressionSessionDecodeFramereturns. If either flag is set,VTDecompressionSessionDecodeFramemay return before the output callback function is called. - infoFlagsOut:
A Vtencodeinfoflags pointer to receive information about the decode operation.
The Asynchronous bit may be set if the decode is (or was) running asynchronously.
The Framedropped bit may be set if the frame was dropped (synchronously).
Pass
NULLif you do not want to receive this information. - completionHandler:
The closure to be called when decoding the frame is completed. If the VTDecompressionSessionDecodeFrame call returns an error, the closure will not be called.
Return Value
An OSStatus value that indicates the result of the operation.
Discussion
This function cannot be called with a session created with a VTDecompressionOutputCallbackRecord.
See Also
Decoding Frames
VTDecompressionSessionCanAcceptFormatDescription(_:formatDescription:)VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameRefcon:infoFlagsOut:)VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameOptions:frameRefcon:infoFlagsOut:)VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:outputHandler:)VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameOptions:infoFlagsOut:outputHandler:)VTDecompressionSessionFinishDelayedFrames(_:)VTDecompressionSessionWaitForAsynchronousFrames(_:)VTDecompressionSessionCopyBlackPixelBuffer(_:pixelBufferOut:)