Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/QTKit.framework |
Availability | Available in QuickTime 7.2.1 and later. |
Declared in | QTCaptureDecompressedVideoOutput.h QTCaptureVideoPreviewOutput.h |
This class represents an output destination for a QTCaptureSession
that can be used to preview the video being captured. Instances of QTCaptureVideoPreviewOutput
produce decompressed video frames suitable for preview. Because the output video is intended for preview only, instances may drop frames or reduce output quality in order to improve overall performance of the capture session. Applications that need to process full-quality frames without dropping them should use QTCaptureDecompressedVideoOutput
instead.
Applications can access the decompressed frames from a QuickTime visual context for each output connection, or via the captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection:
delegate method. In addition, clients can create subclasses of QTCaptureVideoPreviewOutput
to add custom capturing behavior. Application Kit clients wishing to preview video do not normally need to use QTCaptureVideoPreviewOutput
instances directly, since they are created and managed by instances of QTCaptureView
. Clients should use QTCaptureVideoPreviewOutput
directly only when they require preview functionality not provided by QTCaptureView
or when they need to process decompressed frames directly.
Note that clients should not attempt to access or configure a QTCaptureView’s preview output.
– delegate
– pixelBufferAttributes
– setPixelBufferAttributes:
– visualContextForConnection:
– outputVideoFrame:withSampleBuffer:fromConnection:
– setDelegate:
– setVisualContext:forConnection:
Returns the receiver’s delegate.
- (id)delegate
QTCaptureVideoPreviewOutput.h
Called whenever the receiver outputs a new video frame.
- (void)outputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection
A buffer containing the decompressed frame.
A sample buffer containing additional information about the frame, such as its presentation time.
The connection from which the video was received.
This method should not be invoked directly. Subclasses can override this method to provide custom processing behavior for each frame. The default implementation calls the delegate’s captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection:
method. Subclasses should not assume that this method will be called on the main thread. In addition, this method is called periodically, so it must be efficient to prevent capture performance problems.
QTCaptureVideoPreviewOutput.h
Returns the Core Video pixel buffer attributes previously set by setPixelBufferAttributes:
that determine what kind of pixel buffers are output by the receiver.
- (NSDictionary *)pixelBufferAttributes
A dictionary containing pixel buffer attributes for buffers output by the reciever. The keys in the dictionary are described in CoreVideo/CVPixelBuffer.h
. If the return value is NIL
, then the receiver outputs buffers using the fastest possible pixel buffer attributes.
This method returns the pixel buffer attributes set by setPixelBufferAttributes:
that clients can use to customize the size and pixel format of the video frames output by the receiver. When the dictionary is non-nil, the receiver will attempt to output pixel buffers using the attributes specified in the dictionary. A non-nil dictionary also guarantees that the output CVImageBuffer
is a CVPixelBuffer
. When the value for kCVPixelBufferPixelFormatTypeKey
is set to an NSNumber, all image buffers output by the receiver will be in that format. When the value is an NSArray, image buffers output by the receiver will be in the most optimal format specified in that array. If the captured images are not in the one of the specified pixel formats, then a format conversion will be performed. If the dictionary is NIL
or there is no value for the kCVPixelBufferPixelFormatTypeKey
, then the receiver will output images in the most efficient possible format given the input. For example, if the source is an iSight producing component Y'CbCr 8-bit 4:2:2 video then Y'CbCr 8-bit 4:2:2 will be used as the output format in order to avoid any conversions. The default value for the returned dictionary is NIL
.
QTCaptureVideoPreviewOutput.h
Sets the receiver’s delegate.
- (void)setDelegate:(id)delegate
QTCaptureVideoPreviewOutput.h
Sets the CoreVideo pixel buffer attributes that determine what kind of pixel buffers are output by the receiver.
- (void)setPixelBufferAttributes:(NSDictionary *)pixelBufferAttributes
A dictionary containing pixel buffer attributes for buffers that will be output by the reciever. The keys in the dictionary are described in CoreVideo/CVPixelBuffer.h
. If the dictionary is NIL
, then the receiver outputs buffers using the fastest possible pixel buffer attributes.
This method sets the pixel buffer attributes that clients can use to customize the size and pixel format of the video frames output by the receiver. When the dictionary is non-nil, the receiver will attempt to output pixel buffers using the attributes specified in the dictionary. A non-nil dictionary also guarantees that the output CVImageBuffer
is a CVPixelBuffer
. When the value for kCVPixelBufferPixelFormatTypeKey
is set to an NSNumber, all image buffers output by the receiver will be in that format. When the value is an NSArray, image buffers output by the receiver will be in the most optimal format specified in that array. If the captured images are not in the one of the specified pixel formats, then a format conversion will be performed. If the dictionary is NIL
or there is no value for the kCVPixelBufferPixelFormatTypeKey
, then the receiver will output images in the most efficient possible format given the input. For example, if the source is an iSight producing component Y'CbCr 8-bit 4:2:2 video then Y'CbCr 8-bit 4:2:2 will be used as the output format in order to avoid any conversions.
QTCaptureVideoPreviewOutput.h
Sets the QuickTime visual context used to preview the video for the described connection.
- (void)setVisualContext:(QTVisualContextRef)visualContext forConnection:(QTCaptureConnection *)connection
A QTVisualContextRef
to be used for the preview of the given connection.
The connection to be previewed by the given visual context.
If the application has an existing visual context being used to display video, this method can be used to set the visual context for the preview.
QTCaptureVideoPreviewOutput.h
Returns the QuickTime visual context used to preview the video for the given connection.
- (QTVisualContextRef)visualContextForConnection:(QTCaptureConnection *)connection
The connection previewed by the returned visual context.
A QTVisualContextRef
that provides access to a video preview for the given connection.
The returned visual context can be used to obtain frames that can be used to display a video preview of the capture session. By default this method returns NULL
, until a visual context is set using setVisualContext:forConnection:
.
QTCaptureVideoPreviewOutput.h
Called whenever the video preview output outputs a new video frame.
- (void)captureOutput:(QTCaptureOutput *)captureOutput didOutputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection
The QTCaptureVideoPreviewOutput
instance that output the frame.
A CVImageBufferRef
containing the decompressed frame.
A QTSampleBuffer
object containing additional information about the frame, such as its presentation time.
The connection from which the video was received.
Delegates receive this method whenever the output decompresses and outputs a new video frame. Delegates can use the provided video frame for a custom preview or for further image processing. Delegates should not assume that this method will be called on the main thread. In addition, this method is called periodically, so it must be efficient to prevent capture performance problems.
QTCaptureDecompressedVideoOutput.h
Last updated: 2009-05-20