objc2_av_foundation/generated/
AVCaptureMetadataOutput.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// AVCaptureMetadataOutput is a concrete subclass of AVCaptureOutput that can be used to process metadata objects from an attached connection.
14    ///
15    ///
16    /// Instances of AVCaptureMetadataOutput emit arrays of AVMetadataObject instances (see AVMetadataObject.h), such as detected faces. Applications can access the metadata objects with the captureOutput:didOutputMetadataObjects:fromConnection: delegate method.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemetadataoutput?language=objc)
19    #[unsafe(super(AVCaptureOutput, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(feature = "AVCaptureOutputBase")]
22    pub struct AVCaptureMetadataOutput;
23);
24
25#[cfg(feature = "AVCaptureOutputBase")]
26unsafe impl NSObjectProtocol for AVCaptureMetadataOutput {}
27
28#[cfg(feature = "AVCaptureOutputBase")]
29impl AVCaptureMetadataOutput {
30    extern_methods!(
31        #[unsafe(method(init))]
32        #[unsafe(method_family = init)]
33        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
34
35        #[unsafe(method(new))]
36        #[unsafe(method_family = new)]
37        pub unsafe fn new() -> Retained<Self>;
38
39        /// The receiver's delegate.
40        ///
41        ///
42        /// The value of this property is an object conforming to the AVCaptureMetadataOutputObjectsDelegate protocol that will receive metadata objects after they are captured. The delegate is set using the setMetadataObjectsDelegate:queue: method.
43        #[unsafe(method(metadataObjectsDelegate))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn metadataObjectsDelegate(
46            &self,
47        ) -> Option<Retained<ProtocolObject<dyn AVCaptureMetadataOutputObjectsDelegate>>>;
48
49        #[cfg(feature = "AVMetadataObject")]
50        /// Indicates the receiver's supported metadata object types.
51        ///
52        ///
53        /// The value of this property is an NSArray of NSStrings corresponding to AVMetadataObjectType strings defined in AVMetadataObject.h -- one for each metadata object type supported by the receiver. Available metadata object types are dependent on the capabilities of the AVCaptureInputPort to which this receiver's AVCaptureConnection is connected. Clients may specify the types of objects they would like to process by calling setMetadataObjectTypes:. This property is key-value observable.
54        #[unsafe(method(availableMetadataObjectTypes))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn availableMetadataObjectTypes(
57            &self,
58        ) -> Retained<NSArray<AVMetadataObjectType>>;
59
60        #[cfg(feature = "AVMetadataObject")]
61        /// Specifies the types of metadata objects that the receiver should present to the client.
62        ///
63        ///
64        /// AVCaptureMetadataOutput may detect and emit multiple metadata object types. For apps linked before iOS 7.0, the receiver defaults to capturing face metadata objects if supported (see -availableMetadataObjectTypes). For apps linked on or after iOS 7.0, the receiver captures no metadata objects by default. -setMetadataObjectTypes: throws an NSInvalidArgumentException if any elements in the array are not present in the -availableMetadataObjectTypes array.
65        #[unsafe(method(metadataObjectTypes))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn metadataObjectTypes(&self) -> Retained<NSArray<AVMetadataObjectType>>;
68
69        #[cfg(feature = "AVMetadataObject")]
70        /// Setter for [`metadataObjectTypes`][Self::metadataObjectTypes].
71        #[unsafe(method(setMetadataObjectTypes:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn setMetadataObjectTypes(
74            &self,
75            metadata_object_types: Option<&NSArray<AVMetadataObjectType>>,
76        );
77
78        #[cfg(feature = "objc2-core-foundation")]
79        /// Specifies a rectangle of interest for limiting the search area for visual metadata.
80        ///
81        ///
82        /// The value of this property is a CGRect that determines the receiver's rectangle of interest for each frame of video. The rectangle's origin is top left and is relative to the coordinate space of the device providing the metadata. Specifying a rectOfInterest may improve detection performance for certain types of metadata. The default value of this property is the value CGRectMake(0, 0, 1, 1). Metadata objects whose bounds do not intersect with the rectOfInterest will not be returned.
83        ///
84        /// As of iOS 13, this property can be set without requiring a lengthy rebuild of the session in which video preview is disrupted.
85        #[unsafe(method(rectOfInterest))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn rectOfInterest(&self) -> CGRect;
88
89        #[cfg(feature = "objc2-core-foundation")]
90        /// Setter for [`rectOfInterest`][Self::rectOfInterest].
91        #[unsafe(method(setRectOfInterest:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setRectOfInterest(&self, rect_of_interest: CGRect);
94    );
95}
96
97extern_protocol!(
98    /// Defines an interface for delegates of AVCaptureMetadataOutput to receive emitted objects.
99    ///
100    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemetadataoutputobjectsdelegate?language=objc)
101    pub unsafe trait AVCaptureMetadataOutputObjectsDelegate: NSObjectProtocol {
102        #[cfg(all(
103            feature = "AVCaptureOutputBase",
104            feature = "AVCaptureSession",
105            feature = "AVMetadataObject"
106        ))]
107        /// Called whenever an AVCaptureMetadataOutput instance emits new objects through a connection.
108        ///
109        ///
110        /// Parameter `output`: The AVCaptureMetadataOutput instance that emitted the objects.
111        ///
112        /// Parameter `metadataObjects`: An array of AVMetadataObject subclasses (see AVMetadataObject.h).
113        ///
114        /// Parameter `connection`: The AVCaptureConnection through which the objects were emitted.
115        ///
116        ///
117        /// Delegates receive this message whenever the output captures and emits new objects, as specified by its metadataObjectTypes property. Delegates can use the provided objects in conjunction with other APIs for further processing. This method will be called on the dispatch queue specified by the output's metadataObjectsCallbackQueue property. This method may be called frequently, so it must be efficient to prevent capture performance problems, including dropped metadata objects.
118        ///
119        /// Clients that need to reference metadata objects outside of the scope of this method must retain them and then release them when they are finished with them.
120        #[optional]
121        #[unsafe(method(captureOutput:didOutputMetadataObjects:fromConnection:))]
122        #[unsafe(method_family = none)]
123        unsafe fn captureOutput_didOutputMetadataObjects_fromConnection(
124            &self,
125            output: &AVCaptureMetadataOutput,
126            metadata_objects: &NSArray<AVMetadataObject>,
127            connection: &AVCaptureConnection,
128        );
129    }
130);