Class AVCaptureStillImageOutput

  • All Implemented Interfaces:
    NSObject

    public class AVCaptureStillImageOutput
    extends AVCaptureOutput
    AVCaptureStillImageOutput AVCaptureStillImageOutput is a concrete subclass of AVCaptureOutput that can be used to capture high-quality still images with accompanying metadata. Instances of AVCaptureStillImageOutput can be used to capture, on demand, high quality snapshots from a realtime capture source. Clients can request a still image for the current time using the captureStillImageAsynchronouslyFromConnection:completionHandler: method. Clients can also configure still image outputs to produce still images in specific image formats.
    • Constructor Detail

      • AVCaptureStillImageOutput

        protected AVCaptureStillImageOutput​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • jpegStillImageNSDataRepresentation

        public static NSData jpegStillImageNSDataRepresentation​(CMSampleBufferRef jpegSampleBuffer)
        jpegStillImageNSDataRepresentation: Converts the still image data and metadata attachments in a JPEG sample buffer to an NSData representation. This method returns an NSData representation of a JPEG still image sample buffer, merging the image data and Exif metadata sample buffer attachments without recompressing the image. The returned NSData is suitable for writing to disk.
        Parameters:
        jpegSampleBuffer - The sample buffer carrying JPEG image data, optionally with Exif metadata sample buffer attachments. This method throws an NSInvalidArgumentException if jpegSampleBuffer is NULL or not in the JPEG format.
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • automaticallyEnablesStillImageStabilizationWhenAvailable

        public boolean automaticallyEnablesStillImageStabilizationWhenAvailable()
        [@property] automaticallyEnablesStillImageStabilizationWhenAvailable Indicates whether the receiver should automatically use still image stabilization when necessary. On a receiver where -isStillImageStabilizationSupported returns YES, image stabilization may be applied to reduce blur commonly found in low light photos. When stabilization is enabled, still image captures incur additional latency. The default value is YES when supported, NO otherwise. Setting this property throws an NSInvalidArgumentException if -isStillImageStabilizationSupported returns NO.
      • availableImageDataCVPixelFormatTypes

        public NSArray<? extends NSNumber> availableImageDataCVPixelFormatTypes()
        [@property] availableImageDataCVPixelFormatTypes Indicates the supported image pixel formats that can be specified in outputSettings. The value of this property is an NSArray of NSNumbers that can be used as values for the kCVPixelBufferPixelFormatTypeKey in the receiver's outputSettings property. The first format in the returned list is the most efficient output format.
      • availableImageDataCodecTypes

        public NSArray<java.lang.String> availableImageDataCodecTypes()
        [@property] availableImageDataCodecTypes Indicates the supported image codec formats that can be specified in outputSettings. The value of this property is an NSArray of AVVideoCodecTypes that can be used as values for the AVVideoCodecKey in the receiver's outputSettings property.
      • captureStillImageAsynchronouslyFromConnectionCompletionHandler

        public void captureStillImageAsynchronouslyFromConnectionCompletionHandler​(AVCaptureConnection connection,
                                                                                   AVCaptureStillImageOutput.Block_captureStillImageAsynchronouslyFromConnectionCompletionHandler handler)
        captureStillImageAsynchronouslyFromConnection:completionHandler: Initiates an asynchronous still image capture, returning the result to a completion handler. This method will return immediately after it is invoked, later calling the provided completion handler block when image data is ready. If the request could not be completed, the error parameter will contain an NSError object describing the failure. Attachments to the image data sample buffer may contain metadata appropriate to the image data format. For instance, a sample buffer containing JPEG data may carry a kCGImagePropertyExifDictionary as an attachment. See for a list of keys and value types. Clients should not assume that the completion handler will be called on a specific thread. Calls to captureStillImageAsynchronouslyFromConnection:completionHandler: are not synchronized with AVCaptureDevice manual control completion handlers. Setting a device manual control, waiting for its completion, then calling captureStillImageAsynchronouslyFromConnection:completionHandler: DOES NOT ensure that the still image returned reflects your manual control change. It may be from an earlier time. You can compare your manual control completion handler sync time to the returned still image's presentation time. You can retrieve the sample buffer's pts using CMSampleBufferGetPresentationTimestamp(). If the still image has an earlier timestamp, your manual control command does not apply to it.
        Parameters:
        connection - The AVCaptureConnection object from which to capture the still image.
        handler - A block that will be called when the still image capture is complete. The block will be passed a CMSampleBuffer object containing the image data or an NSError object if an image could not be captured.
      • captureStillImageBracketAsynchronouslyFromConnectionWithSettingsArrayCompletionHandler

        public void captureStillImageBracketAsynchronouslyFromConnectionWithSettingsArrayCompletionHandler​(AVCaptureConnection connection,
                                                                                                           NSArray<? extends AVCaptureBracketedStillImageSettings> settings,
                                                                                                           AVCaptureStillImageOutput.Block_captureStillImageBracketAsynchronouslyFromConnectionWithSettingsArrayCompletionHandler handler)
        captureStillImageBracketAsynchronouslyFromConnection:withSettingsArray:completionHandler: Captures a still image bracket. If you have not called -prepareToCaptureStillImageBracketFromConnection:withSettingsArray:completionHandler: for this still image bracket request, the bracket may not be taken immediately, as the receiver may internally need to prepare resources.
        Parameters:
        connection - The connection through which the still image bracket should be captured.
        settings - An array of AVCaptureBracketedStillImageSettings objects. All must be of the same kind of AVCaptureBracketedStillImageSettings subclass, or an NSInvalidArgumentException is thrown.
        handler - A user provided block that will be called asynchronously as each still image in the bracket is captured. If the capture request is successful, the "sampleBuffer" parameter contains a valid CMSampleBuffer, the "stillImageSettings" parameter contains the settings object corresponding to this still image, and a nil "error" parameter. If the bracketed capture fails, sample buffer is NULL and error is non-nil. If [settings count] exceeds -maxBracketedCaptureStillImageCount, then AVErrorMaximumStillImageCaptureRequestsExceeded is returned. You should not assume that the completion handler will be called on a specific thread.
      • isCapturingStillImage

        public boolean isCapturingStillImage()
        [@property] capturingStillImage A boolean value that becomes true when a still image is being captured. The value of this property is a BOOL that becomes true when a still image is being captured, and false when no still image capture is underway. This property is key-value observable.
      • isHighResolutionStillImageOutputEnabled

        public boolean isHighResolutionStillImageOutputEnabled()
        [@property] highResolutionStillImageOutputEnabled Indicates whether the receiver should emit still images at the highest resolution supported by its source AVCaptureDevice's activeFormat. By default, AVCaptureStillImageOutput emits images with the same dimensions as its source AVCaptureDevice's activeFormat.formatDescription. However, if you set this property to YES, the receiver emits still images at its source AVCaptureDevice's activeFormat.highResolutionStillImageDimensions. Note that if you enable video stabilization (see AVCaptureConnection's preferredVideoStabilizationMode) for any output, the high resolution still images emitted by AVCaptureStillImageOutput may be smaller by 10 or more percent.
      • setHighResolutionStillImageOutputEnabled

        public void setHighResolutionStillImageOutputEnabled​(boolean value)
        [@property] highResolutionStillImageOutputEnabled Indicates whether the receiver should emit still images at the highest resolution supported by its source AVCaptureDevice's activeFormat. By default, AVCaptureStillImageOutput emits images with the same dimensions as its source AVCaptureDevice's activeFormat.formatDescription. However, if you set this property to YES, the receiver emits still images at its source AVCaptureDevice's activeFormat.highResolutionStillImageDimensions. Note that if you enable video stabilization (see AVCaptureConnection's preferredVideoStabilizationMode) for any output, the high resolution still images emitted by AVCaptureStillImageOutput may be smaller by 10 or more percent.
      • isLensStabilizationDuringBracketedCaptureEnabled

        public boolean isLensStabilizationDuringBracketedCaptureEnabled()
        [@property] lensStabilizationDuringBracketedCaptureEnabled Indicates whether the receiver should use lens stabilization during bracketed captures. On a receiver where -isLensStabilizationDuringBracketedCaptureSupported returns YES, lens stabilization may be applied to the bracket to reduce blur commonly found in low light photos. When lens stabilization is enabled, bracketed still image captures incur additional latency. Lens stabilization is more effective with longer-exposure captures, and offers limited or no benefit for exposure durations shorter than 1/30 of a second. It is possible that during the bracket, the lens stabilization module may run out of correction range and therefore will not be active for every frame in the bracket. Each emitted CMSampleBuffer from the bracket will have an attachment of kCMSampleBufferAttachmentKey_StillImageLensStabilizationInfo indicating additional information about stabilization was applied to the buffer, if any. The default value of -isLensStabilizationDuringBracketedCaptureEnabled is NO. This value will be set to NO when -isLensStabilizationDuringBracketedCaptureSupported changes to NO. Setting this property throws an NSInvalidArgumentException if -isLensStabilizationDuringBracketedCaptureSupported returns NO. This property is key-value observable.
      • setLensStabilizationDuringBracketedCaptureEnabled

        public void setLensStabilizationDuringBracketedCaptureEnabled​(boolean value)
        [@property] lensStabilizationDuringBracketedCaptureEnabled Indicates whether the receiver should use lens stabilization during bracketed captures. On a receiver where -isLensStabilizationDuringBracketedCaptureSupported returns YES, lens stabilization may be applied to the bracket to reduce blur commonly found in low light photos. When lens stabilization is enabled, bracketed still image captures incur additional latency. Lens stabilization is more effective with longer-exposure captures, and offers limited or no benefit for exposure durations shorter than 1/30 of a second. It is possible that during the bracket, the lens stabilization module may run out of correction range and therefore will not be active for every frame in the bracket. Each emitted CMSampleBuffer from the bracket will have an attachment of kCMSampleBufferAttachmentKey_StillImageLensStabilizationInfo indicating additional information about stabilization was applied to the buffer, if any. The default value of -isLensStabilizationDuringBracketedCaptureEnabled is NO. This value will be set to NO when -isLensStabilizationDuringBracketedCaptureSupported changes to NO. Setting this property throws an NSInvalidArgumentException if -isLensStabilizationDuringBracketedCaptureSupported returns NO. This property is key-value observable.
      • isLensStabilizationDuringBracketedCaptureSupported

        public boolean isLensStabilizationDuringBracketedCaptureSupported()
        [@property] lensStabilizationDuringBracketedCaptureSupported Indicates whether the receiver supports lens stabilization during bracketed captures. The receiver's lensStabilizationDuringBracketedCaptureEnabled property can only be set if this property returns YES. Its value may change as the session's -sessionPreset or input device's -activeFormat changes. This read-only property is key-value observable.
      • isStillImageStabilizationActive

        public boolean isStillImageStabilizationActive()
        [@property] stillImageStabilizationActive Indicates whether still image stabilization is in use for the current capture. On a receiver where -isStillImageStabilizationSupported returns YES, and automaticallyEnablesStillImageStabilizationWhenAvailable is set to YES, this property may be key-value observed, or queried from inside your key-value observation callback for the @"capturingStillImage" property, to find out if still image stabilization is being applied to the current capture.
      • isStillImageStabilizationSupported

        public boolean isStillImageStabilizationSupported()
        [@property] stillImageStabilizationSupported Indicates whether the receiver supports still image stabilization. The receiver's automaticallyEnablesStillImageStabilizationWhenAvailable property can only be set if this property returns YES. Its value may change as the session's -sessionPreset or input device's -activeFormat changes.
      • maxBracketedCaptureStillImageCount

        public long maxBracketedCaptureStillImageCount()
        [@property] maxBracketedCaptureStillImageCount Specifies the maximum number of still images that may be taken in a single bracket. AVCaptureStillImageOutput can only satisfy a limited number of image requests in a single bracket without exhausting system resources. The maximum number of still images that may be taken in a single bracket depends on the size of the images being captured, and consequently may vary with AVCaptureSession -sessionPreset and AVCaptureDevice -activeFormat. Some formats do not support bracketed capture and return a maxBracketedCaptureStillImageCount of 0. This read-only property is key-value observable. If you exceed -maxBracketedCaptureStillImageCount, then -captureStillImageBracketAsynchronouslyFromConnection:withSettingsArray:completionHandler: fails and the completionHandler is called [settings count] times with a NULL sample buffer and AVErrorMaximumStillImageCaptureRequestsExceeded.
      • outputSettings

        public NSDictionary<java.lang.String,​?> outputSettings()
        [@property] outputSettings Specifies the options the receiver uses to encode still images before they are delivered. See AVVideoSettings.h for more information on how to construct an output settings dictionary. On iOS, the only currently supported keys are AVVideoCodecKey and kCVPixelBufferPixelFormatTypeKey. Use -availableImageDataCVPixelFormatTypes and -availableImageDataCodecTypes to determine what codec keys and pixel formats are supported. AVVideoQualityKey is supported on iOS 6.0 and later and may only be used when AVVideoCodecKey is set to AVVideoCodecTypeJPEG.
      • prepareToCaptureStillImageBracketFromConnectionWithSettingsArrayCompletionHandler

        public void prepareToCaptureStillImageBracketFromConnectionWithSettingsArrayCompletionHandler​(AVCaptureConnection connection,
                                                                                                      NSArray<? extends AVCaptureBracketedStillImageSettings> settings,
                                                                                                      AVCaptureStillImageOutput.Block_prepareToCaptureStillImageBracketFromConnectionWithSettingsArrayCompletionHandler handler)
        prepareToCaptureStillImageBracketFromConnection:withSettingsArray:completionHandler: Allows the receiver to prepare resources in advance of capturing a still image bracket. -maxBracketedCaptureStillImageCount tells you the maximum number of images that may be taken in a single bracket given the current AVCaptureDevice/AVCaptureSession/AVCaptureStillImageOutput configuration. But before taking a still image bracket, additional resources may need to be allocated. By calling -prepareToCaptureStillImageBracketFromConnection:withSettingsArray:completionHandler: first, you are able to deterministically know when the receiver is ready to capture the bracket with the specified settings array.
        Parameters:
        connection - The connection through which the still image bracket should be captured.
        settings - An array of AVCaptureBracketedStillImageSettings objects. All must be of the same kind of AVCaptureBracketedStillImageSettings subclass, or an NSInvalidArgumentException is thrown.
        handler - A user provided block that will be called asynchronously once resources have successfully been allocated for the specified bracketed capture operation. If sufficient resources could not be allocated, the "prepared" parameter contains NO, and "error" parameter contains a non-nil error value. If [settings count] exceeds -maxBracketedCaptureStillImageCount, then AVErrorMaximumStillImageCaptureRequestsExceeded is returned. You should not assume that the completion handler will be called on a specific thread.
      • setAutomaticallyEnablesStillImageStabilizationWhenAvailable

        public void setAutomaticallyEnablesStillImageStabilizationWhenAvailable​(boolean value)
        [@property] automaticallyEnablesStillImageStabilizationWhenAvailable Indicates whether the receiver should automatically use still image stabilization when necessary. On a receiver where -isStillImageStabilizationSupported returns YES, image stabilization may be applied to reduce blur commonly found in low light photos. When stabilization is enabled, still image captures incur additional latency. The default value is YES when supported, NO otherwise. Setting this property throws an NSInvalidArgumentException if -isStillImageStabilizationSupported returns NO.
      • setOutputSettings

        public void setOutputSettings​(NSDictionary<java.lang.String,​?> value)
        [@property] outputSettings Specifies the options the receiver uses to encode still images before they are delivered. See AVVideoSettings.h for more information on how to construct an output settings dictionary. On iOS, the only currently supported keys are AVVideoCodecKey and kCVPixelBufferPixelFormatTypeKey. Use -availableImageDataCVPixelFormatTypes and -availableImageDataCodecTypes to determine what codec keys and pixel formats are supported. AVVideoQualityKey is supported on iOS 6.0 and later and may only be used when AVVideoCodecKey is set to AVVideoCodecTypeJPEG.