AVCaptureDepthDataOutputDelegate

Trait AVCaptureDepthDataOutputDelegate 

Source
pub unsafe trait AVCaptureDepthDataOutputDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn depthDataOutput_didOutputDepthData_timestamp_connection(
        &self,
        output: &AVCaptureDepthDataOutput,
        depth_data: &AVDepthData,
        timestamp: CMTime,
        connection: &AVCaptureConnection,
    )
       where Self: Sized + Message { ... }
    unsafe fn depthDataOutput_didDropDepthData_timestamp_connection_reason(
        &self,
        output: &AVCaptureDepthDataOutput,
        depth_data: &AVDepthData,
        timestamp: CMTime,
        connection: &AVCaptureConnection,
        reason: AVCaptureOutputDataDroppedReason,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature AVCaptureDepthDataOutput only.
Expand description

Defines an interface for delegates of AVCaptureDepthDataOutput to receive captured depth data and be notified of late depth data that were dropped.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn depthDataOutput_didOutputDepthData_timestamp_connection( &self, output: &AVCaptureDepthDataOutput, depth_data: &AVDepthData, timestamp: CMTime, connection: &AVCaptureConnection, )
where Self: Sized + Message,

Available on crate features AVCaptureOutputBase and AVCaptureSession and AVDepthData and objc2-core-media only.

Called whenever an AVCaptureDepthDataOutput instance outputs a new depth data object.

Parameter output: The AVCaptureDepthDataOutput instance vending the depth data.

Parameter depthData: An AVDepthData object containing the depth/disparity data.

Parameter timestamp: A CMTime indicating when the depth data was captured.

Parameter connection: The AVCaptureConnection through which the depth data is received.

The delegate receives this message whenever the depth data output captures and outputs a new depth data object. This method is called on the dispatch queue specified by the output’s delegateCallbackQueue property. This method is called frequently. Care must be taken to process the depth data quickly in order to prevent dropped depth data.

Clients that need to reference the AVDepthData object outside of the scope of this method must retain it and then release it when they are finished with it (in a MRR app).

Note that to maintain optimal performance, AVDepthData pixel buffer maps may be backed by a finite memory pool. If AVDepthData objects are held onto for too long, capture inputs will no longer be able to copy new depth data into memory, resulting in droppage. If your application is causing depth data drops by holding on to provided depth data objects for too long, consider copying the pixel buffer map data into a new pixel buffer so that the AVDepthData backing memory can be reused more quickly.

Source

unsafe fn depthDataOutput_didDropDepthData_timestamp_connection_reason( &self, output: &AVCaptureDepthDataOutput, depth_data: &AVDepthData, timestamp: CMTime, connection: &AVCaptureConnection, reason: AVCaptureOutputDataDroppedReason, )
where Self: Sized + Message,

Available on crate features AVCaptureOutputBase and AVCaptureSession and AVDepthData and objc2-core-media only.

Called once for each depth data that is discarded.

Parameter output: The AVCaptureDepthDataOutput instance that dropped the depth data.

Parameter depthData: A depth data object containing information about the dropped depth, such as its native depth type. This depth data object produces nil CVPixelBuffers for depth / disparity as it has no backing depth map.

Parameter timestamp: A CMTime indicating when the depth data was captured.

Parameter connection: The AVCaptureConnection from which the dropped depth data object was received.

Parameter reason: The reason the depth data object was dropped.

Delegates receive this message whenever a depth data object is dropped. This method is called once for each dropped depth data. The object passed to this delegate method will contain a shell of an AVDepthData that contains no actual depth data backing pixel buffer, as well as a presentation time stamp and a reason for the drop. This method will be called on the dispatch queue specified by the output’s delegateCallbackQueue property. Because this method is called on the same dispatch queue that outputs depth data, it must be efficient to prevent further capture performance problems, such as additional drops.

Trait Implementations§

Source§

impl ProtocolType for dyn AVCaptureDepthDataOutputDelegate

Source§

const NAME: &'static str = "AVCaptureDepthDataOutputDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn AVCaptureDepthDataOutputDelegate

Implementations on Foreign Types§

Source§

impl<T> AVCaptureDepthDataOutputDelegate for ProtocolObject<T>

Implementors§