<!--
{
  "documentType" : "article",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/cvbuffer-nfm",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CVBuffer"
}
-->

# CVBuffer

An abstract base class that defines how to interact with data buffers.

## Discussion

A [`CVBuffer`](/documentation/CoreVideo/CVBuffer) serves as an abstract base class that defines how to interact with buffers of data. A buffer object can hold video, audio, or possibly other types of data. All the other buffer types within the Core Video framework, such as [CVImageBuffer](/documentation/CoreVideo/cvimagebuffer-q40) and [CVPixelBuffer](/documentation/CoreVideo/cvpixelbuffer-q2e), derive from [`CVBuffer`](/documentation/CoreVideo/CVBuffer). You can use the [`CVBuffer`](/documentation/CoreVideo/CVBuffer) programming interface on any Core Video buffer.

## Topics

### Working with attachments

[`func CVBufferHasAttachment(CVBuffer, CFString) -> Bool`](/documentation/CoreVideo/CVBufferHasAttachment(_:_:))

Returns a Boolean value that indicates whether a Core Video buffer contains a specified attachment.

[`func CVBufferCopyAttachment(CVBuffer, CFString, UnsafeMutablePointer<CVAttachmentMode>?) -> CFTypeRef?`](/documentation/CoreVideo/CVBufferCopyAttachment(_:_:_:))

Returns a copy of an attachment from a Core Video buffer.

[`func CVBufferCopyAttachments(CVBuffer, CVAttachmentMode) -> CFDictionary?`](/documentation/CoreVideo/CVBufferCopyAttachments(_:_:))

Returns a copy of all attachments from a Core Video buffer.

[`func CVBufferSetAttachment(CVBuffer, CFString, CFTypeRef, CVAttachmentMode)`](/documentation/CoreVideo/CVBufferSetAttachment(_:_:_:_:))

Sets or adds an attachment to a Core Video buffer.

[`func CVBufferSetAttachments(CVBuffer, CFDictionary, CVAttachmentMode)`](/documentation/CoreVideo/CVBufferSetAttachments(_:_:_:))

Sets a dictionary of attachments on a Core Video buffer.

[`func CVBufferPropagateAttachments(CVBuffer, CVBuffer)`](/documentation/CoreVideo/CVBufferPropagateAttachments(_:_:))

Copies all attachments that Core Video can propagate from one buffer to another.

[`func CVBufferRemoveAttachment(CVBuffer, CFString)`](/documentation/CoreVideo/CVBufferRemoveAttachment(_:_:))

Removes the attachment you specify from a Core Video buffer.

[`func CVBufferRemoveAllAttachments(CVBuffer)`](/documentation/CoreVideo/CVBufferRemoveAllAttachments(_:))

Removes all attachments from a Core Video buffer.

[`func CVBufferGetAttachment(CVBuffer, CFString, UnsafeMutablePointer<CVAttachmentMode>?) -> Unmanaged<CFTypeRef>?`](/documentation/CoreVideo/CVBufferGetAttachment(_:_:_:))

Retrieves a specific attachment of a Core Video buffer.

[`func CVBufferGetAttachments(CVBuffer, CVAttachmentMode) -> CFDictionary?`](/documentation/CoreVideo/CVBufferGetAttachments(_:_:))

Retrieves all attachments of a Core Video buffer.

### Retaining and releasing buffers

[`extern CVBufferRefCVBufferRetain(CVBufferRef buffer);`](/documentation/CoreVideo/CVBufferRetain)

Retains a Core Video buffer.

[`extern void CVBufferRelease(CVBufferRef buffer);`](/documentation/CoreVideo/CVBufferRelease)

Releases a Core Video buffer.

### Protocols

[`protocol CVBufferRepresentable`](/documentation/CoreVideo/CVBufferRepresentable)

CVBufferRepresentable protocol is a sealed protocol intended to be implemented by the
types in CoreVideo framework. This protocol facilitates Swift types that wrap a value
of CVBuffer type.

[`protocol CVAttachmentKeyDefinitions`](/documentation/CoreVideo/CVAttachmentKeyDefinitions)

Marks a type as a collection of attachment keys for an attachment bearer.

[`protocol CVAttachmentModePreference`](/documentation/CoreVideo/CVAttachmentModePreference)

Defines preferred mode for an attachment key.

[`protocol CVAttachmentValueRepresentable`](/documentation/CoreVideo/CVAttachmentValueRepresentable)

Allows Swift types to be used as buffer attachment value.

### Attachment system (Swift)

[`struct CVAttachmentAccess`](/documentation/CoreVideo/CVAttachmentAccess)

Provides access to the attachments of a buffer.

[`struct CVAttachmentContainer`](/documentation/CoreVideo/CVAttachmentContainer)

Provides storage for buffer attachments independent of the buffer lifetime

[`struct CVAttachmentRawValue`](/documentation/CoreVideo/CVAttachmentRawValue)

A lightweight wrapper around raw attachment values.

[`struct CVAttachmentKeyDefinition`](/documentation/CoreVideo/CVAttachmentKeyDefinition)

Associates a raw attachment key with a value type and preferred propagation mode.

[`struct CVAttachmentKeyDefinitionWithDefault`](/documentation/CoreVideo/CVAttachmentKeyDefinitionWithDefault)

Associates a raw attachment key with a default value and preferred propagation mode.

[`struct CVAttachmentCompositeKeyDefinition`](/documentation/CoreVideo/CVAttachmentCompositeKeyDefinition)

Associates a set of raw attachment keys with a value type and preferred propagation mode.

[`enum CVAttachmentModePreferenceShouldPropagate`](/documentation/CoreVideo/CVAttachmentModePreferenceShouldPropagate)

Sets preferred mode for attachment to should propagate

[`enum CVAttachmentModePreferenceShouldNotPropagate`](/documentation/CoreVideo/CVAttachmentModePreferenceShouldNotPropagate)

Sets preferred mode for attachment to should not propagate

### Data types

[`class CVBuffer`](/documentation/CoreVideo/CVBuffer)

[`enum CVAttachmentMode`](/documentation/CoreVideo/CVAttachmentMode)

The propagation modes of a Core Video buffer attachment.

### Constants

[CVBuffer Attribute Keys](/documentation/CoreVideo/cvbuffer-attribute-keys)

The attributes associated with Core Video buffers.

[CVBuffer Attachment Keys](/documentation/CoreVideo/cvbuffer-attachment-keys)

The attachment types for a Core Video buffer.

## See Also

  [Core Video Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/CoreVideo/CVProg_Intro/CVProg_Intro.html#//apple_ref/doc/uid/TP40001536)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)