Contents

CVBufferSetAttachment(_:_:_:_:)

Sets or adds an attachment to a Core Video buffer.

Declaration

func CVBufferSetAttachment(_ buffer: CVBuffer, _ key: CFString, _ value: CFTypeRef, _ attachmentMode: CVAttachmentMode)

Parameters

  • buffer:

    The buffer on which to add or set an attachment.

  • key:

    A string that identifies the attachment, which can be of any Cftyperef. See Cvbuffer Attachment Keys and Image Buffer Attachment Keys for predefined values.

  • value:

    The attachment in the form of a Core Foundation object. If this parameter is NULL, the function returns an error.

  • attachmentMode:

    The attachment mode for this attachment. See Cvattachmentmode for possible values. Any given attachment key may exist in only one mode at a time.

Discussion

You can attach any Core Foundation object to a Core Video buffer to store additional information.

If it doesn’t exist for the buffer object, the system adds a new attachment. If the key does exist, the system replaces the existing attachment. In both cases, the system increases the retain count of the attachment.

You can also set attachments when creating a buffer by specifying them in the kCVBufferPropagatedAttachmentsKey or kCVBufferNonPropagatedAttachmentsKey attributes.

To retrieve attachments, use the CVBufferGetAttachment(_:_:_:) or CVBufferGetAttachments(_:_:) functions.

See Also

Working with attachments