Contents

VTCompressionSessionEncodeMultiImageFrame(_:taggedBuffers:presentationTimeStamp:duration:frameProperties:infoFlagsOut:outputHandler:)

Passes a multi-image frame to a compression session for encoding and provides a callback to handle the output.

Declaration

func VTCompressionSessionEncodeMultiImageFrame(_ session: VTCompressionSession, taggedBuffers: [CMTaggedBuffer], presentationTimeStamp: CMTime, duration: CMTime, frameProperties: CFDictionary?, infoFlagsOut: UnsafeMutablePointer<VTEncodeInfoFlags>?, outputHandler: @escaping  VTCompressionOutputHandler) -> OSStatus

Parameters

  • session:

    The compression session.

  • taggedBuffers:

    An array of Cmtaggedbuffer structures that contains the multiple images for a video frame to compress.

  • presentationTimeStamp:

    The presentation timestamp for this frame to attach to the sample buffer. Each presentation timestamp that you pass to a session must be greater than the previous one.

  • duration:

    The presentation duration for this frame to attach to the sample buffer. Pass a value of Invalid if you don’t have duration information.

  • frameProperties:

    A dictionary that specifies additional properties for encoding this frame. Some session properties may also change between frames, which affect subsequently encoded frames.

  • infoFlagsOut:

    Points to a Vtencodeinfoflags value to receive information about the encode operation.

    The system sets the Asynchronous flag if the encode runs asynchronously.

    The system sets the Framedropped flag if the encoding process dropped a frame (synchronously).

    Pass NULL if you don’t want to receive this information.

  • outputHandler:

    A callback the system invokes when it completes encoding a frame.

    The system may invoke this callback asynchronously, on a different thread from the one that calls Vtcompressionsessionencodemultiimageframe(_:taggedbuffers:presentationtimestamp:duration:frameproperties:infoflagsout:outputhandler:).

Return Value

An OSStatus value that indicates the result of the operation.

Discussion

The system doesn’t guarantee that encoded frames be output before the function returns. The session and encoder retain the image buffer as long as necessary.

You can’t call this function on a session created with a VTCompressionOutputCallback.

See Also

Encoding Multi-Image Frames