Class: AVCaptureVideoDataOutput

Inherits:
AVCaptureOutput show all

Overview

AVCaptureVideoDataOutput is a concrete sub-class of AVCaptureOutput you use to process uncompressed frames from the video being captured, or to access compressed frames.

Instance Attribute Summary (collapse)

Attributes inherited from AVCaptureOutput

#connections

Instance Method Summary (collapse)

Methods inherited from AVCaptureOutput

#connectionWithMediaType:, #transformedMetadataObjectForMetadataObject:connection:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (Boolean) alwaysDiscardsLateVideoFrames

Indicates whether video frames are dropped if they arrive late. When the value of this property is YES, the object immediately discards frames that are captured while the dispatch queue handling existing frames is blocked in the captureOutput:didOutputSampleBuffer:fromConnection: delegate method.When the value of this property is NO, delegates are allowed more time to process old frames before new frames are discarded, but application memory usage may increase significantly as a result. The default is YES.

Returns:

  • (Boolean)

- (Array) availableVideoCodecTypes (readonly)

Indicates the supported video codec formats that can be specified in videoSettings. (read-only) The value of this property is an array of NSString objects you can use as values for the AVVideoCodecKey in the videoSettings property. The first format in the returned list is the most efficient output format.

Returns:

- (Array) availableVideoCVPixelFormatTypes (readonly)

Indicates the supported video pixel formats that can be specified in videoSettings. (read-only) The value of this property is an array of NSNumber objects you can use as values for the kCVPixelBufferPixelFormatTypeKey in the videoSettings property. The first format in the returned list is the most efficient output format.

Returns:

- (dispatch_queue_t) sampleBufferCallbackQueue (readonly)

The queue on which delegate callbacks should be invoked (read-only) You set the queue using setSampleBufferDelegate:queue:.

Returns:

  • (dispatch_queue_t)

- (Object) sampleBufferDelegate (readonly)

The capture object’s delegate. (read-only) The delegate receives sample buffers after they are captured.You set the delegate using setSampleBufferDelegate:queue:.

Returns:

- (Hash) videoSettings

The compression settings for the output. The dictionary contains values for compression settings keys defined in AVVideoSettings.h, or pixel buffer attributes keys defined in (see CVPixelBufferRef). To get possible values for the supported video pixel formats (kCVPixelBufferPixelFormatTypeKey) and video codec formats (AVVideoCodecKey), see availableVideoCVPixelFormatTypes and availableVideoCodecTypes respectively.To receive samples in their device native format, set this property to an empty dictionary:To receive samples in a default uncompressed format, set this property to nil. If you set this property to nil and then subsequently query it, you will get a dictionary reflecting the settings used by the capture sessions’s current sessionPreset.

Returns:

Instance Method Details

- (Object) setSampleBufferDelegate(sampleBufferDelegate, queue:sampleBufferCallbackQueue)

Sets the sample buffer delegate and the queue on which callbacks should be invoked. When a new video sample buffer is captured, it is sent to the sample buffer delegate using captureOutput:didOutputSampleBuffer:fromConnection:. All delegate methods are invoked on the specified dispatch queue.If the queue is blocked when new frames are captured, those frames will be automatically dropped at a time determined by the value of the alwaysDiscardsLateVideoFrames property. This allows you to process existing frames on the same queue without having to manage the potential memory usage increases that would otherwise occur when that processing is unable to keep up with the rate of incoming frames.If your frame processing is consistently unable to keep up with the rate of incoming frames, you should consider using the minFrameDuration property, which will generally yield better performance characteristics and more consistent frame rates than frame dropping alone.If you need to minimize the chances of frames being dropped, you should specify a queue on which a sufficiently small amount of processing is being done outside of receiving sample buffers. However, if you migrate extra processing to another queue, you are responsible for ensuring that memory usage does not grow without bound from frames that have not been processed.

Parameters:

  • sampleBufferDelegate (Object)

    An object conforming to the AVCaptureVideoDataOutputSampleBufferDelegate protocol that will receive sample buffers after they are captured.

  • sampleBufferCallbackQueue (dispatch_queue_t)

    The queue on which callbacks should be invoked. You must use a serial dispatch queue, to guarantee that video frames will be delivered in order. The sampleBufferCallbackQueue parameter may not be NULL, except when setting the sampleBufferDelegate to nil.

Returns: