Protocol

AVVideoCompositing

The AVVideoCompositing protocol defines properties and methods that custom video compositors must implement.

Overview

For each AV Foundation object of class AVPlayerItem, AVAssetExportSession, AVAssetImageGenerator, or AVAssetReaderVideoCompositionOutput that has a non-nil value for its videoComposition property, and the value of the customVideoCompositorClass property of the AVVideoComposition is not nil, AV Foundation creates and uses an instance of that custom video compositor class to process the instructions contained in the AVVideoComposition.

The custom video compositor instance will be created when you assign videoComposition an instance of AVVideoComposition that's associated with a different custom video compositor class than the object was previously using.

When creating instances of custom video compositors, AV Foundation initializes them by calling init and then makes them available as the value of the customVideoCompositor property of the object to which it was assigned. You then can do any additional setup or configuration to the custom compositor.

Custom video compositor instances will then be retained by the AV Foundation object for as long as the value of its videoComposition property indicates that an instance of the same custom video compositor class should be used, even if the value is changed from one instance of AVVideoComposition to another instance that's associated with the same custom video compositor class.

Symbols

Rendering the Composition

func startRequest(AVAsynchronousVideoCompositionRequest)
Required.

Directs a custom video compositor object to create a new pixel buffer composed asynchronously from a collection of sources.

func cancelAllPendingVideoCompositionRequests()

Directs a custom video compositor object to cancel or finish all pending video composition requests.

Render Context Settings

func renderContextChanged(AVVideoCompositionRenderContext)
Required.

Invoked to notify the custom compositor that a composition will switch to a different render context.

Pixel Buffer Attributes

var requiredPixelBufferAttributesForRenderContext: [String : Any]
Required.

Returns the pixel buffer attributes required by the video compositor for new buffers created for processing.

var sourcePixelBufferAttributes: [String : Any]?
Required.

Returns the kinds of source frame pixel buffer attributes a video compositor can accept as input.

Relationships

Inherits From