Mac Developer Library

Developer

AV Foundation 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.

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

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

    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

    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.

    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

    Objective-C

    @import AVFoundation;

    Swift

    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

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.