AVVideoCompositionRenderContext Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 7.0 and later.
Declared in
AVVideoCompositing.h

Overview

The AVVideoCompositionRenderContext class defines the context within which custom compositors render new output pixels buffers.

An instance of AVVideoCompositionRenderContext provides size and scaling information and offers a service for efficiently providing pixel buffers from a managed pool of buffers.

Tasks

Creating the Pixel Buffer

Rendering Settings

New Methods

Properties

edgeWidths

The thickness of the edge processing region on the left, top, right and bottom edges, in pixels. (read-only)

@property(nonatomic, readonly) AVEdgeWidths edgeWidths
Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

highQualityRendering

The rendering quality to use. (read-only)

@property(nonatomic, readonly) BOOL highQualityRendering
Discussion

Specifies that the custom compositor should use higher quality, potentially slower algorithms.

Generally this property is YES for non-real-time use cases.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

pixelAspectRatio

The pixel aspect ratio for rendered frames. (read-only)

@property(nonatomic, readonly) AVPixelAspectRatio pixelAspectRatio
Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

renderScale

A scaling ratio that is applied when rendering frames. (read-only)

@property(nonatomic, readonly) float renderScale
Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

renderTransform

Transform to apply to the source image (read-only)

@property(nonatomic, readonly) CGAffineTransform renderTransform
Discussion

The transform to apply to the source image incorporating the renderScale, pixelAspectRatio, and edgeWidths.

The coordinate system origin is the top left corner of the buffer.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

size

The width and height for rendering frames. (read-only)

@property(nonatomic, readonly) CGSize size
Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

videoComposition

The video composition being rendered.

@property (nonatomic, readonly) AVVideoComposition *videoComposition;
Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

Instance Methods

newPixelBuffer

Returns a pixel buffer to use for rendering.

- (CVPixelBufferRef)newPixelBuffer
Return Value

A CVPixelBufferRef to use for rendering.

Discussion

The buffer’s kCVImageBufferCleanApertureKey and kCVImageBufferPixelAspectRatioKey attachments are set to match the current composition processor properties.

You are responsible for calling CVBufferRelease on the pixel buffer.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

Constants

AVPixelAspectRatio

These constants define the pixel aspect ratio of the rendering context.

typedef struct {
      NSInteger    horizontalSpacing;
      NSInteger    verticalSpacing;
} AVPixelAspectRatio;
Constants
horizontalSpacing

The horizontal spacing of the pixelAspectRatio property.

verticalSpacing

The vertical spacing of the pixelAspectRatio property.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h

AVEdgeWidths

Defines the thickness of the edge processing region, in pixels.

typedef struct {
      CGFloat        left;
      CGFloat        top;
      CGFloat        right;
      CGFloat        bottom;
} AVEdgeWidths;
Constants
left

The thickness, in pixels, of the left-edge processing region of theedgeWidths property.

top

The thickness, in pixels, of the top-edge processing region of theedgeWidths property.

right

The thickness, in pixels, of the right-edge processing region of theedgeWidths property.

bottom

The thickness, in pixels, of the bottom-edge processing region of theedgeWidths property.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoCompositing.h