AVCaptureConnection Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AVFoundation.framework |
| Availability | Available in iOS 4.0 and later. |
| Companion guide | |
| Declared in | AVCaptureSession.h |
Overview
An AVCaptureConnection object represents a connection between capture input and capture output objects associated with a capture session.
Capture inputs (instances of AVCaptureInput) have one or more input ports (instances of AVCaptureInputPort). Capture outputs (instances of AVCaptureOutput) can accept data from one or more sources (for example, an AVCaptureMovieFileOutput object accepts both video and audio data).
You can only add an AVCaptureConnection instance to a session using addConnection: if canAddConnection: returns YES. When using addInput: or addOutput:, connections are formed automatically between all compatible inputs and outputs. You only need to add connections manually when adding an input or output with no connections. You can also use connections to enable or disable the flow of data from a given input or to a given output.
Tasks
Configuration
-
enabledproperty -
activeproperty -
inputPortsproperty -
outputproperty -
videoPreviewLayerproperty -
audioChannelsproperty
Managing Video Configuration
-
videoOrientationproperty -
supportsVideoOrientationproperty -
videoMinFrameDurationproperty -
supportsVideoMinFrameDurationproperty -
videoMaxFrameDurationproperty -
supportsVideoMaxFrameDurationproperty -
videoScaleAndCropFactorproperty -
videoMaxScaleAndCropFactorproperty
Managing the Video Mirroring Settings
-
automaticallyAdjustsVideoMirroringproperty -
supportsVideoMirroringproperty -
videoMirroredproperty
Managing the Video Stabilization Settings
-
enablesVideoStabilizationWhenAvailableproperty -
supportsVideoStabilizationproperty -
videoStabilizationEnabledproperty
Properties
active
Indicates whether the connection is active. (read-only)
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.haudioChannels
An array of AVCaptureAudioChannel objects. (read-only)
Discussion
This property is only applicable to connections involving audio.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.hautomaticallyAdjustsVideoMirroring
A Boolean value that indicates whether the value of videoMirrored can change based on configuration of the session.
Discussion
For some session configurations, video data flowing through the connection will be mirrored by default. When the value of this property is YES, the value of videoMirrored may change depending on the configuration of the session, for example after switching to a different capture device input.
The default value is YES.
Availability
- Available in iOS 6.0 and later.
Declared In
AVCaptureSession.henabled
Indicates whether the connection is enabled.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.henablesVideoStabilizationWhenAvailable
A Boolean value that indicates whether the system should enable video stabilization when it is available.
Discussion
The default value of this property is NO. If the supportsVideoStabilization property contains the value YES, you can change the value of this property to YES to enable video stabilization for the connection.
You can only enable video stabilization for connections that operate on video. Even so, not all source formats and video resolutions are supported. Enabling video stabilization may also introduce additional latency into the video capture pipeline. To detect when video stabilization is in use, use the videoStabilizationEnabled property.
Availability
- Available in iOS 6.0 and later.
Declared In
AVCaptureSession.hinputPorts
The connection’s input ports. (read-only)
Discussion
Input ports are instances of AVCaptureInputPort.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.houtput
The connection’s output port. (read-only)
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.hsupportsVideoMaxFrameDuration
A Boolean value that indicates whether the connection supports setting the videoMaxFrameDuration property. (read-only)
Discussion
This property is only applicable to connections involving video.
Availability
- Available in iOS 5.0 and later.
Declared In
AVCaptureSession.hsupportsVideoMinFrameDuration
A Boolean value that indicates whether the connection supports setting the videoMinFrameDuration property. (read-only)
Discussion
This property is only applicable to connections involving video.
Availability
- Available in iOS 5.0 and later.
Declared In
AVCaptureSession.hsupportsVideoMirroring
A Boolean value that indicates whether the connection supports video mirroring. (read-only)
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.hsupportsVideoOrientation
A Boolean value that indicates whether the connection supports changing the orientation of the video. (read-only)
Availability
- Available in iOS 4.0 and later.
See Also
Declared In
AVCaptureSession.hsupportsVideoStabilization
A Boolean value that indicates whether this connection supports video stabilization. (read-only)
Discussion
Video stabilization is supported only for video connection types. And even for video connections, it might not be available at all resolutions.
Availability
- Available in iOS 6.0 and later.
Declared In
AVCaptureSession.hvideoMaxFrameDuration
The maximum time interval between which the receiver should output consecutive video frames.
Discussion
The value of this property specifies the maximum duration of each video frame output by the connection, placing an upper bound on the amount of time that should separate consecutive frames. The value is equivalent to the reciprocal of the minimum frame rate.
A value of kCMTimeZero or kCMTimeInvalid indicates an unlimited minimum frame rate.
The default value is kCMTimeInvalid.
You can only set this value if supportsVideoMaxFrameDuration is YES.
Availability
- Available in iOS 5.0 and later.
Declared In
AVCaptureSession.hvideoMaxScaleAndCropFactor
The maximum video scale and crop factor by the connection. (read-only)
Discussion
The value specifies the maximum value that you can use when setting the videoScaleAndCropFactor property.
This property is only applicable to connections involving video.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
AVCaptureSession.hvideoMinFrameDuration
The minimum time interval between which the receiver should output consecutive video frames.
Discussion
The value of this property specifies the minimum duration of each video frame output by the connection, placing a lower bound on the amount of time that should separate consecutive frames. The value is equivalent to the reciprocal of the maximum frame rate.
A value of kCMTimeZero or kCMTimeInvalid indicates an unlimited maximum frame rate.
The default value is kCMTimeInvalid.
You can only set this value if supportsVideoMinFrameDuration is YES.
Availability
- Available in iOS 5.0 and later.
Declared In
AVCaptureSession.hvideoMirrored
A Boolean value that indicates whether the video flowing through the connection should be mirrored about its vertical axis..
Discussion
This property is only applicable to connections involving video.
if the value of supportsVideoMirroring is YES, you can set videoMirrored to YES to flip the video about its vertical axis and produce a mirror-image effect.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureSession.hvideoOrientation
The orientation of the video.
Discussion
This property is only applicable to connections involving video.
If the value of supportsVideoOrientation is YES, you can set videoOrientation to rotate the video buffers being consumed by the connection’s output. Setting videoOrientation does not necessarily result in a physical rotation of video buffers. For example, a video connection to an AVCaptureMovieFileOutput object handles orientation using a Quicktime track matrix; using an AVCaptureStillImageOutput object, orientation is handled using Exif tags.
Availability
- Available in iOS 4.0 and later.
See Also
Declared In
AVCaptureSession.hvideoPreviewLayer
The video preview layer associated with the connection. (read-only)
Discussion
This property is the set if you initialized the connection using initWithInputPort:videoPreviewLayer: or connectionWithInputPort:videoPreviewLayer:.
Availability
- Available in iOS 6.0 and later.
Declared In
AVCaptureSession.hvideoScaleAndCropFactor
The current video scale and crop factor in use by the receiver.
Discussion
This property is only applicable to connections involving video.
You can set this property to a value in the range of 1.0 to the value of videoMaxScaleAndCropFactor. At a factor of 1.0, the image is its original size. At a factor greater than 1.0, the image is scaled by the factor and center-cropped to its original dimensions.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
AVCaptureSession.hvideoStabilizationEnabled
A Boolean value that indicates whether video stabilization is active for the connection. (read-only)
Discussion
If video stabilization is supported for the current connection type, and you enable it using the enablesVideoStabilizationWhenAvailable property, this property reports when stabilization is actively in use for the connection.
You can monitor this property using key-value observing if you want to detect when video stabilization is being applied to the video data.
Availability
- Available in iOS 6.0 and later.
Declared In
AVCaptureSession.hConstants
AVCaptureVideoOrientation
Constants indicating video orientation.
enum {
AVCaptureVideoOrientationPortrait = 1,
AVCaptureVideoOrientationPortraitUpsideDown = 2,
AVCaptureVideoOrientationLandscapeRight = 3,
AVCaptureVideoOrientationLandscapeLeft = 4,
};
typedef NSInteger AVCaptureVideoOrientation;
Constants
AVCaptureVideoOrientationPortraitIndicates that video should be oriented vertically, top at the top.
Available in iOS 4.0 and later.
Declared in
AVCaptureSession.h.AVCaptureVideoOrientationPortraitUpsideDownIndicates that video should be oriented vertically, top at the bottom.
Available in iOS 4.0 and later.
Declared in
AVCaptureSession.h.AVCaptureVideoOrientationLandscapeRightIndicates that video should be oriented horizontally, top on the left.
Available in iOS 4.0 and later.
Declared in
AVCaptureSession.h.AVCaptureVideoOrientationLandscapeLeftIndicates that video should be oriented horizontally, top on the right.
Available in iOS 4.0 and later.
Declared in
AVCaptureSession.h.
Discussion
You use these constants in conjunction with an AVCaptureVideoPreviewLayer object; see videoOrientation.
AVVideoFieldMode
Constants indicating video field mode, for use with the videoFieldMode property.
enum {
AVVideoFieldModeBoth = 0,
AVVideoFieldModeTopOnly = 1,
AVVideoFieldModeBottomOnly = 2,
AVVideoFieldModeDeinterlace = 3,
};
typedef NSInteger AVVideoFieldMode;
Constants
AVVideoFieldModeBothIndicates that both top and bottom video fields in interlaced content should be passed through.
Available in iOS 6.0 and later.
Declared in
AVCaptureSession.h.AVVideoFieldModeTopOnlyIndicates that only the top video field in interlaced content should be passed through.
Available in iOS 6.0 and later.
Declared in
AVCaptureSession.h.AVVideoFieldModeBottomOnlyIndicates that the bottom video field only in interlaced content should be passed through.
Available in iOS 6.0 and later.
Declared in
AVCaptureSession.h.AVVideoFieldModeDeinterlaceIndicates that top and bottom video fields in interlaced content should be deinterlaced.
Available in iOS 6.0 and later.
Declared in
AVCaptureSession.h.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)