Protocol

AVCapturePhotoFileDataRepresentationCustomizer

A set of delegate callbacks to be implemented by callers of fileDataRepresentation(with:).

Declaration

protocol AVCapturePhotoFileDataRepresentationCustomizer

Overview

AVCapturePhoto is a wrapper representing a photo in a file container. To flatten the photo to an NSData object to write to file, call fileDataRepresentation(). For more complex flattening operations such as replacing or stripping metadata, call fileDataRepresentation(with:) and provide a delegate for customized replacement or stripping behavior. This delegate's methods are called synchronously before the flattening process begins.

Topics

Replacing or Removing Metadata

func replacementMetadata(for: AVCapturePhoto) -> [String : Any]?

A callback in which you can provide replacement metadata or direct AVCapturePhoto to strip existing metadata from the flattened file.

func replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat: AutoreleasingUnsafeMutablePointer<NSDictionary?>, for: AVCapturePhoto) -> Unmanaged<CVPixelBuffer>?

A callback in which you can provide a replacement embedded thumbnail image with compression settings, or strip the existing embedded thumbnail image from the flattened file.

func replacementDepthData(for: AVCapturePhoto) -> AVDepthData?

A callback in which you can provide replacement depth data or strip existing depth data from the file.

func replacementPortraitEffectsMatte(for: AVCapturePhoto) -> AVPortraitEffectsMatte?

A callback in which you can provide a replacement portrait effects matte, or strip the existing portrait effects matte from the file.

Relationships

Inherits From

See Also

Packaging Data for File Output

func fileDataRepresentation() -> Data?

Generates and returns a flat data representation of the photo and its attachments.

func cgImageRepresentation() -> Unmanaged<CGImage>?

Extracts and returns the captured photo's primary image as a Core Graphics image object.

func previewCGImageRepresentation() -> Unmanaged<CGImage>?

Extracts and returns the captured photo's preview image as a CoreGraphics image object.