Next Page > Hide TOC

QTCaptureView Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/QTKit.framework
Availability
Available in QuickTime 7.2.1 and later.
Declared in
QTCaptureView.h
Related sample code

Overview

This is a subclass of NSView that displays a video preview of a capture session. A QTCaptureView previews the video being processed by an instance of QTCaptureSession. This class creates and maintains its own QTCaptureVideoPreviewOutput as necessary to gather preview video from the capture session.

Tasks

Associating a View with a Capture Session

Controlling View Appearance

Getting and Setting a Delegate

Methods Implemented by the Delegate

Instance Methods

availableVideoPreviewConnections

Returns an array of output video connections that can be previewed.

- (NSArray *)availableVideoPreviewConnections

Return Value

An array of QTCaptureConnection instances for connections available to be previewed.

Discussion

This method returns an array of connections that can be previewed with the receiver. The returned connections can be used with the setVideoPreviewConnection: method to set the connection being previewed by the receiver.

If there are multiple video connections that can be previewed, this method can determine which the view will display.

Availability
Declared In
QTCaptureView.h

captureSession

Returns the capture session being previewed by the receiver.

- (QTCaptureSession *)captureSession

Return Value

A QTCaptureSession instance used for the preview.

Availability
Declared In
QTCaptureView.h

delegate

Returns the receiver’s delegate.

- (id)delegate

Availability
Declared In
QTCaptureView.h

fillColor

Returns the fill color drawn in the area of the view not covered by the video preview.

- (NSColor *)fillColor

Return Value

An NSColor of the receiver’s fill color.

Availability
Declared In
QTCaptureView.h

preservesAspectRatio

Returns whether the receiver preserves the aspect ratio of the video preview when drawing it.

- (BOOL)preservesAspectRatio

Return Value

Returns YES if the video preview aspect ratio is preserved; otherwise, NO.

Availability
Declared In
QTCaptureView.h

previewBounds

Returns the rectangle occupied by the video preview in the view.

- (NSRect)previewBounds

Return Value

The rectangle occupied by the video preview in the view.

Discussion

The default implementation of this method returns a video rectangle based on the value returned by preservesAspectRatio. Subclasses can override this method to change the rectangle occupied by the video preview.

Availability
Declared In
QTCaptureView.h

setCaptureSession:

Sets the capture session to be previewed by the receiver.

- (void)setCaptureSession:(QTCaptureSession *)captureSession

Parameters
captureSession

A QTCaptureSession instance to be used for the preview.

Availability
Declared In
QTCaptureView.h

setDelegate:

Sets the receiver’s delegate.

- (void)setDelegate:(id)delegate

Availability
Declared In
QTCaptureView.h

setFillColor:

Sets the fill color drawn in the area of the view not covered by the video preview.

- (void)setFillColor:(NSColor *)fillColor

Parameters
fillColor

An NSColor to be used for the receiver’s fill color.

Availability
Declared In
QTCaptureView.h

setPreservesAspectRatio:

Sets whether the receiver preserves the aspect ratio of the video preview when drawing it.

- (void)setPreservesAspectRatio:(BOOL)preservesAspectRatio

Parameters
preservesAspectRatio

If YES, preserves the aspect ratio; otherwise, NO.

Availability
Declared In
QTCaptureView.h

setVideoPreviewConnection:

Sets the output connection to be previewed by the receiver.

- (void)setVideoPreviewConnection:(QTCaptureConnection *)connection

Parameters
connection

A QTCaptureConnection instance for the connection to be previewed.

Discussion

A QTCaptureView can only preview one video connection at a time. This method sets the output connection to be previewed by the receiver. The given connection must be one of the connections returned by availableVideoPreviewConnections or this method throws an NSInvalidArgumentException.

If there are multiple video connections that can be previewed, this method can determine which the view will display.

Availability
Declared In
QTCaptureView.h

videoPreviewConnection

Returns the output connection being previewed by the receiver.

- (QTCaptureConnection *)videoPreviewConnection

Return Value

A QTCaptureConnection instance for the previewed connection.

Discussion

A QTCaptureView can preview only one video connection at a time. This method returns the output connection currently being previewed by the receiver.

If there are multiple video connections that can be previewed, this method can determine which the view will display.

Availability
Declared In
QTCaptureView.h

Delegate Methods

view:willDisplayImage:

Delegates of QTCaptureView can implement this method to modify the image that is to be drawn into a QTCaptureView.

- (CIImage *)view:(QTCaptureView *)view willDisplayImage:(CIImage *)image

Parameters
view

A QTCaptureView object that identifies the view which is about to draw.

image

A CIImage object that represents the frame that will otherwise be drawn to the QTCaptureView.

Return Value

Delegates should return a CIImage object to be drawn by the capture view, or NIL if the capture view should draw the original image.

Discussion

The image parameter is a CIImage representing the captured frame that is about to be drawn into a QTCaptureView. The delegate can return another image that modifies the source image (by applying a CIFilter, for example). The returned image will then be drawn into the capture view instead of the source image. The delegate can also return NIL or the original image to leave the drawn image unmodified.

Availability
Declared In
QTCaptureView.h

Next Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-04-08)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.