iOS Developer Library

Developer

AVFoundation Framework Reference AVPlayerItemVideoOutput Class Reference

Options
Deployment Target:

On This Page
Language:

AVPlayerItemVideoOutput

The AVPlayerItemVideoOutput lets you coordinate the output of content associated with a Core Video pixel buffer.

Inheritance


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 6.0 and later.
  • Initializes and returns a video output object using the specified pixel buffer attributes.

    Declaration

    Swift

    init!(pixelBufferAttributes pixelBufferAttributes: [NSObject : AnyObject]!)

    Objective-C

    - (instancetype)initWithPixelBufferAttributes:(NSDictionary *)pixelBufferAttributes

    Parameters

    pixelBufferAttributes

    The pixel buffer attributes required for video output. For a list of pixel buffer attributes you can include in this dictionary, see the CVPixelBuffer.h header file in the Core Video framework.

    Return Value

    An initialized video output object.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • delegate delegate Property

    The delegate for the video output object. (read-only)

    Declaration

    Swift

    var delegate: AVPlayerItemOutputPullDelegate! { get }

    Objective-C

    @property(nonatomic, readonly) id< AVPlayerItemOutputPullDelegate > delegate

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • The dispatch queue on which to call delegate methods. (read-only)

    Declaration

    Swift

    var delegateQueue: dispatch_queue_t! { get }

    Objective-C

    @property(nonatomic, readonly) dispatch_queue_t delegateQueue

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • Sets the delegate and dispatch queue for the receiver.

    Declaration

    Swift

    func setDelegate(_ delegate: AVPlayerItemOutputPullDelegate!, queue delegateQueue: dispatch_queue_t!)

    Objective-C

    - (void)setDelegate:(id<AVPlayerItemOutputPullDelegate>)delegate queue:(dispatch_queue_t)delegateQueue

    Parameters

    delegate

    The delegate object for the receiver. You may specify nil for this parameter.

    delegateQueue

    The dispatch queue on which to call delegate methods. If you specify nil for this parameter, the video output object calls the delegate on the dispatch queue for your app’s main thread.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • Informs the receiver that the video out put client is entering a quiescent state.

    Declaration

    Swift

    func requestNotificationOfMediaDataChangeWithAdvanceInterval(_ interval: NSTimeInterval)

    Objective-C

    - (void)requestNotificationOfMediaDataChangeWithAdvanceInterval:(NSTimeInterval)interval

    Parameters

    interval

    The amount of time to wait before notifying the delegate of the media change.

    Discussion

    Call this method before you suspend your use of a CVDisplayLinkRef type or a CADisplayLink object. After the interval expires, the video output object notifies its delegate that it should resume the display link. If the interval value you specify is large, the delegate is notified as soon as possible rather than waiting.

    Do not call this method repeatedly to force the delegate to be notified for each sample.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • Returns a Boolean value indicating whether video output is available for the specified item time.

    Declaration

    Swift

    func hasNewPixelBufferForItemTime(_ itemTime: CMTime) -> Bool

    Objective-C

    - (BOOL)hasNewPixelBufferForItemTime:(CMTime)itemTime

    Parameters

    itemTime

    The item time to query. The time value is relative to the AVPlayerItem object with which the receiver is associated.

    Return Value

    YEStrue if there is available video output that has not been previously acquired or NOfalse if there is not.

    Discussion

    This method returns YEStrue if the video data at the specified time has not yet been acquired or is different from the video that was acquired previously. If you require multiple objects to acquire video output from the same AVPlayerItem object, you should create separate AVPlayerItemVideoOutput objects for each.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • Acquires and returns an image that is appropriate to display at the specified time.

    Declaration

    Swift

    func copyPixelBufferForItemTime(_ itemTime: CMTime, itemTimeForDisplay outItemTimeForDisplay: UnsafeMutablePointer<CMTime>) -> CVPixelBuffer!

    Objective-C

    - (CVPixelBufferRef)copyPixelBufferForItemTime:(CMTime)itemTime itemTimeForDisplay:(CMTime *)outItemTimeForDisplay

    Parameters

    itemTime

    The time at which you want to retrieve the image from the item.

    outItemTimeForDisplay

    The time by which you intend to use the returned pixel buffer. You may specify nil for this parameter if you do not have a specific deadline.

    Return Value

    A pixel buffer containing the image data to display or nil if nothing should be displayed at the specified time. The caller is responsible for calling CVBufferRelease on the returned data when it is no longer needed.

    Discussion

    Typically, you call this method in response to a CVDisplayLink callback or a CADisplayLink delegate method call when the hasNewPixelBufferForItemTime: method also returns YEStrue.

    After calling this method, the video output object marks the pixel buffer data as having been acquired. This causes the hasNewPixelBufferForItemTime: method to return NOfalse unless newer data becomes available.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.