Function

VTCompressionSessionEncodeFrame

Presents frames to the compression session.

Declaration

OSStatus VTCompressionSessionEncodeFrame(VTCompressionSessionRef session, CVImageBufferRef imageBuffer, CMTime presentationTimeStamp, CMTime duration, CFDictionaryRef frameProperties, void *sourceFrameRefcon, VTEncodeInfoFlags *infoFlagsOut);

Parameters

session

The compression session.

imageBuffer

A Core Video image buffer (CVImageBufferRef) containing a video frame to be compressed. The buffer must have a nonzero reference count.

presentationTimeStamp

The presentation timestamp for this frame, to be attached to the sample buffer. Each presentation timestamp passed to a session must be greater than the previous one.

duration

The presentation duration for this frame, to be attached to the sample buffer. If you do not have duration information, pass kCMTimeInvalid.

frameProperties

Key/value pairs specifying additional properties for encoding this frame. Note that some session properties may also be changed between frames. Such changes affect subsequently encoded frames.

sourceFrameRefCon

The reference value for the frame, which is passed to the output callback function.

infoFlagsOut

A pointer to a VTEncodeInfoFlags to receive information about the encode operation.

The kVTEncodeInfo_Asynchronous bit may be set if the encode is (or was) running asynchronously.

The kVTEncodeInfo_FrameDropped bit may be set if the frame was dropped (synchronously).

Pass NULL if you do not want to receive this information.

Discussion

Encoded frames may or may not be output before the function returns. The client should not modify the pixel data after making this call. The session and/or encoder retains the image buffer as long as necessary.

See Also

Encoding Frames

VTCompressionSessionPrepareToEncodeFrames

Enables the encoder to perform any necessary resource allocation before the encoder begins encoding frames (optional).

VTCompressionSessionEncodeFrameWithOutputHandler

Presents frames to the compression session and invokes the output callback when compression is complete.

VTCompressionSessionCompleteFrames

Forces the compression session to complete the encoding of frames.