---
title: "VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:outputHandler:)"
framework: videotoolbox
role: symbol
role_heading: Function
path: "videotoolbox/vtdecompressionsessiondecodeframe(_:samplebuffer:flags:infoflagsout:outputhandler:)"
---

# VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:outputHandler:)

Decompresses a video frame and invokes the output callback when the decompression completes.

## Declaration

```swift
func VTDecompressionSessionDecodeFrame(_ session: VTDecompressionSession, sampleBuffer: CMSampleBuffer, flags decodeFlags: VTDecodeFrameFlags, infoFlagsOut: UnsafeMutablePointer<VTDecodeInfoFlags>?, outputHandler: @escaping VTDecompressionOutputHandler) -> OSStatus
```

## Parameters

- `session`: The decompression session.
- `sampleBuffer`: A doc://com.apple.documentation/documentation/CoreMedia/CMSampleBuffer object containing one or more video frames.
- `decodeFlags`: A bitfield of directives to the decompression session and decoder. The doc://com.apple.videotoolbox/documentation/VideoToolbox/VTDecodeFrameFlags/kVTDecodeFrame_EnableAsynchronousDecompression bit indicates whether the video decoder may decompress the frame asynchronously. The doc://com.apple.videotoolbox/documentation/VideoToolbox/VTDecodeFrameFlags/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 VTDecompressionSessionDecodeFrame returns. If either flag is set, VTDecompressionSessionDecodeFrame may return before the output callback function is called.
- `infoFlagsOut`: A doc://com.apple.videotoolbox/documentation/VideoToolbox/VTEncodeInfoFlags pointer to receive information about the decode operation. The doc://com.apple.videotoolbox/documentation/VideoToolbox/VTDecodeInfoFlags/asynchronous bit may be set if the decode is (or was) running asynchronously. The doc://com.apple.videotoolbox/documentation/VideoToolbox/VTDecodeInfoFlags/frameDropped bit may be set if the frame was dropped (synchronously). Pass NULL if you do not want to receive this information.
- `outputHandler`: The block to be called when decoding the frame is completed.

## Return Value

Return Value An OSStatus value that indicates the result of the operation.

## Discussion

Discussion This function cannot be called with a session created with a VTDecompressionOutputCallbackRecord.

## See Also

### Decoding Frames

- [VTDecompressionSessionCanAcceptFormatDescription(_:formatDescription:)](videotoolbox/vtdecompressionsessioncanacceptformatdescription(_:formatdescription:).md)
- [VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameRefcon:infoFlagsOut:)](videotoolbox/vtdecompressionsessiondecodeframe(_:samplebuffer:flags:framerefcon:infoflagsout:).md)
- [VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameOptions:frameRefcon:infoFlagsOut:)](videotoolbox/vtdecompressionsessiondecodeframe(_:samplebuffer:flags:frameoptions:framerefcon:infoflagsout:).md)
- [VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:frameOptions:infoFlagsOut:outputHandler:)](videotoolbox/vtdecompressionsessiondecodeframe(_:samplebuffer:flags:frameoptions:infoflagsout:outputhandler:).md)
- [VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:completionHandler:)](videotoolbox/vtdecompressionsessiondecodeframe(_:samplebuffer:flags:infoflagsout:completionhandler:).md)
- [VTDecompressionSessionFinishDelayedFrames(_:)](videotoolbox/vtdecompressionsessionfinishdelayedframes(_:).md)
- [VTDecompressionSessionWaitForAsynchronousFrames(_:)](videotoolbox/vtdecompressionsessionwaitforasynchronousframes(_:).md)
- [VTDecompressionSessionCopyBlackPixelBuffer(_:pixelBufferOut:)](videotoolbox/vtdecompressionsessioncopyblackpixelbuffer(_:pixelbufferout:).md)
