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
56unsafe impl NSObjectProtocol for AVCaptionConversionValidator {}
57
58impl AVCaptionConversionValidator {
59    extern_methods!(
60        #[unsafe(method(init))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
63
64        #[unsafe(method(new))]
65        #[unsafe(method_family = new)]
66        pub unsafe fn new() -> Retained<Self>;
67
68        #[cfg(all(
69            feature = "AVCaption",
70            feature = "AVCaptionSettings",
71            feature = "objc2-core-media"
72        ))]
73        /// Returns an instance of AVCaptionConversionValidator that can validate an array of captions for a specific conversion operation and warn about problems that are encountered.
74        ///
75        /// Parameter `captions`: The array of captions to be validated.
76        ///
77        /// Parameter `timeRange`: The timeRange of the media timeline into which the specified captions must be integrated. See the timeRange property for further details.
78        ///
79        /// Parameter `conversionSettings`: Describes the conversion operation for which the captions are to be validated.
80        ///
81        /// Returns: A new instance of AVCaptionConversionValidator configured to perform the specified validation.
82        ///
83        /// 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.
84        #[unsafe(method(captionConversionValidatorWithCaptions:timeRange:conversionSettings:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn captionConversionValidatorWithCaptions_timeRange_conversionSettings(
87            captions: &NSArray<AVCaption>,
88            time_range: CMTimeRange,
89            conversion_settings: &NSDictionary<AVCaptionSettingsKey, AnyObject>,
90        ) -> Retained<Self>;
91
92        #[cfg(all(
93            feature = "AVCaption",
94            feature = "AVCaptionSettings",
95            feature = "objc2-core-media"
96        ))]
97        /// Returns an instance of AVCaptionConversionValidator that can validate an array of captions for a specific conversion operation and warn about problems that are encountered.
98        ///
99        /// Parameter `captions`: The array of captions for which the validation is requested.
100        ///
101        /// Parameter `timeRange`: The timeRange of the media timeline into which the specified captions must be integrated. See the timeRange property for further details.
102        ///
103        /// Parameter `conversionSettings`: Describes the conversion operation for which the captions are to be validated.
104        ///
105        /// Returns: A new instance of AVCaptionConversionValidator configured to perform the specified validation.
106        #[unsafe(method(initWithCaptions:timeRange:conversionSettings:))]
107        #[unsafe(method_family = init)]
108        pub unsafe fn initWithCaptions_timeRange_conversionSettings(
109            this: Allocated<Self>,
110            captions: &NSArray<AVCaption>,
111            time_range: CMTimeRange,
112            conversion_settings: &NSDictionary<AVCaptionSettingsKey, AnyObject>,
113        ) -> Retained<Self>;
114
115        /// Indicates the status of the validation.
116        #[unsafe(method(status))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn status(&self) -> AVCaptionConversionValidatorStatus;
119
120        #[cfg(feature = "AVCaption")]
121        /// The array of captions to be validated for the specified conversion operation.
122        #[unsafe(method(captions))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn captions(&self) -> Retained<NSArray<AVCaption>>;
125
126        #[cfg(feature = "objc2-core-media")]
127        /// The timeRange of the media timeline into which the specified captions must be integrated.
128        ///
129        /// 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.
130        #[unsafe(method(timeRange))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn timeRange(&self) -> CMTimeRange;
133
134        #[cfg(feature = "block2")]
135        /// Initiates the specified validation and changes the value of status to AVCaptionConversionValidatorStatusValidating.
136        ///
137        /// Parameter `handler`: Specifies a block to be executed in order to warn you of a specific problem.
138        ///
139        /// It is an error to invoke this method when the value of status is greater than AVCaptionConversionValidatorStatusUnknown.
140        /// If you wish to stop a validation operation in progress before it has been completed, send the message stopValidating to the receiver.
141        /// 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.
142        #[unsafe(method(validateCaptionConversionWithWarningHandler:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn validateCaptionConversionWithWarningHandler(
145            &self,
146            handler: &block2::Block<dyn Fn(*mut AVCaptionConversionWarning)>,
147        );
148
149        /// Stops validation and changes the value of status to AVCaptionConversionValidatorStatusStopped.
150        ///
151        /// You can call this method at any time, even within your warning handler.
152        #[unsafe(method(stopValidating))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn stopValidating(&self);
155
156        /// Provides the collection of warnings for problems that have been encountered. While the value of status is AVCaptionConversionValidatorStatusValidating, the count of warnings may increase.
157        #[unsafe(method(warnings))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn warnings(&self) -> Retained<NSArray<AVCaptionConversionWarning>>;
160    );
161}
162
163/// The type of a caption conversion warning.
164///
165/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionwarningtype?language=objc)
166// NS_TYPED_ENUM
167pub type AVCaptionConversionWarningType = NSString;
168
169extern "C" {
170    /// 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.
171    ///
172    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionwarningtypeexcessmediadata?language=objc)
173    pub static AVCaptionConversionWarningTypeExcessMediaData:
174        &'static AVCaptionConversionWarningType;
175}
176
177extern_class!(
178    /// Reports a specific problem encountered during the validation of a caption conversion.
179    ///
180    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
181    ///
182    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionwarning?language=objc)
183    #[unsafe(super(NSObject))]
184    #[derive(Debug, PartialEq, Eq, Hash)]
185    pub struct AVCaptionConversionWarning;
186);
187
188unsafe impl Send for AVCaptionConversionWarning {}
189
190unsafe impl Sync for AVCaptionConversionWarning {}
191
192unsafe impl NSObjectProtocol for AVCaptionConversionWarning {}
193
194impl AVCaptionConversionWarning {
195    extern_methods!(
196        #[unsafe(method(init))]
197        #[unsafe(method_family = init)]
198        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
199
200        #[unsafe(method(new))]
201        #[unsafe(method_family = new)]
202        pub unsafe fn new() -> Retained<Self>;
203
204        /// Indicates the type of warning provided by the receiver.
205        #[unsafe(method(warningType))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn warningType(&self) -> Retained<AVCaptionConversionWarningType>;
208
209        /// Indicates the range of captions in the validator's captions array for which the specified warning has been issued.
210        ///
211        /// 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.
212        #[unsafe(method(rangeOfCaptions))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn rangeOfCaptions(&self) -> NSRange;
215
216        /// Indicates an adjustment to the indicated captions that can be applied in order to correct the problem.
217        ///
218        /// 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.
219        #[unsafe(method(adjustment))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn adjustment(&self) -> Option<Retained<AVCaptionConversionAdjustment>>;
222    );
223}
224
225/// The type of a caption conversion adjustment.
226///
227/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionadjustmenttype?language=objc)
228// NS_TYPED_ENUM
229pub type AVCaptionConversionAdjustmentType = NSString;
230
231extern "C" {
232    /// Indicates a timing adjustment.
233    ///
234    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionadjustmenttypetimerange?language=objc)
235    pub static AVCaptionConversionAdjustmentTypeTimeRange:
236        &'static AVCaptionConversionAdjustmentType;
237}
238
239extern_class!(
240    /// Describes an adjustment that can be performed in order to correct a problem encountered during the validation of a caption conversion.
241    ///
242    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
243    ///
244    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversionadjustment?language=objc)
245    #[unsafe(super(NSObject))]
246    #[derive(Debug, PartialEq, Eq, Hash)]
247    pub struct AVCaptionConversionAdjustment;
248);
249
250unsafe impl Send for AVCaptionConversionAdjustment {}
251
252unsafe impl Sync for AVCaptionConversionAdjustment {}
253
254unsafe impl NSObjectProtocol for AVCaptionConversionAdjustment {}
255
256impl AVCaptionConversionAdjustment {
257    extern_methods!(
258        #[unsafe(method(init))]
259        #[unsafe(method_family = init)]
260        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
261
262        #[unsafe(method(new))]
263        #[unsafe(method_family = new)]
264        pub unsafe fn new() -> Retained<Self>;
265
266        /// Indicates the type of adjustment described by the receiver.
267        #[unsafe(method(adjustmentType))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn adjustmentType(&self) -> Retained<AVCaptionConversionAdjustmentType>;
270    );
271}
272
273extern_class!(
274    /// Describes an adjustment to the timeRange of one or more captions.
275    ///
276    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
277    ///
278    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionconversiontimerangeadjustment?language=objc)
279    #[unsafe(super(AVCaptionConversionAdjustment, NSObject))]
280    #[derive(Debug, PartialEq, Eq, Hash)]
281    pub struct AVCaptionConversionTimeRangeAdjustment;
282);
283
284unsafe impl Send for AVCaptionConversionTimeRangeAdjustment {}
285
286unsafe impl Sync for AVCaptionConversionTimeRangeAdjustment {}
287
288unsafe impl NSObjectProtocol for AVCaptionConversionTimeRangeAdjustment {}
289
290impl AVCaptionConversionTimeRangeAdjustment {
291    extern_methods!(
292        #[unsafe(method(init))]
293        #[unsafe(method_family = init)]
294        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
295
296        #[unsafe(method(new))]
297        #[unsafe(method_family = new)]
298        pub unsafe fn new() -> Retained<Self>;
299
300        #[cfg(feature = "objc2-core-media")]
301        /// Indicates the amount by which the timeRange.start of the captions must be adjusted in order to correct a problem.
302        ///
303        /// The value may any numeric value, positive, negative, or zero.
304        #[unsafe(method(startTimeOffset))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn startTimeOffset(&self) -> CMTime;
307
308        #[cfg(feature = "objc2-core-media")]
309        /// Indicates the amount by which the timeRange.duration of the captions must be adjusted in order to correct a problem.
310        ///
311        /// The value may any numeric value, positive, negative, or zero.
312        #[unsafe(method(durationOffset))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn durationOffset(&self) -> CMTime;
315    );
316}