pub unsafe trait AVCapturePhotoFileDataRepresentationCustomizer: NSObjectProtocol {
// Provided methods
unsafe fn replacementMetadataForPhoto(
&self,
photo: &AVCapturePhoto,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>
where Self: Sized + Message { ... }
unsafe fn replacementEmbeddedThumbnailPixelBufferWithPhotoFormat_forPhoto(
&self,
replacement_embedded_thumbnail_photo_format_out: &mut Option<Retained<NSDictionary<NSString, AnyObject>>>,
photo: &AVCapturePhoto,
) -> Option<Retained<CVPixelBuffer>>
where Self: Sized + Message { ... }
unsafe fn replacementDepthDataForPhoto(
&self,
photo: &AVCapturePhoto,
) -> Option<Retained<AVDepthData>>
where Self: Sized + Message { ... }
unsafe fn replacementPortraitEffectsMatteForPhoto(
&self,
photo: &AVCapturePhoto,
) -> Option<Retained<AVPortraitEffectsMatte>>
where Self: Sized + Message { ... }
unsafe fn replacementSemanticSegmentationMatteOfType_forPhoto(
&self,
semantic_segmentation_matte_type: &AVSemanticSegmentationMatteType,
photo: &AVCapturePhoto,
) -> Option<Retained<AVSemanticSegmentationMatte>>
where Self: Sized + Message { ... }
unsafe fn replacementAppleProRAWCompressionSettingsForPhoto_defaultSettings_maximumBitDepth(
&self,
photo: &AVCapturePhoto,
default_settings: &NSDictionary<NSString, AnyObject>,
maximum_bit_depth: NSInteger,
) -> Retained<NSDictionary<NSString, AnyObject>>
where Self: Sized + Message { ... }
}AVCapturePhotoOutput only.Expand description
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.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn replacementMetadataForPhoto(
&self,
photo: &AVCapturePhoto,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>
unsafe fn replacementMetadataForPhoto( &self, photo: &AVCapturePhoto, ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>
A callback in which you may provide replacement metadata, or direct the AVCapturePhoto to strip existing metadata from the flattened file data representation.
Parameter photo: The calling instance of AVCapturePhoto.
Returns: A dictionary of keys and values from <ImageIO /CGImageProperties.h>. To preserve existing metadata, return photo.metadata. To strip existing metadata, return nil. To replace metadata, pass a replacement dictionary.
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.
Sourceunsafe fn replacementEmbeddedThumbnailPixelBufferWithPhotoFormat_forPhoto(
&self,
replacement_embedded_thumbnail_photo_format_out: &mut Option<Retained<NSDictionary<NSString, AnyObject>>>,
photo: &AVCapturePhoto,
) -> Option<Retained<CVPixelBuffer>>
Available on crate feature objc2-core-video only.
unsafe fn replacementEmbeddedThumbnailPixelBufferWithPhotoFormat_forPhoto( &self, replacement_embedded_thumbnail_photo_format_out: &mut Option<Retained<NSDictionary<NSString, AnyObject>>>, photo: &AVCapturePhoto, ) -> Option<Retained<CVPixelBuffer>>
objc2-core-video only.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.
Parameter replacementEmbeddedThumbnailPhotoFormatOut: On output, a pointer to a dictionary of keys and values from
<AVFoundation
/AVVideoSettings.h> 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.
Parameter 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.
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.
§Safety
replacement_embedded_thumbnail_photo_format_out generic should be of the correct type.
Sourceunsafe fn replacementDepthDataForPhoto(
&self,
photo: &AVCapturePhoto,
) -> Option<Retained<AVDepthData>>
Available on crate feature AVDepthData only.
unsafe fn replacementDepthDataForPhoto( &self, photo: &AVCapturePhoto, ) -> Option<Retained<AVDepthData>>
AVDepthData only.A callback in which you may provide replacement depth data, or strip the existing depth data from the flattened file data representation.
Parameter 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.
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.
Sourceunsafe fn replacementPortraitEffectsMatteForPhoto(
&self,
photo: &AVCapturePhoto,
) -> Option<Retained<AVPortraitEffectsMatte>>
Available on crate feature AVPortraitEffectsMatte only.
unsafe fn replacementPortraitEffectsMatteForPhoto( &self, photo: &AVCapturePhoto, ) -> Option<Retained<AVPortraitEffectsMatte>>
AVPortraitEffectsMatte only.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.
Parameter 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.
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.
Sourceunsafe fn replacementSemanticSegmentationMatteOfType_forPhoto(
&self,
semantic_segmentation_matte_type: &AVSemanticSegmentationMatteType,
photo: &AVCapturePhoto,
) -> Option<Retained<AVSemanticSegmentationMatte>>
Available on crate feature AVSemanticSegmentationMatte only.
unsafe fn replacementSemanticSegmentationMatteOfType_forPhoto( &self, semantic_segmentation_matte_type: &AVSemanticSegmentationMatteType, photo: &AVCapturePhoto, ) -> Option<Retained<AVSemanticSegmentationMatte>>
AVSemanticSegmentationMatte only.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.
Parameter semanticSegmentationMatteType: The type of semantic segmentation matte to be replaced or stripped.
Parameter 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.
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.
Sourceunsafe fn replacementAppleProRAWCompressionSettingsForPhoto_defaultSettings_maximumBitDepth(
&self,
photo: &AVCapturePhoto,
default_settings: &NSDictionary<NSString, AnyObject>,
maximum_bit_depth: NSInteger,
) -> Retained<NSDictionary<NSString, AnyObject>>
unsafe fn replacementAppleProRAWCompressionSettingsForPhoto_defaultSettings_maximumBitDepth( &self, photo: &AVCapturePhoto, default_settings: &NSDictionary<NSString, AnyObject>, maximum_bit_depth: NSInteger, ) -> Retained<NSDictionary<NSString, AnyObject>>
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.
Parameter photo: The calling instance of AVCapturePhoto.
Parameter defaultSettings: The default settings that will be used if not overridden.
Parameter 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.
This callback is optional. If your delegate does not implement this callback, the default compression settings for the file type will be used.
§Safety
default_settings generic should be of the correct type.