objc2_av_foundation/generated/AVCaptionConversionValidator.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
12/// These constants are returned by the AVCaptionConversionValidator status property to indicate the progress of a validation operation.
13///
14///
15/// Indicates that the validation operation has not yet been initiated.
16///
17/// Indicates that the validation operation is currently in progress.
18///
19/// Indicates that the validation operation has been completed.
20///
21/// Indicates that the validation operation was stopped prior to completion.
22///
23/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionvalidatorstatus?language=objc)
24// NS_ENUM
25#[repr(transparent)]
26#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
27pub struct AVCaptionConversionValidatorStatus(pub NSInteger);
28impl AVCaptionConversionValidatorStatus {
29 #[doc(alias = "AVCaptionConversionValidatorStatusUnknown")]
30 pub const Unknown: Self = Self(0);
31 #[doc(alias = "AVCaptionConversionValidatorStatusValidating")]
32 pub const Validating: Self = Self(1);
33 #[doc(alias = "AVCaptionConversionValidatorStatusCompleted")]
34 pub const Completed: Self = Self(2);
35 #[doc(alias = "AVCaptionConversionValidatorStatusStopped")]
36 pub const Stopped: Self = Self(3);
37}
38
39unsafe impl Encode for AVCaptionConversionValidatorStatus {
40 const ENCODING: Encoding = NSInteger::ENCODING;
41}
42
43unsafe impl RefEncode for AVCaptionConversionValidatorStatus {
44 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47extern_class!(
48 /// Performs a validation of captions for a conversion operation and warns about problems that are encountered.
49 ///
50 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionvalidator?language=objc)
51 #[unsafe(super(NSObject))]
52 #[derive(Debug, PartialEq, Eq, Hash)]
53 pub struct AVCaptionConversionValidator;
54);
55
56extern_conformance!(
57 unsafe impl NSObjectProtocol for AVCaptionConversionValidator {}
58);
59
60impl AVCaptionConversionValidator {
61 extern_methods!(
62 #[unsafe(method(init))]
63 #[unsafe(method_family = init)]
64 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
65
66 #[unsafe(method(new))]
67 #[unsafe(method_family = new)]
68 pub unsafe fn new() -> Retained<Self>;
69
70 #[cfg(all(
71 feature = "AVCaption",
72 feature = "AVCaptionSettings",
73 feature = "objc2-core-media"
74 ))]
75 /// Returns an instance of AVCaptionConversionValidator that can validate an array of captions for a specific conversion operation and warn about problems that are encountered.
76 ///
77 /// Parameter `captions`: The array of captions to be validated.
78 ///
79 /// Parameter `timeRange`: The timeRange of the media timeline into which the specified captions must be integrated. See the timeRange property for further details.
80 ///
81 /// Parameter `conversionSettings`: Describes the conversion operation for which the captions are to be validated.
82 ///
83 /// Returns: A new instance of AVCaptionConversionValidator configured to perform the specified validation.
84 ///
85 /// This method throws an exception if the conversion setting's AVCaptionMediaTypeKey is not equal to AVMediaTypeClosedCaption, or if its AVCaptionMediaSubTypeKey is not equal to kCMClosedCaptionFormatType_CEA608.
86 ///
87 /// # Safety
88 ///
89 /// `conversion_settings` generic should be of the correct type.
90 #[unsafe(method(captionConversionValidatorWithCaptions:timeRange:conversionSettings:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn captionConversionValidatorWithCaptions_timeRange_conversionSettings(
93 captions: &NSArray<AVCaption>,
94 time_range: CMTimeRange,
95 conversion_settings: &NSDictionary<AVCaptionSettingsKey, AnyObject>,
96 ) -> Retained<Self>;
97
98 #[cfg(all(
99 feature = "AVCaption",
100 feature = "AVCaptionSettings",
101 feature = "objc2-core-media"
102 ))]
103 /// Returns an instance of AVCaptionConversionValidator that can validate an array of captions for a specific conversion operation and warn about problems that are encountered.
104 ///
105 /// Parameter `captions`: The array of captions for which the validation is requested.
106 ///
107 /// Parameter `timeRange`: The timeRange of the media timeline into which the specified captions must be integrated. See the timeRange property for further details.
108 ///
109 /// Parameter `conversionSettings`: Describes the conversion operation for which the captions are to be validated.
110 ///
111 /// Returns: A new instance of AVCaptionConversionValidator configured to perform the specified validation.
112 ///
113 /// # Safety
114 ///
115 /// `conversion_settings` generic should be of the correct type.
116 #[unsafe(method(initWithCaptions:timeRange:conversionSettings:))]
117 #[unsafe(method_family = init)]
118 pub unsafe fn initWithCaptions_timeRange_conversionSettings(
119 this: Allocated<Self>,
120 captions: &NSArray<AVCaption>,
121 time_range: CMTimeRange,
122 conversion_settings: &NSDictionary<AVCaptionSettingsKey, AnyObject>,
123 ) -> Retained<Self>;
124
125 /// Indicates the status of the validation.
126 #[unsafe(method(status))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn status(&self) -> AVCaptionConversionValidatorStatus;
129
130 #[cfg(feature = "AVCaption")]
131 /// The array of captions to be validated for the specified conversion operation.
132 #[unsafe(method(captions))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn captions(&self) -> Retained<NSArray<AVCaption>>;
135
136 #[cfg(feature = "objc2-core-media")]
137 /// The timeRange of the media timeline into which the specified captions must be integrated.
138 ///
139 /// The start of this timeRange may be less than the start of the timeRange of the initial caption in the captions array, if the captions are to appear only after the start of accompanying video or audio. If no definite duration for the media timeline is known, the timeRange can have a duration of kCMTimePositiveInfinity. However, in order to perform a comprehensive validation of a conversion to closed captions, setting the duration of the timeRange to the duration of accompanying video media is recommended.
140 #[unsafe(method(timeRange))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn timeRange(&self) -> CMTimeRange;
143
144 #[cfg(feature = "block2")]
145 /// Initiates the specified validation and changes the value of status to AVCaptionConversionValidatorStatusValidating.
146 ///
147 /// Parameter `handler`: Specifies a block to be executed in order to warn you of a specific problem.
148 ///
149 /// It is an error to invoke this method when the value of status is greater than AVCaptionConversionValidatorStatusUnknown.
150 /// If you wish to stop a validation operation in progress before it has been completed, send the message stopValidating to the receiver.
151 /// When the validation is complete and all warnings have been reported, the block will be executed once with a value of nil for its warning parameter. When this occurs, the value of status will have been changed to AVCaptionConversionValidatorStatusCompleted.
152 ///
153 /// # Safety
154 ///
155 /// `handler` block must be sendable.
156 #[unsafe(method(validateCaptionConversionWithWarningHandler:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn validateCaptionConversionWithWarningHandler(
159 &self,
160 handler: &block2::DynBlock<dyn Fn(*mut AVCaptionConversionWarning)>,
161 );
162
163 /// Stops validation and changes the value of status to AVCaptionConversionValidatorStatusStopped.
164 ///
165 /// You can call this method at any time, even within your warning handler.
166 #[unsafe(method(stopValidating))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn stopValidating(&self);
169
170 /// Provides the collection of warnings for problems that have been encountered. While the value of status is AVCaptionConversionValidatorStatusValidating, the count of warnings may increase.
171 #[unsafe(method(warnings))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn warnings(&self) -> Retained<NSArray<AVCaptionConversionWarning>>;
174 );
175}
176
177/// The type of a caption conversion warning.
178///
179/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionwarningtype?language=objc)
180// NS_TYPED_ENUM
181pub type AVCaptionConversionWarningType = NSString;
182
183extern "C" {
184 /// Indicates that one or more captions in the validator's captions array exceed the capacity for media data of the media type and subtype specified by the conversion settings.
185 ///
186 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionwarningtypeexcessmediadata?language=objc)
187 pub static AVCaptionConversionWarningTypeExcessMediaData:
188 &'static AVCaptionConversionWarningType;
189}
190
191extern_class!(
192 /// Reports a specific problem encountered during the validation of a caption conversion.
193 ///
194 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
195 ///
196 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionwarning?language=objc)
197 #[unsafe(super(NSObject))]
198 #[derive(Debug, PartialEq, Eq, Hash)]
199 pub struct AVCaptionConversionWarning;
200);
201
202unsafe impl Send for AVCaptionConversionWarning {}
203
204unsafe impl Sync for AVCaptionConversionWarning {}
205
206extern_conformance!(
207 unsafe impl NSObjectProtocol for AVCaptionConversionWarning {}
208);
209
210impl AVCaptionConversionWarning {
211 extern_methods!(
212 #[unsafe(method(init))]
213 #[unsafe(method_family = init)]
214 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
215
216 #[unsafe(method(new))]
217 #[unsafe(method_family = new)]
218 pub unsafe fn new() -> Retained<Self>;
219
220 /// Indicates the type of warning provided by the receiver.
221 #[unsafe(method(warningType))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn warningType(&self) -> Retained<AVCaptionConversionWarningType>;
224
225 /// Indicates the range of captions in the validator's captions array for which the specified warning has been issued.
226 ///
227 /// Only captions with the same start time and duration will be referenced. If captions with different start times and durations exhibit similar problems, a separate instance of AVCaptionConversionWarning will be used to indicate each problematic case. If the referenced captions have multiple problems, a separate instance of AVCaptionConversionWarning will be issued to indicate each problem.
228 #[unsafe(method(rangeOfCaptions))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn rangeOfCaptions(&self) -> NSRange;
231
232 /// Indicates an adjustment to the indicated captions that can be applied in order to correct the problem.
233 ///
234 /// If the value of adjustment is not nil and the conversion operation is performed without correcting the problem, the adjustment will be applied during conversion. If the value of adjustment is nil and the conversion operation is performed without correcting the problem, the indicated captions will be omitted from the output media data.
235 #[unsafe(method(adjustment))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn adjustment(&self) -> Option<Retained<AVCaptionConversionAdjustment>>;
238 );
239}
240
241/// The type of a caption conversion adjustment.
242///
243/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionadjustmenttype?language=objc)
244// NS_TYPED_ENUM
245pub type AVCaptionConversionAdjustmentType = NSString;
246
247extern "C" {
248 /// Indicates a timing adjustment.
249 ///
250 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionadjustmenttypetimerange?language=objc)
251 pub static AVCaptionConversionAdjustmentTypeTimeRange:
252 &'static AVCaptionConversionAdjustmentType;
253}
254
255extern_class!(
256 /// Describes an adjustment that can be performed in order to correct a problem encountered during the validation of a caption conversion.
257 ///
258 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
259 ///
260 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionadjustment?language=objc)
261 #[unsafe(super(NSObject))]
262 #[derive(Debug, PartialEq, Eq, Hash)]
263 pub struct AVCaptionConversionAdjustment;
264);
265
266unsafe impl Send for AVCaptionConversionAdjustment {}
267
268unsafe impl Sync for AVCaptionConversionAdjustment {}
269
270extern_conformance!(
271 unsafe impl NSObjectProtocol for AVCaptionConversionAdjustment {}
272);
273
274impl AVCaptionConversionAdjustment {
275 extern_methods!(
276 #[unsafe(method(init))]
277 #[unsafe(method_family = init)]
278 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
279
280 #[unsafe(method(new))]
281 #[unsafe(method_family = new)]
282 pub unsafe fn new() -> Retained<Self>;
283
284 /// Indicates the type of adjustment described by the receiver.
285 #[unsafe(method(adjustmentType))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn adjustmentType(&self) -> Retained<AVCaptionConversionAdjustmentType>;
288 );
289}
290
291extern_class!(
292 /// Describes an adjustment to the timeRange of one or more captions.
293 ///
294 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
295 ///
296 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversiontimerangeadjustment?language=objc)
297 #[unsafe(super(AVCaptionConversionAdjustment, NSObject))]
298 #[derive(Debug, PartialEq, Eq, Hash)]
299 pub struct AVCaptionConversionTimeRangeAdjustment;
300);
301
302unsafe impl Send for AVCaptionConversionTimeRangeAdjustment {}
303
304unsafe impl Sync for AVCaptionConversionTimeRangeAdjustment {}
305
306extern_conformance!(
307 unsafe impl NSObjectProtocol for AVCaptionConversionTimeRangeAdjustment {}
308);
309
310impl AVCaptionConversionTimeRangeAdjustment {
311 extern_methods!(
312 #[unsafe(method(init))]
313 #[unsafe(method_family = init)]
314 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
315
316 #[unsafe(method(new))]
317 #[unsafe(method_family = new)]
318 pub unsafe fn new() -> Retained<Self>;
319
320 #[cfg(feature = "objc2-core-media")]
321 /// Indicates the amount by which the timeRange.start of the captions must be adjusted in order to correct a problem.
322 ///
323 /// The value may any numeric value, positive, negative, or zero.
324 #[unsafe(method(startTimeOffset))]
325 #[unsafe(method_family = none)]
326 pub unsafe fn startTimeOffset(&self) -> CMTime;
327
328 #[cfg(feature = "objc2-core-media")]
329 /// Indicates the amount by which the timeRange.duration of the captions must be adjusted in order to correct a problem.
330 ///
331 /// The value may any numeric value, positive, negative, or zero.
332 #[unsafe(method(durationOffset))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn durationOffset(&self) -> CMTime;
335 );
336}