Mac Developer Library

Developer

AVFoundation Framework Reference AVCaptureConnection Class Reference

Options
Deployment Target:

On This Page
Language:

AVCaptureConnection

An AVCaptureConnection object represents a connection between capture input and capture output objects associated with a capture session. More...

Inheritance


Conforms To


Import Statement


import AVFoundation @import AVFoundation;

Availability


Available in OS X v10.7 and later.
  • enabled enabled Property

    Indicates whether the connection is enabled.

    Declaration

    Swift

    var enabled: Bool

    Objective-C

    @property(nonatomic, getter=isEnabled) BOOL enabled

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • active active Property

    Indicates whether the connection is active. (read-only)

    Declaration

    Swift

    var active: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isActive) BOOL active

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • The connection’s input ports. (read-only)

    Declaration

    Swift

    var inputPorts: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *inputPorts

    Discussion

    Input ports are instances of AVCaptureInputPort.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • output output Property

    The connection’s output port. (read-only)

    Declaration

    Swift

    var output: AVCaptureOutput! { get }

    Objective-C

    @property(nonatomic, readonly) AVCaptureOutput *output

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • The video preview layer associated with the connection. (read-only)

    Declaration

    Swift

    var videoPreviewLayer: AVCaptureVideoPreviewLayer! { get }

    Objective-C

    @property(nonatomic, readonly) AVCaptureVideoPreviewLayer *videoPreviewLayer

    Discussion

    This property is the set if you initialized the connection using initWithInputPort:videoPreviewLayer: or connectionWithInputPort:videoPreviewLayer:.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • An array of AVCaptureAudioChannel objects. (read-only)

    Declaration

    Swift

    var audioChannels: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *audioChannels

    Discussion

    This property is only applicable to connections involving audio.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • The orientation of the video.

    Declaration

    Swift

    var videoOrientation: AVCaptureVideoOrientation

    Objective-C

    @property(nonatomic) AVCaptureVideoOrientation videoOrientation

    Discussion

    This property is only applicable to connections involving video.

    If the value of supportsVideoOrientation is YEStrue, 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.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • A Boolean value that indicates whether the connection supports changing the orientation of the video. (read-only)

    Declaration

    Swift

    var supportsVideoOrientation: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isVideoOrientationSupported) BOOL supportsVideoOrientation

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

    See Also

    videoOrientation

  • An indicator of how interlaced video flowing through the connection should be treated

    Declaration

    Swift

    var videoFieldMode: AVVideoFieldMode

    Objective-C

    @property(nonatomic) AVVideoFieldMode videoFieldMode

    Discussion

    This property is only applicable to connections involving video.

    You can only set this value if supportsVideoFieldMode is YEStrue.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • A Boolean value that indicates whether the connection supports setting the videoFieldMode property. (read-only)

    Declaration

    Swift

    var supportsVideoFieldMode: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isVideoFieldModeSupported) BOOL supportsVideoFieldMode

    Discussion

    This property is only applicable to connections involving video.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

    See Also

    videoFieldMode

  • The minimum time interval between which the receiver should output consecutive video frames.

    Declaration

    Swift

    var videoMinFrameDuration: CMTime

    Objective-C

    @property(nonatomic) CMTime videoMinFrameDuration

    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 YEStrue.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • A Boolean value that indicates whether the connection supports setting the videoMinFrameDuration property. (read-only)

    Declaration

    Swift

    var supportsVideoMinFrameDuration: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isVideoMinFrameDurationSupported) BOOL supportsVideoMinFrameDuration

    Discussion

    This property is only applicable to connections involving video.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • The maximum time interval between which the receiver should output consecutive video frames.

    Declaration

    Swift

    var videoMaxFrameDuration: CMTime

    Objective-C

    @property(nonatomic) CMTime videoMaxFrameDuration

    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 YEStrue.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.9 and later.

  • A Boolean value that indicates whether the connection supports setting the videoMaxFrameDuration property. (read-only)

    Declaration

    Swift

    var supportsVideoMaxFrameDuration: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isVideoMaxFrameDurationSupported) BOOL supportsVideoMaxFrameDuration

    Discussion

    This property is only applicable to connections involving video.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.9 and later.

  • A Boolean value that indicates whether the value of videoMirrored can change based on configuration of the session.

    Declaration

    Swift

    var automaticallyAdjustsVideoMirroring: Bool

    Objective-C

    @property(nonatomic) BOOL automaticallyAdjustsVideoMirroring

    Discussion

    For some session configurations, video data flowing through the connection will be mirrored by default. When the value of this property is YEStrue, 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 YEStrue.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • A Boolean value that indicates whether the connection supports video mirroring. (read-only)

    Declaration

    Swift

    var supportsVideoMirroring: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isVideoMirroringSupported) BOOL supportsVideoMirroring

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • A Boolean value that indicates whether the video flowing through the connection should be mirrored about its vertical axis..

    Declaration

    Swift

    var videoMirrored: Bool

    Objective-C

    @property(nonatomic, getter=isVideoMirrored) BOOL videoMirrored

    Discussion

    This property is only applicable to connections involving video.

    if the value of supportsVideoMirroring is YEStrue, you can set videoMirrored to YEStrue to flip the video about its vertical axis and produce a mirror-image effect.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • Constants indicating video orientation.

    Declaration

    Swift

    enum AVCaptureVideoOrientation : Int { case Portrait case PortraitUpsideDown case LandscapeRight case LandscapeLeft }

    Objective-C

    enum { AVCaptureVideoOrientationPortrait = 1, AVCaptureVideoOrientationPortraitUpsideDown = 2, AVCaptureVideoOrientationLandscapeRight = 3, AVCaptureVideoOrientationLandscapeLeft = 4, }; typedef NSInteger AVCaptureVideoOrientation;

    Constants

    • Portrait

      AVCaptureVideoOrientationPortrait

      Indicates that video should be oriented vertically, top at the top.

      Available in OS X v10.7 and later.

    • PortraitUpsideDown

      AVCaptureVideoOrientationPortraitUpsideDown

      Indicates that video should be oriented vertically, top at the bottom.

      Available in OS X v10.7 and later.

    • LandscapeRight

      AVCaptureVideoOrientationLandscapeRight

      Indicates that video should be oriented horizontally, top on the left.

      Available in OS X v10.7 and later.

    • LandscapeLeft

      AVCaptureVideoOrientationLandscapeLeft

      Indicates that video should be oriented horizontally, top on the right.

      Available in OS X v10.7 and later.

    Discussion

    You use these constants in conjunction with an AVCaptureVideoPreviewLayer object; see videoOrientation.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • Constants indicating video field mode, for use with the videoFieldMode property.

    Declaration

    Swift

    enum AVVideoFieldMode : Int { case Both case TopOnly case BottomOnly case Deinterlace }

    Objective-C

    enum { AVVideoFieldModeBoth = 0, AVVideoFieldModeTopOnly = 1, AVVideoFieldModeBottomOnly = 2, AVVideoFieldModeDeinterlace = 3, }; typedef NSInteger AVVideoFieldMode;

    Constants

    • Both

      AVVideoFieldModeBoth

      Indicates that both top and bottom video fields in interlaced content should be passed through.

      Available in OS X v10.7 and later.

    • TopOnly

      AVVideoFieldModeTopOnly

      Indicates that only the top video field in interlaced content should be passed through.

      Available in OS X v10.7 and later.

    • BottomOnly

      AVVideoFieldModeBottomOnly

      Indicates that the bottom video field only in interlaced content should be passed through.

      Available in OS X v10.7 and later.

    • Deinterlace

      AVVideoFieldModeDeinterlace

      Indicates that top and bottom video fields in interlaced content should be deinterlaced.

      Available in OS X v10.7 and later.

    Import Statement

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.