Contents

CMVideoFormatDescriptionCreateForImageBuffer(allocator:imageBuffer:formatDescriptionOut:)

Creates a format description for a video media stream by using an image buffer.

Declaration

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

Parameters

  • allocator:

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

  • imageBuffer:

    Image buffer for which we are creating the format description.

  • formatDescriptionOut:

    On output, returns newly created video CMFormatDescription.

Return Value

A result code. Returns noErr if successful.

Discussion

This convenience function is equivalent to:

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

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

See Also

Working with Video Descriptions