Creates a format description for a video media stream contained in CVImageBuffers of the type provided.


func CMVideoFormatDescriptionCreateForImageBuffer(allocator: CFAllocator?, imageBuffer: CVImageBuffer, formatDescriptionOut: UnsafeMutablePointer<CMVideoFormatDescription?>) -> OSStatus



CFAllocator to be used when creating the CMFormatDescription. Pass NULL to use the default allocator.


Image buffer for which we are creating the format description.


On output, returns newly-created video CMFormatDescription

Return Value

A result code. Returns noErr if successful.


This convenience function is equivalent to:

CMVideoFormatDescriptionCreate ( allocator, ( CVPixelBufferGetTypeID() == CFGetTypeID( imageBuffer ) ? CVPixelBufferGetPixelFormatType( imageBuffer ) : 0,  width of image,  height of image, extensions );

* where extensions is a CFDictionary of attachments to image buffer with keys specified by CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers, and also kCMFormatDescriptionExtension_BytesPerRow if applicable.

See Also

Video-Specific Functions

func CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers() -> CFArray

Returns an array of the keys that are used both as CMVideoFormatDescription extensions and CVImageBuffer attachments and attributes.

func CMVideoFormatDescriptionGetPresentationDimensions(CMVideoFormatDescription, usePixelAspectRatio: Bool, useCleanAperture: Bool) -> CGSize

Returns the dimensions, adjusted to take pixel aspect ratio and/or clean aperture into account.

func CMSwapBigEndianImageDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts an ImageDescription data structure from big-endian to host-endian in place.

func CMSwapHostEndianImageDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts an ImageDescription data structure from host-endian to big-endian in place.