Interface AVCapturePhotoFileDataRepresentationCustomizer


  • public interface AVCapturePhotoFileDataRepresentationCustomizer
    [@protocol] AVCapturePhotoFileDataRepresentationCustomizer A set of delegate callbacks to be implemented by a client who calls AVCapturePhoto's -fileDataRepresentationWithCustomizer:. AVCapturePhoto is a wrapper representing a file-containerized photo in memory. If you simply wish to flatten the photo to an NSData to be written to a file, you may call -[AVCapturePhoto fileDataRepresentation]. For more complex flattening operations in which you wish to replace or strip metadata, you should call -[AVCapturePhoto fileDataRepresentationWithCustomizer:] instead, providing a delegate for customized stripping / replacing behavior. This delegate's methods are called synchronously before the flattening process commences. API-Since: 12.0
    • Method Detail

      • replacementDepthDataForPhoto

        @Nullable
        default @Nullable AVDepthData replacementDepthDataForPhoto​(@NotNull
                                                                   @NotNull AVCapturePhoto photo)
        replacementDepthDataForPhoto: A callback in which you may provide replacement depth data, or strip the existing depth data from the flattened file data representation. This callback is optional. If your delegate does not implement this callback, the existing depth data in the in-memory AVCapturePhoto container will be written to the file data representation.
        Parameters:
        photo - The calling instance of AVCapturePhoto.
        Returns:
        An instance of AVDepthData. To preserve the existing depth data, return photo.depthData. To strip the existing one, return nil. To replace, provide a replacement AVDepthData instance.
      • replacementEmbeddedThumbnailPixelBufferWithPhotoFormatForPhoto

        @Nullable
        default @Nullable CVBufferRef replacementEmbeddedThumbnailPixelBufferWithPhotoFormatForPhoto​(@NotNull
                                                                                                     @NotNull org.moe.natj.general.ptr.Ptr<NSDictionary<java.lang.String,​?>> replacementEmbeddedThumbnailPhotoFormatOut,
                                                                                                     @NotNull
                                                                                                     @NotNull AVCapturePhoto photo)
        replacementEmbeddedThumbnailPixelBufferWithPhotoFormat:forPhoto: A callback in which you may provide a replacement embedded thumbnail image with compression settings, or strip the existing embedded thumbnail image from the flattened file data representation. This callback is optional. If your delegate does not implement this callback, the existing embedded thumbnail photo in the in-memory AVCapturePhoto container will be written to the file data representation.
        Parameters:
        replacementEmbeddedThumbnailPhotoFormatOut - On output, a pointer to a dictionary of keys and values from If you pass a non-nil dictionary, AVVideoCodecKey is required, with AVVideoWidthKey and AVVideoHeightKey being optional. To preserve the existing embedded thumbnail photo to the flattened data, set *replacementEmbeddedThumbnailPhotoFormatOut to photo.embeddedThumbnailPhotoFormat and return nil. To strip the existing embedded thumbnail, set *replacementEmbeddedThumbnailPhotoFormatOut to nil and return nil. To replace the existing embedded thumbnail photo, pass a replacement photo format dictionary and return a non-nil replacement pixel buffer.
        photo - The calling instance of AVCapturePhoto.
        Returns:
        A pixel buffer containing a source image to be encoded to the file as the replacement thumbnail image. To preserve the existing embedded thumbnail photo to the flattened data, set *replacementEmbeddedThumbnailPhotoFormatOut to photo.embeddedThumbnailPhotoFormat and return nil. To strip the existing embedded thumbnail, set *replacementEmbeddedThumbnailPhotoFormatOut to nil and return nil. To replace the existing embedded thumbnail photo, pass a replacement photo format dictionary and return a non-nil replacement pixel buffer.
      • replacementMetadataForPhoto

        @Nullable
        default @Nullable NSDictionary<java.lang.String,​?> replacementMetadataForPhoto​(@NotNull
                                                                                             @NotNull AVCapturePhoto photo)
        replacementMetadataForPhoto: A callback in which you may provide replacement metadata, or direct the AVCapturePhoto to strip existing metadata from the flattened file data representation. This callback is optional. If your delegate does not implement this callback, the existing metadata in the in-memory AVCapturePhoto container will be written to the file data representation.
        Parameters:
        photo - The calling instance of AVCapturePhoto.
        Returns:
        A dictionary of keys and values from . To preserve existing metadata, return photo.metadata. To strip existing metadata, return nil. To replace metadata, pass a replacement dictionary.
      • replacementPortraitEffectsMatteForPhoto

        @Nullable
        default @Nullable AVPortraitEffectsMatte replacementPortraitEffectsMatteForPhoto​(@NotNull
                                                                                         @NotNull AVCapturePhoto photo)
        replacementPortraitEffectsMatteForPhoto: A callback in which you may provide a replacement portrait effects matte, or strip the existing portrait effects matte from the flattened file data representation. This callback is optional. If your delegate does not implement this callback, the existing portrait effects matte in the in-memory AVCapturePhoto container will be written to the file data representation.
        Parameters:
        photo - The calling instance of AVCapturePhoto.
        Returns:
        An instance of AVPortraitEffectsMatte. To preserve the existing portrait effects matte, return photo.portraitEffectsMatte. To strip the existing one, return nil. To replace, provide a replacement AVPortraitEffectsMatte instance.
      • replacementSemanticSegmentationMatteOfTypeForPhoto

        @Nullable
        default @Nullable AVSemanticSegmentationMatte replacementSemanticSegmentationMatteOfTypeForPhoto​(@NotNull
                                                                                                         @NotNull java.lang.String semanticSegmentationMatteType,
                                                                                                         @NotNull
                                                                                                         @NotNull AVCapturePhoto photo)
        replacementSemanticSegmentationMatteOfType:forPhoto: A callback in which you may provide a replacement semantic segmentation matte of the indicated type, or strip the existing one from the flattened file data representation. This callback is optional. If your delegate does not implement this callback, the existing semantic segmentation matte of the specified type in the in-memory AVCapturePhoto container will be written to the file data representation. API-Since: 13.0
        Parameters:
        semanticSegmentationMatteType - The type of semantic segmentation matte to be replaced or stripped.
        photo - The calling instance of AVCapturePhoto.
        Returns:
        An instance of AVSemanticSegmentationMatte. To preserve the existing matte, return [photo semanticSegmentationMatteForType:semanticSegmentationMatteType]. To strip the existing one, return nil. To replace, provide a replacement AVPortraitEffectsMatte instance.
      • replacementAppleProRAWCompressionSettingsForPhotoDefaultSettingsMaximumBitDepth

        @NotNull
        default @NotNull NSDictionary<java.lang.String,​?> replacementAppleProRAWCompressionSettingsForPhotoDefaultSettingsMaximumBitDepth​(@NotNull
                                                                                                                                                @NotNull AVCapturePhoto photo,
                                                                                                                                                @NotNull
                                                                                                                                                @NotNull NSDictionary<java.lang.String,​?> defaultSettings,
                                                                                                                                                long maximumBitDepth)
        replacementAppleProRAWCompressionSettingsForPhoto:defaultSettings:maximumBitDepth: A callback in which you may provide replacement compression settings for the DNG flattened file data representation of Apple ProRAW. This callback will only be invoked for Apple ProRAW captures written to DNG. This callback is optional. If your delegate does not implement this callback, the default compression settings for the file type will be used. API-Since: 14.3
        Parameters:
        photo - The calling instance of AVCapturePhoto.
        defaultSettings - The default settings that will be used if not overridden.
        maximumBitDepth - The maximum bit depth that can be specified with AVVideoAppleProRAWBitDepthKey in the returned settings dictionary.
        Returns:
        An NSDictionary containing compression settings to be used when writing the DNG file representation. Currently accepted keys are: AVVideoQualityKey (NSNumber in range 0 to 1.0, inclusive) AVVideoAppleProRAWBitDepthKey (NSNumber in range 8 to maximumBitDepth, inclusive) Setting AVVideoQualityKey to 1.0 will use lossless compression. Any value between 0 and 1.0 will use lossy compression with that quality. Setting AVVideoAppleProRAWBitDepthKey to a value less than what is given in defaultSettings may result in quantization losses. Any keys not specified in the returned dictionary will use the values from defaultSettings. Return defaultSettings if no changes to the compression settings are desired.