objc2_cinematic/generated/
CNDetectionTrack.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-media")]
7use objc2_core_media::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// Abstract class representing a series of detections of the same subject over time.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/cinematic/cndetectiontrack?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct CNDetectionTrack;
19);
20
21extern_conformance!(
22    unsafe impl NSCopying for CNDetectionTrack {}
23);
24
25unsafe impl CopyingHelper for CNDetectionTrack {
26    type Result = Self;
27}
28
29extern_conformance!(
30    unsafe impl NSObjectProtocol for CNDetectionTrack {}
31);
32
33impl CNDetectionTrack {
34    extern_methods!(
35        #[cfg(feature = "CNDetection")]
36        /// The type of subject detected by this detection track.
37        #[unsafe(method(detectionType))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn detectionType(&self) -> CNDetectionType;
40
41        #[cfg(feature = "CNDetection")]
42        /// The detectionID of the subject detected during this track; unique within a cinematic script.
43        #[unsafe(method(detectionID))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn detectionID(&self) -> CNDetectionID;
46
47        #[cfg(feature = "CNDetection")]
48        /// The detectionGroupID of the subject detected by the track.
49        ///
50        /// The detectionGroupID can be used to associate related detections such as the face and torso of the same person.
51        #[unsafe(method(detectionGroupID))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn detectionGroupID(&self) -> CNDetectionGroupID;
54
55        /// Whether this detection track was created by the client.
56        #[unsafe(method(isUserCreated))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn isUserCreated(&self) -> bool;
59
60        /// Whether this detection track has discrete detections (otherwise continuous).
61        ///
62        /// A discrete detection track will return detections only at the specific times a detection occurs.
63        /// A continuous detection track will return a detection for any requested time and an empty array for time ranges.
64        #[unsafe(method(isDiscrete))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn isDiscrete(&self) -> bool;
67
68        #[cfg(all(feature = "CNDetection", feature = "objc2-core-media"))]
69        #[unsafe(method(detectionAtOrBeforeTime:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn detectionAtOrBeforeTime(&self, time: CMTime)
72            -> Option<Retained<CNDetection>>;
73
74        #[cfg(all(feature = "CNDetection", feature = "objc2-core-media"))]
75        #[unsafe(method(detectionNearestTime:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn detectionNearestTime(&self, time: CMTime) -> Option<Retained<CNDetection>>;
78
79        #[cfg(all(feature = "CNDetection", feature = "objc2-core-media"))]
80        /// Gets the array of detections in the detection track within the given time range. Makes sense for discrete detection tracks only.
81        #[unsafe(method(detectionsInTimeRange:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn detectionsInTimeRange(
84            &self,
85            time_range: CMTimeRange,
86        ) -> Retained<NSArray<CNDetection>>;
87
88        #[unsafe(method(init))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92        #[unsafe(method(new))]
93        #[unsafe(method_family = new)]
94        pub unsafe fn new() -> Retained<Self>;
95    );
96}
97
98extern_class!(
99    /// A continuous detection track representing focus at a fixed disparity.
100    ///
101    /// See also [Apple's documentation](https://developer.apple.com/documentation/cinematic/cnfixeddetectiontrack?language=objc)
102    #[unsafe(super(CNDetectionTrack, NSObject))]
103    #[derive(Debug, PartialEq, Eq, Hash)]
104    pub struct CNFixedDetectionTrack;
105);
106
107extern_conformance!(
108    unsafe impl NSCopying for CNFixedDetectionTrack {}
109);
110
111unsafe impl CopyingHelper for CNFixedDetectionTrack {
112    type Result = Self;
113}
114
115extern_conformance!(
116    unsafe impl NSObjectProtocol for CNFixedDetectionTrack {}
117);
118
119impl CNFixedDetectionTrack {
120    extern_methods!(
121        /// Create a detection track with fixed focus at the given disparity.
122        #[unsafe(method(initWithFocusDisparity:))]
123        #[unsafe(method_family = init)]
124        pub unsafe fn initWithFocusDisparity(
125            this: Allocated<Self>,
126            focus_disparity: c_float,
127        ) -> Retained<Self>;
128
129        #[cfg(feature = "CNDetection")]
130        /// Create a detection track with fixed focus at the disparity of an existing detection.
131        #[unsafe(method(initWithOriginalDetection:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithOriginalDetection(
134            this: Allocated<Self>,
135            original_detection: &CNDetection,
136        ) -> Retained<Self>;
137
138        #[unsafe(method(focusDisparity))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn focusDisparity(&self) -> c_float;
141
142        #[cfg(feature = "CNDetection")]
143        /// The original detection upon which this fixed detection track was based, if any.
144        ///
145        /// This is the way to determine the time and rect from which fixed focus originated, if any.
146        /// This detection is not part of the detection track and has a different detectionID or none.
147        ///
148        /// - Important: To get a detection from the fixed detection track, use detectionAtOrBeforeTime: instead, which will return a properly time-stamped detection.
149        #[unsafe(method(originalDetection))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn originalDetection(&self) -> Option<Retained<CNDetection>>;
152    );
153}
154
155/// Methods declared on superclass `CNDetectionTrack`.
156impl CNFixedDetectionTrack {
157    extern_methods!(
158        #[unsafe(method(init))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
161
162        #[unsafe(method(new))]
163        #[unsafe(method_family = new)]
164        pub unsafe fn new() -> Retained<Self>;
165    );
166}
167
168extern_class!(
169    /// A discrete detection track composed of individual detections.
170    ///
171    /// See also [Apple's documentation](https://developer.apple.com/documentation/cinematic/cncustomdetectiontrack?language=objc)
172    #[unsafe(super(CNDetectionTrack, NSObject))]
173    #[derive(Debug, PartialEq, Eq, Hash)]
174    pub struct CNCustomDetectionTrack;
175);
176
177extern_conformance!(
178    unsafe impl NSCopying for CNCustomDetectionTrack {}
179);
180
181unsafe impl CopyingHelper for CNCustomDetectionTrack {
182    type Result = Self;
183}
184
185extern_conformance!(
186    unsafe impl NSObjectProtocol for CNCustomDetectionTrack {}
187);
188
189impl CNCustomDetectionTrack {
190    extern_methods!(
191        #[cfg(feature = "CNDetection")]
192        /// Initialize a custom detection track with an array of detections, optionally applying smoothing.
193        ///
194        /// The smoothing algorithm used is the same one that is used for built-in detections during recording.
195        /// It compensates for some amount of jitter in the disparity measure by smoothing out variability.
196        #[unsafe(method(initWithDetections:smooth:))]
197        #[unsafe(method_family = init)]
198        pub unsafe fn initWithDetections_smooth(
199            this: Allocated<Self>,
200            detections: &NSArray<CNDetection>,
201            apply_smoothing: bool,
202        ) -> Retained<Self>;
203
204        #[cfg(feature = "CNDetection")]
205        #[unsafe(method(allDetections))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn allDetections(&self) -> Retained<NSArray<CNDetection>>;
208    );
209}
210
211/// Methods declared on superclass `CNDetectionTrack`.
212impl CNCustomDetectionTrack {
213    extern_methods!(
214        #[unsafe(method(init))]
215        #[unsafe(method_family = init)]
216        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
217
218        #[unsafe(method(new))]
219        #[unsafe(method_family = new)]
220        pub unsafe fn new() -> Retained<Self>;
221    );
222}