objc2_av_foundation/generated/
AVCaption.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::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10#[cfg(feature = "objc2-core-media")]
11use objc2_core_media::*;
12use objc2_foundation::*;
13
14use crate::*;
15
16/// Geometry unit.
17///
18/// Some geometric objects are positioned or sized with different kinds of dimensions differeing in unit. In some cases, an object might allow multiple kinds of dimensions varrying by units. AVCaptionUnitsType is an enumeration of kinds of units that are used across caption formats.
19///
20/// The units has not been specified. The dimension can be seen as invalid.
21///
22/// The integer value is a number of cells.
23///
24/// The floating-point value number value is [0 .. 100] correspondng to 0% to 100%, typically relative to the enclosing rectangle.
25///
26/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionunitstype?language=objc)
27// NS_ENUM
28#[repr(transparent)]
29#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
30pub struct AVCaptionUnitsType(pub NSInteger);
31impl AVCaptionUnitsType {
32    #[doc(alias = "AVCaptionUnitsTypeUnspecified")]
33    pub const Unspecified: Self = Self(0);
34    #[doc(alias = "AVCaptionUnitsTypeCells")]
35    pub const Cells: Self = Self(1);
36    #[doc(alias = "AVCaptionUnitsTypePercent")]
37    pub const Percent: Self = Self(2);
38}
39
40unsafe impl Encode for AVCaptionUnitsType {
41    const ENCODING: Encoding = NSInteger::ENCODING;
42}
43
44unsafe impl RefEncode for AVCaptionUnitsType {
45    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
46}
47
48/// The length with a unit or coordinate on a 2D geometric axis
49/// Field: value The value of the coordinate or length.
50/// Field: units The units of the coordinate (e.g., cells, points)
51///
52/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptiondimension?language=objc)
53#[cfg(feature = "objc2-core-foundation")]
54#[repr(C)]
55#[derive(Clone, Copy, Debug, PartialEq)]
56pub struct AVCaptionDimension {
57    pub value: CGFloat,
58    pub units: AVCaptionUnitsType,
59}
60
61#[cfg(feature = "objc2-core-foundation")]
62unsafe impl Encode for AVCaptionDimension {
63    const ENCODING: Encoding = Encoding::Struct(
64        "AVCaptionDimension",
65        &[<CGFloat>::ENCODING, <AVCaptionUnitsType>::ENCODING],
66    );
67}
68
69#[cfg(feature = "objc2-core-foundation")]
70unsafe impl RefEncode for AVCaptionDimension {
71    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74/// A two dimensional point made of x and y AVCaptionDimension coordinates
75/// Field: x An AVCaptionDimension holding the x coordinate of the point
76/// Field: y An AVCaptionDimension holding the y coordinate of the point
77///
78/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionpoint?language=objc)
79#[cfg(feature = "objc2-core-foundation")]
80#[repr(C)]
81#[derive(Clone, Copy, Debug, PartialEq)]
82pub struct AVCaptionPoint {
83    pub x: AVCaptionDimension,
84    pub y: AVCaptionDimension,
85}
86
87#[cfg(feature = "objc2-core-foundation")]
88unsafe impl Encode for AVCaptionPoint {
89    const ENCODING: Encoding = Encoding::Struct(
90        "AVCaptionPoint",
91        &[
92            <AVCaptionDimension>::ENCODING,
93            <AVCaptionDimension>::ENCODING,
94        ],
95    );
96}
97
98#[cfg(feature = "objc2-core-foundation")]
99unsafe impl RefEncode for AVCaptionPoint {
100    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
101}
102
103/// A two dimensional size made of width and height AVCaptionDimensions
104/// Field: width An AVCaptionDimension holding the width
105/// Field: height An AVCaptionDimension holding the height
106///
107/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionsize?language=objc)
108#[cfg(feature = "objc2-core-foundation")]
109#[repr(C)]
110#[derive(Clone, Copy, Debug, PartialEq)]
111pub struct AVCaptionSize {
112    pub width: AVCaptionDimension,
113    pub height: AVCaptionDimension,
114}
115
116#[cfg(feature = "objc2-core-foundation")]
117unsafe impl Encode for AVCaptionSize {
118    const ENCODING: Encoding = Encoding::Struct(
119        "AVCaptionSize",
120        &[
121            <AVCaptionDimension>::ENCODING,
122            <AVCaptionDimension>::ENCODING,
123        ],
124    );
125}
126
127#[cfg(feature = "objc2-core-foundation")]
128unsafe impl RefEncode for AVCaptionSize {
129    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
130}
131
132extern "C-unwind" {
133    /// Makes an AVCaptionDimension from a value and units.
134    #[cfg(feature = "objc2-core-foundation")]
135    pub fn AVCaptionDimensionMake(value: CGFloat, units: AVCaptionUnitsType) -> AVCaptionDimension;
136}
137
138extern "C-unwind" {
139    /// Makes an AVCaptionPoint from x and y coordinate AVCaptionDimensions.
140    #[cfg(feature = "objc2-core-foundation")]
141    pub fn AVCaptionPointMake(x: AVCaptionDimension, y: AVCaptionDimension) -> AVCaptionPoint;
142}
143
144extern "C-unwind" {
145    /// Makes an AVCaptionSize from width and height AVCaptionDimensions.
146    #[cfg(feature = "objc2-core-foundation")]
147    pub fn AVCaptionSizeMake(
148        width: AVCaptionDimension,
149        height: AVCaptionDimension,
150    ) -> AVCaptionSize;
151}
152
153/// Choices for region display alignment
154///
155///
156/// Whenever a caption line is inserted into a region, it's placed relative to the existing lines and the direction to which the line is placed is called the block progression direction of the region. For example, English caption's block progression direction is top-to-bottom, while Japanese vertical caption uses right-to-left.
157///
158/// The value describes how the caption lines should positioned in a region in terms of the block progression direction.
159///
160///
161/// Align lines in earlier position in the block progression direction, or align to the top for English captions, for example.
162///
163///
164/// Align lines in center position in the block progression direction. iTT doesn't support this.
165///
166///
167/// Align lines in later position in the block progression direction, or align to the left for Japanese vertical captions, for example.
168///
169/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionregiondisplayalignment?language=objc)
170// NS_ENUM
171#[repr(transparent)]
172#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
173pub struct AVCaptionRegionDisplayAlignment(pub NSInteger);
174impl AVCaptionRegionDisplayAlignment {
175    #[doc(alias = "AVCaptionRegionDisplayAlignmentBefore")]
176    pub const Before: Self = Self(0);
177    #[doc(alias = "AVCaptionRegionDisplayAlignmentCenter")]
178    pub const Center: Self = Self(1);
179    #[doc(alias = "AVCaptionRegionDisplayAlignmentAfter")]
180    pub const After: Self = Self(2);
181}
182
183unsafe impl Encode for AVCaptionRegionDisplayAlignment {
184    const ENCODING: Encoding = NSInteger::ENCODING;
185}
186
187unsafe impl RefEncode for AVCaptionRegionDisplayAlignment {
188    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
189}
190
191/// Choices for region writing mode
192///
193/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionregionwritingmode?language=objc)
194// NS_ENUM
195#[repr(transparent)]
196#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
197pub struct AVCaptionRegionWritingMode(pub NSInteger);
198impl AVCaptionRegionWritingMode {
199    #[doc(alias = "AVCaptionRegionWritingModeLeftToRightAndTopToBottom")]
200    pub const LeftToRightAndTopToBottom: Self = Self(0);
201    #[doc(alias = "AVCaptionRegionWritingModeTopToBottomAndRightToLeft")]
202    pub const TopToBottomAndRightToLeft: Self = Self(2);
203}
204
205unsafe impl Encode for AVCaptionRegionWritingMode {
206    const ENCODING: Encoding = NSInteger::ENCODING;
207}
208
209unsafe impl RefEncode for AVCaptionRegionWritingMode {
210    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
211}
212
213/// Scrolling effect for a region
214///
215/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionregionscroll?language=objc)
216// NS_ENUM
217#[repr(transparent)]
218#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
219pub struct AVCaptionRegionScroll(pub NSInteger);
220impl AVCaptionRegionScroll {
221    #[doc(alias = "AVCaptionRegionScrollNone")]
222    pub const None: Self = Self(0);
223    #[doc(alias = "AVCaptionRegionScrollRollUp")]
224    pub const RollUp: Self = Self(1);
225}
226
227unsafe impl Encode for AVCaptionRegionScroll {
228    const ENCODING: Encoding = NSInteger::ENCODING;
229}
230
231unsafe impl RefEncode for AVCaptionRegionScroll {
232    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
233}
234
235extern_class!(
236    /// An instance of AVCaptionRegion represents a region where a caption is placed.
237    ///
238    /// Currently, there is just four predefined region instances. The interface doesn't support configuration of region settings.
239    ///
240    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionregion?language=objc)
241    #[unsafe(super(NSObject))]
242    #[derive(Debug, PartialEq, Eq, Hash)]
243    pub struct AVCaptionRegion;
244);
245
246unsafe impl NSCoding for AVCaptionRegion {}
247
248unsafe impl NSCopying for AVCaptionRegion {}
249
250unsafe impl CopyingHelper for AVCaptionRegion {
251    type Result = Self;
252}
253
254unsafe impl NSMutableCopying for AVCaptionRegion {}
255
256unsafe impl MutableCopyingHelper for AVCaptionRegion {
257    type Result = AVMutableCaptionRegion;
258}
259
260unsafe impl NSObjectProtocol for AVCaptionRegion {}
261
262unsafe impl NSSecureCoding for AVCaptionRegion {}
263
264impl AVCaptionRegion {
265    extern_methods!(
266        /// The top region for iTT format
267        ///
268        /// This region can be used in iTT format and it occupies the top 15% of the display area. The region uses LRTB, a line progresses left to right and the block extends from top to bottom. Each line is stacked with top justified.
269        #[unsafe(method(appleITTTopRegion))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn appleITTTopRegion() -> Retained<AVCaptionRegion>;
272
273        /// The bottom region for iTT format
274        ///
275        /// This region can be used in iTT format and it occupies the bottom 15% of the display area. The region uses LRTB, a line progresses left to right and the block extends from top to bottom. Each line is stacked with bottom justified.
276        #[unsafe(method(appleITTBottomRegion))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn appleITTBottomRegion() -> Retained<AVCaptionRegion>;
279
280        /// The  left region for iTT format
281        ///
282        /// This region can be used in iTT format and it occupies the left 15% of the display area. The region uses TBRL, a line progresses top to bottom and the block extends from right to left. Each line is stacked with right justified.
283        #[unsafe(method(appleITTLeftRegion))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn appleITTLeftRegion() -> Retained<AVCaptionRegion>;
286
287        /// The right region for iTT format
288        ///
289        /// This region can be used in iTT format and it occupies the right 15% of the display area. The region uses TBRL, a line progresses top to bottom and the block extends from right to left. Each line is stacked with right justified.
290        #[unsafe(method(appleITTRightRegion))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn appleITTRightRegion() -> Retained<AVCaptionRegion>;
293
294        /// The bottom region for SubRip Text (SRT) format
295        ///
296        /// This region can be used in SRT format and it occupies the entire video display area. The region uses LRTB, a line progresses left to right and the block extends from top to bottom. Each line is stacked with bottom justified.
297        #[unsafe(method(subRipTextBottomRegion))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn subRipTextBottomRegion() -> Retained<AVCaptionRegion>;
300
301        /// Identifier for the region
302        ///
303        /// When regionIdentifier is nil, two regions with the same position and endPosition are considered to be same, that is
304        /// captions referring these regions belong to the same region when serialized to a format like TTML.  In addition, the
305        /// AVCaptionRegion cannot be mutably copied.
306        ///
307        /// When regionIdentifier is not nil, two regions are same if and only if the region identifier is equal. It is a
308        /// client's responsibility to ensure these AVCaptionRegion objects have the same properties.
309        #[unsafe(method(identifier))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
312
313        #[cfg(feature = "objc2-core-foundation")]
314        /// The position of the top-left of the region, potentially with unspecified fields.
315        ///
316        /// It returns an AVCaptionPoint potentially with unspecified x and/or y fields. Unspecified dimensions indicate the region doesn't have positioning information for that dimension.
317        #[unsafe(method(origin))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn origin(&self) -> AVCaptionPoint;
320
321        #[cfg(feature = "objc2-core-foundation")]
322        /// The width and height of the region, potentally with unspecified fields.
323        ///
324        /// It returns an AVCaptionSize potentially with unspecified width and/or height.
325        /// CEA608 closed captions support limits the size.height property’s value to 1 cell except when the AVCaptionRegionScroll is AVCaptionRegionScrollRollUp.
326        /// If the AVCaptionRegionScroll is AVCaptionRegionScrollRollUp, the size.height property’s value must be 2, 3 or 4 cells.
327        /// It returns an AVCaptionSize with unspecifed width and height when the region doesn't have width or height information.
328        #[unsafe(method(size))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn size(&self) -> AVCaptionSize;
331
332        /// Scroll mode for the region
333        ///
334        /// See AVCaptionRegionScrollXXX enum for possible values.
335        #[unsafe(method(scroll))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn scroll(&self) -> AVCaptionRegionScroll;
338
339        /// Alignment of lines for the region
340        #[unsafe(method(displayAlignment))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn displayAlignment(&self) -> AVCaptionRegionDisplayAlignment;
343
344        /// The block and inline progression direction of the region.
345        #[unsafe(method(writingMode))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn writingMode(&self) -> AVCaptionRegionWritingMode;
348
349        /// NSCoding protocol method override
350        ///
351        /// This method throws an exception if the caption region's size has different units for width and height, or if the units are unrecognizeable.
352        #[unsafe(method(encodeWithCoder:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn encodeWithCoder(&self, encoder: &NSCoder);
355
356        /// NSObject protocol method override
357        ///
358        /// This method throws an exception if the caption region's size has different units for width and height, or if the units are unrecognizeable.
359        #[unsafe(method(isEqual:))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn isEqual(&self, object: &AnyObject) -> bool;
362
363        /// NSMutableCopying protocol method override
364        ///
365        /// This method throws an exception if the caption region contains an identifier.
366        #[unsafe(method(mutableCopyWithZone:))]
367        #[unsafe(method_family = mutableCopy)]
368        pub unsafe fn mutableCopyWithZone(&self, zone: *mut NSZone) -> Retained<AnyObject>;
369    );
370}
371
372/// Methods declared on superclass `NSObject`.
373impl AVCaptionRegion {
374    extern_methods!(
375        #[unsafe(method(init))]
376        #[unsafe(method_family = init)]
377        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
378
379        #[unsafe(method(new))]
380        #[unsafe(method_family = new)]
381        pub unsafe fn new() -> Retained<Self>;
382    );
383}
384
385extern_class!(
386    /// Mutable subclass of AVCaptionRegion.
387    ///
388    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutablecaptionregion?language=objc)
389    #[unsafe(super(AVCaptionRegion, NSObject))]
390    #[derive(Debug, PartialEq, Eq, Hash)]
391    pub struct AVMutableCaptionRegion;
392);
393
394unsafe impl NSCoding for AVMutableCaptionRegion {}
395
396unsafe impl NSCopying for AVMutableCaptionRegion {}
397
398unsafe impl CopyingHelper for AVMutableCaptionRegion {
399    type Result = AVCaptionRegion;
400}
401
402unsafe impl NSMutableCopying for AVMutableCaptionRegion {}
403
404unsafe impl MutableCopyingHelper for AVMutableCaptionRegion {
405    type Result = Self;
406}
407
408unsafe impl NSObjectProtocol for AVMutableCaptionRegion {}
409
410unsafe impl NSSecureCoding for AVMutableCaptionRegion {}
411
412impl AVMutableCaptionRegion {
413    extern_methods!(
414        /// Create a region object without any properties.
415        #[unsafe(method(init))]
416        #[unsafe(method_family = init)]
417        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
418
419        /// Create a region object with the identifier.
420        #[unsafe(method(initWithIdentifier:))]
421        #[unsafe(method_family = init)]
422        pub unsafe fn initWithIdentifier(
423            this: Allocated<Self>,
424            identifier: &NSString,
425        ) -> Retained<Self>;
426
427        #[cfg(feature = "objc2-core-foundation")]
428        /// The position of the top-left of the region.
429        #[unsafe(method(origin))]
430        #[unsafe(method_family = none)]
431        pub unsafe fn origin(&self) -> AVCaptionPoint;
432
433        #[cfg(feature = "objc2-core-foundation")]
434        /// Setter for [`origin`][Self::origin].
435        #[unsafe(method(setOrigin:))]
436        #[unsafe(method_family = none)]
437        pub unsafe fn setOrigin(&self, origin: AVCaptionPoint);
438
439        #[cfg(feature = "objc2-core-foundation")]
440        /// The width and height of the region, potentally with unspecified fields.
441        #[unsafe(method(size))]
442        #[unsafe(method_family = none)]
443        pub unsafe fn size(&self) -> AVCaptionSize;
444
445        #[cfg(feature = "objc2-core-foundation")]
446        /// Setter for [`size`][Self::size].
447        #[unsafe(method(setSize:))]
448        #[unsafe(method_family = none)]
449        pub unsafe fn setSize(&self, size: AVCaptionSize);
450
451        /// Region scroll mode.
452        #[unsafe(method(scroll))]
453        #[unsafe(method_family = none)]
454        pub unsafe fn scroll(&self) -> AVCaptionRegionScroll;
455
456        /// Setter for [`scroll`][Self::scroll].
457        #[unsafe(method(setScroll:))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn setScroll(&self, scroll: AVCaptionRegionScroll);
460
461        /// Alignment of lines in the region.
462        #[unsafe(method(displayAlignment))]
463        #[unsafe(method_family = none)]
464        pub unsafe fn displayAlignment(&self) -> AVCaptionRegionDisplayAlignment;
465
466        /// Setter for [`displayAlignment`][Self::displayAlignment].
467        #[unsafe(method(setDisplayAlignment:))]
468        #[unsafe(method_family = none)]
469        pub unsafe fn setDisplayAlignment(
470            &self,
471            display_alignment: AVCaptionRegionDisplayAlignment,
472        );
473
474        /// The block and inline progression direction of the region.
475        #[unsafe(method(writingMode))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn writingMode(&self) -> AVCaptionRegionWritingMode;
478
479        /// Setter for [`writingMode`][Self::writingMode].
480        #[unsafe(method(setWritingMode:))]
481        #[unsafe(method_family = none)]
482        pub unsafe fn setWritingMode(&self, writing_mode: AVCaptionRegionWritingMode);
483    );
484}
485
486/// Methods declared on superclass `NSObject`.
487impl AVMutableCaptionRegion {
488    extern_methods!(
489        #[unsafe(method(new))]
490        #[unsafe(method_family = new)]
491        pub unsafe fn new() -> Retained<Self>;
492    );
493}
494
495/// Animation effect for a caption
496///
497/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionanimation?language=objc)
498// NS_ENUM
499#[repr(transparent)]
500#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
501pub struct AVCaptionAnimation(pub NSInteger);
502impl AVCaptionAnimation {
503    #[doc(alias = "AVCaptionAnimationNone")]
504    pub const None: Self = Self(0);
505    #[doc(alias = "AVCaptionAnimationCharacterReveal")]
506    pub const CharacterReveal: Self = Self(1);
507}
508
509unsafe impl Encode for AVCaptionAnimation {
510    const ENCODING: Encoding = NSInteger::ENCODING;
511}
512
513unsafe impl RefEncode for AVCaptionAnimation {
514    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
515}
516
517extern_class!(
518    /// An instance of AVCaption represents a unit of text that is active at a particular time range.
519    ///
520    /// A caption contains one meaningful sentence, paragraph, or otherwise known as a caption cue. Within the active time range, it may perform animation (e.g. Karaoke), rolling-up, changes the visibility, or any other dynamic styling.
521    ///
522    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaption?language=objc)
523    #[unsafe(super(NSObject))]
524    #[derive(Debug, PartialEq, Eq, Hash)]
525    pub struct AVCaption;
526);
527
528unsafe impl NSCoding for AVCaption {}
529
530unsafe impl NSCopying for AVCaption {}
531
532unsafe impl CopyingHelper for AVCaption {
533    type Result = Self;
534}
535
536unsafe impl NSMutableCopying for AVCaption {}
537
538unsafe impl MutableCopyingHelper for AVCaption {
539    type Result = AVMutableCaption;
540}
541
542unsafe impl NSObjectProtocol for AVCaption {}
543
544unsafe impl NSSecureCoding for AVCaption {}
545
546impl AVCaption {
547    extern_methods!(
548        #[unsafe(method(init))]
549        #[unsafe(method_family = init)]
550        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
551
552        #[unsafe(method(new))]
553        #[unsafe(method_family = new)]
554        pub unsafe fn new() -> Retained<Self>;
555
556        #[cfg(feature = "objc2-core-media")]
557        /// Initializes an instance of AVCaption with the given text and time range.
558        ///
559        /// Parameter `text`: The text for the new caption object. See text property for the available character sets and other restrictions.
560        ///
561        /// Parameter `timeRange`: The time range for the new caption object.
562        ///
563        /// Returns: An instance of AVCaption that carries the given text and time range.
564        #[unsafe(method(initWithText:timeRange:))]
565        #[unsafe(method_family = init)]
566        pub unsafe fn initWithText_timeRange(
567            this: Allocated<Self>,
568            text: &NSString,
569            time_range: CMTimeRange,
570        ) -> Retained<Self>;
571
572        /// The text content of the caption.
573        ///
574        /// The text may contain any of the line breaking character sequences (LF, CR, or CF+LF) and separating the lines in the presentation.
575        ///
576        /// The Apple iTT format supports all Unicode code points allowed in a XML document. Any XML special characters such as '
577        /// &
578        /// ' are converted to a corresponding character reference syntax when written to the destination file.
579        ///
580        /// CEA608 closed captions support the following Unicode characters.
581        /// Range: U+0020 - U+005F
582        /// Range: U+0061 - U+007E
583        /// Range: U+00A1 - U+00A5
584        /// Characters: U+00A9, U+00AB, U+00AE, U+00B0, U+00BB, U+00BD, U+00BF
585        /// Range: U+00C0-U+00C5
586        /// Range: U+00C7-U+00CF
587        /// Range: U+00D1-U+00D6
588        /// Range: U+00D8-U+00DC
589        /// Range: U+00DF-U+00E5
590        /// Range: U+00E7-U+00EF
591        /// Range: U+00F1-U+00FC
592        /// Range: U+2018-U+2019
593        /// Range: U+2018-U+201D
594        /// Character: U+2022
595        /// Range: U+2120-U+2122
596        /// Characters: U+2501, U+2503, U+250F, U+2513, U+2517, U+251B, U+2588, U+266A
597        ///
598        /// CEA608 closed captions don't support the line breaking character sequences (LF, CR, or CF+LF).
599        #[unsafe(method(text))]
600        #[unsafe(method_family = none)]
601        pub unsafe fn text(&self) -> Retained<NSString>;
602
603        #[cfg(feature = "objc2-core-media")]
604        /// The time range during which the caption should be presented.
605        ///
606        /// Apple iTT format doesn't allow two captions to have overlapped time range except when the two captions are associated with different regions.
607        ///
608        /// CEA608 closed caption time ranges can't start with zero, because the decoder needs some transmission time.
609        /// CEA608 closed caption time ranges should be aligned with the video frame rate because this is how often the commands are delivered.
610        #[unsafe(method(timeRange))]
611        #[unsafe(method_family = none)]
612        pub unsafe fn timeRange(&self) -> CMTimeRange;
613    );
614}
615
616extern_class!(
617    /// Mutable subclass of AVCaption.
618    ///
619    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutablecaption?language=objc)
620    #[unsafe(super(AVCaption, NSObject))]
621    #[derive(Debug, PartialEq, Eq, Hash)]
622    pub struct AVMutableCaption;
623);
624
625unsafe impl NSCoding for AVMutableCaption {}
626
627unsafe impl NSCopying for AVMutableCaption {}
628
629unsafe impl CopyingHelper for AVMutableCaption {
630    type Result = AVCaption;
631}
632
633unsafe impl NSMutableCopying for AVMutableCaption {}
634
635unsafe impl MutableCopyingHelper for AVMutableCaption {
636    type Result = Self;
637}
638
639unsafe impl NSObjectProtocol for AVMutableCaption {}
640
641unsafe impl NSSecureCoding for AVMutableCaption {}
642
643impl AVMutableCaption {
644    extern_methods!(
645        /// The text content of the caption.
646        ///
647        /// All styling information is cleared on setting this property.
648        #[unsafe(method(text))]
649        #[unsafe(method_family = none)]
650        pub unsafe fn text(&self) -> Retained<NSString>;
651
652        /// Setter for [`text`][Self::text].
653        #[unsafe(method(setText:))]
654        #[unsafe(method_family = none)]
655        pub unsafe fn setText(&self, text: &NSString);
656
657        #[cfg(feature = "objc2-core-media")]
658        /// The time range during which the caption should be presented.
659        #[unsafe(method(timeRange))]
660        #[unsafe(method_family = none)]
661        pub unsafe fn timeRange(&self) -> CMTimeRange;
662
663        #[cfg(feature = "objc2-core-media")]
664        /// Setter for [`timeRange`][Self::timeRange].
665        #[unsafe(method(setTimeRange:))]
666        #[unsafe(method_family = none)]
667        pub unsafe fn setTimeRange(&self, time_range: CMTimeRange);
668    );
669}
670
671/// Methods declared on superclass `AVCaption`.
672impl AVMutableCaption {
673    extern_methods!(
674        #[unsafe(method(init))]
675        #[unsafe(method_family = init)]
676        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
677
678        #[unsafe(method(new))]
679        #[unsafe(method_family = new)]
680        pub unsafe fn new() -> Retained<Self>;
681
682        #[cfg(feature = "objc2-core-media")]
683        /// Initializes an instance of AVCaption with the given text and time range.
684        ///
685        /// Parameter `text`: The text for the new caption object. See text property for the available character sets and other restrictions.
686        ///
687        /// Parameter `timeRange`: The time range for the new caption object.
688        ///
689        /// Returns: An instance of AVCaption that carries the given text and time range.
690        #[unsafe(method(initWithText:timeRange:))]
691        #[unsafe(method_family = init)]
692        pub unsafe fn initWithText_timeRange(
693            this: Allocated<Self>,
694            text: &NSString,
695            time_range: CMTimeRange,
696        ) -> Retained<Self>;
697    );
698}
699
700/// Choices for font weight.
701///
702/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionfontweight?language=objc)
703// NS_ENUM
704#[repr(transparent)]
705#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
706pub struct AVCaptionFontWeight(pub NSInteger);
707impl AVCaptionFontWeight {
708    #[doc(alias = "AVCaptionFontWeightUnknown")]
709    pub const Unknown: Self = Self(0);
710    #[doc(alias = "AVCaptionFontWeightNormal")]
711    pub const Normal: Self = Self(1);
712    #[doc(alias = "AVCaptionFontWeightBold")]
713    pub const Bold: Self = Self(2);
714}
715
716unsafe impl Encode for AVCaptionFontWeight {
717    const ENCODING: Encoding = NSInteger::ENCODING;
718}
719
720unsafe impl RefEncode for AVCaptionFontWeight {
721    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
722}
723
724/// Choices for character style.
725///
726/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionfontstyle?language=objc)
727// NS_ENUM
728#[repr(transparent)]
729#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
730pub struct AVCaptionFontStyle(pub NSInteger);
731impl AVCaptionFontStyle {
732    #[doc(alias = "AVCaptionFontStyleUnknown")]
733    pub const Unknown: Self = Self(0);
734    #[doc(alias = "AVCaptionFontStyleNormal")]
735    pub const Normal: Self = Self(1);
736    #[doc(alias = "AVCaptionFontStyleItalic")]
737    pub const Italic: Self = Self(2);
738}
739
740unsafe impl Encode for AVCaptionFontStyle {
741    const ENCODING: Encoding = NSInteger::ENCODING;
742}
743
744unsafe impl RefEncode for AVCaptionFontStyle {
745    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
746}
747
748/// Choices for character decoration .
749///
750/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptiondecoration?language=objc)
751// NS_OPTIONS
752#[repr(transparent)]
753#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
754pub struct AVCaptionDecoration(pub NSUInteger);
755bitflags::bitflags! {
756    impl AVCaptionDecoration: NSUInteger {
757        #[doc(alias = "AVCaptionDecorationNone")]
758        const None = 0;
759        #[doc(alias = "AVCaptionDecorationUnderline")]
760        const Underline = 1<<0;
761        #[doc(alias = "AVCaptionDecorationLineThrough")]
762        const LineThrough = 1<<1;
763        #[doc(alias = "AVCaptionDecorationOverline")]
764        const Overline = 1<<2;
765    }
766}
767
768unsafe impl Encode for AVCaptionDecoration {
769    const ENCODING: Encoding = NSUInteger::ENCODING;
770}
771
772unsafe impl RefEncode for AVCaptionDecoration {
773    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
774}
775
776/// Choices for text combine.
777///
778///
779/// Text combine is a special rendering policy to combine multiple characters into one unit and present it in upright position in a vertical text flow in order to accomplish so-called "Tate-Chu-Yoko" layout, or horizontal-in-vertical layout.
780///
781/// For example, it can be used to render "2017" horizontally in a vertical text.
782///
783///
784/// Don't combine text upright. It is the same as not specifying the style.
785///
786///
787/// Combine all the characters.
788///
789///
790/// Make one digit upright.
791///
792///
793/// Combine two consecutive digits
794///
795///
796/// Combine three consecutive digits
797///
798///
799/// Combine four consecutive digits
800///
801/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptiontextcombine?language=objc)
802// NS_ENUM
803#[repr(transparent)]
804#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
805pub struct AVCaptionTextCombine(pub NSInteger);
806impl AVCaptionTextCombine {
807    #[doc(alias = "AVCaptionTextCombineAll")]
808    pub const All: Self = Self(-1);
809    #[doc(alias = "AVCaptionTextCombineNone")]
810    pub const None: Self = Self(0);
811    #[doc(alias = "AVCaptionTextCombineOneDigit")]
812    pub const OneDigit: Self = Self(1);
813    #[doc(alias = "AVCaptionTextCombineTwoDigits")]
814    pub const TwoDigits: Self = Self(2);
815    #[doc(alias = "AVCaptionTextCombineThreeDigits")]
816    pub const ThreeDigits: Self = Self(3);
817    #[doc(alias = "AVCaptionTextCombineFourDigits")]
818    pub const FourDigits: Self = Self(4);
819}
820
821unsafe impl Encode for AVCaptionTextCombine {
822    const ENCODING: Encoding = NSInteger::ENCODING;
823}
824
825unsafe impl RefEncode for AVCaptionTextCombine {
826    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
827}
828
829/// Alignment of a caption within the containing region.
830///
831/// Aligned to the start of inline progression direction; e.g. left in left-to-right writing mode and right in right-to-left writing mode.
832///
833/// Aligned to the end of inline progression direction; e.g. right in left-to-right writing mode and right in right-to-left writing mode.
834///
835/// Aligned at center in inline progression direction.
836///
837/// Aligned to left in horizontal writing mode or top in vertical writing mode.
838///
839/// Aligned to right in horizontal writing mode or bottom in vertical writing mode.
840///
841/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptiontextalignment?language=objc)
842// NS_ENUM
843#[repr(transparent)]
844#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
845pub struct AVCaptionTextAlignment(pub NSInteger);
846impl AVCaptionTextAlignment {
847    #[doc(alias = "AVCaptionTextAlignmentStart")]
848    pub const Start: Self = Self(0);
849    #[doc(alias = "AVCaptionTextAlignmentEnd")]
850    pub const End: Self = Self(1);
851    #[doc(alias = "AVCaptionTextAlignmentCenter")]
852    pub const Center: Self = Self(2);
853    #[doc(alias = "AVCaptionTextAlignmentLeft")]
854    pub const Left: Self = Self(3);
855    #[doc(alias = "AVCaptionTextAlignmentRight")]
856    pub const Right: Self = Self(4);
857}
858
859unsafe impl Encode for AVCaptionTextAlignment {
860    const ENCODING: Encoding = NSInteger::ENCODING;
861}
862
863unsafe impl RefEncode for AVCaptionTextAlignment {
864    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
865}
866
867/// Styling.
868impl AVCaption {
869    extern_methods!(
870        #[cfg(feature = "objc2-core-graphics")]
871        /// The color of the character(s).
872        ///
873        /// A value of NULL means that the color is not specified. The caller must release the returned object via CGColorRelease. The range parameter receives UTF-16 code unit index range the style is effective. The range will indicate where the current style returned (including NULL) will be active and allows discovery of the next change in the style.
874        ///
875        /// CEA608 closed captions support the following 8 colors with 1.0 alpha value.
876        /// White    (RGB:1.0, 1.0, 1.0)
877        /// Red        (RGB:1.0, 0.0, 0.0)
878        /// Blue    (RGB:0.0, 0.0, 1.0)
879        /// Green    (RGB:0.0, 1.0, 0.0)
880        /// Yellow    (RGB:1.0, 1.0, 0.0)
881        /// Cyan    (RGB:0.0, 1.0, 1.0)
882        /// Magenta    (RGB:1.0, 0.0, 1.0)
883        /// Black    (RGB:0.0, 0.0, 0.0)
884        #[unsafe(method(textColorAtIndex:range:))]
885        // required for soundness, method has `returns_retained` attribute.
886        #[unsafe(method_family = copy)]
887        pub unsafe fn textColorAtIndex_range(
888            &self,
889            index: NSInteger,
890            out_range: *mut NSRange,
891        ) -> Option<Retained<CGColor>>;
892
893        #[cfg(feature = "objc2-core-graphics")]
894        /// The background color of the character(s).
895        ///
896        /// A value of NULL means that the color is not specified. The caller must release the returned object via CGColorRelease. The range parameter receives UTF-16 code unit index range the style is effective. After returning from the call, the range will indicate where the current style returned (including NULL) will be active and allows discovery of the next change in the style.
897        ///
898        /// iTT format ignores this property.
899        ///
900        /// CEA608 closed captions support the following 8 colors with 1.0, 0.5 and 0.0 alpha values.
901        /// White    (RGB:1.0, 1.0, 1.0)
902        /// Red        (RGB:1.0, 0.0, 0.0)
903        /// Blue    (RGB:0.0, 0.0, 1.0)
904        /// Green    (RGB:0.0, 1.0, 0.0)
905        /// Yellow    (RGB:1.0, 1.0, 0.0)
906        /// Cyan    (RGB:0.0, 1.0, 1.0)
907        /// Magenta    (RGB:1.0, 0.0, 1.0)
908        /// Black    (RGB:0.0, 0.0, 0.0)
909        #[unsafe(method(backgroundColorAtIndex:range:))]
910        // required for soundness, method has `returns_retained` attribute.
911        #[unsafe(method_family = copy)]
912        pub unsafe fn backgroundColorAtIndex_range(
913            &self,
914            index: NSInteger,
915            out_range: *mut NSRange,
916        ) -> Option<Retained<CGColor>>;
917
918        /// Indicates the font weight of the character(s).
919        ///
920        /// The range parameter receives UTF-16 code unit index range the style is effective. After returning from the call, the range will indicate where the current style returned will be active and allows discovery of the next change in the style.
921        ///
922        /// CEA608 closed captions ignore this property.
923        ///
924        /// A visible distinction between AVCaptionFontWeightNormal and AVCaptionFontWeightBold may not exist if the font used has only one weight. This can be more common with CJK fonts where individual fonts can be quite large in terms of storage. Nevertheless, AVCaption still carries the font weight semantics so if the same AVCaption is applied to a different font having multiple weights, the distinction will become visible.
925        #[unsafe(method(fontWeightAtIndex:range:))]
926        #[unsafe(method_family = none)]
927        pub unsafe fn fontWeightAtIndex_range(
928            &self,
929            index: NSInteger,
930            out_range: *mut NSRange,
931        ) -> AVCaptionFontWeight;
932
933        /// Indicates the font style of the character(s).
934        ///
935        /// The range parameter receives UTF-16 code unit index range the style is effective. After returning from the call, the range will indicate where the current style returned will be active and allows discovery of the next change in the style.
936        ///
937        /// Some writing systems may not have italic glyphs for characters and so fonts with italic forms are not available. For example, Japanese fonts do not typically have italic forms for most characters although there may be special cases for Latin characters. Nevertheless, AVCaption still carries the font style semantics even though there may be no visible rendering distinction between using AVCaptionFontStyleNormal and AVCaptionFontStyleItalic with that language.
938        #[unsafe(method(fontStyleAtIndex:range:))]
939        #[unsafe(method_family = none)]
940        pub unsafe fn fontStyleAtIndex_range(
941            &self,
942            index: NSInteger,
943            out_range: *mut NSRange,
944        ) -> AVCaptionFontStyle;
945
946        /// Character decoration
947        ///
948        /// The value of OR-ed value of AVCaptionDecoration as NSInteger. The range parameter receives UTF-16 code unit index range the style is effective. After returning from the call, the range will indicate where the current style returned will be active and allows discovery of the next change in the style.
949        ///
950        /// CEA608 closed captions support only AVCaptionDecorationNone and AVCaptionDecorationUnderline.
951        #[unsafe(method(decorationAtIndex:range:))]
952        #[unsafe(method_family = none)]
953        pub unsafe fn decorationAtIndex_range(
954            &self,
955            index: NSInteger,
956            out_range: *mut NSRange,
957        ) -> AVCaptionDecoration;
958
959        /// Text combine (Tate-Chu-Yoko)
960        ///
961        /// The style is effective only in a vertical text region.
962        ///
963        /// When specified, the renderer combines all the characters in the style range so that their glyph areas consume the nominal bounding box of a single em square of the surrounding vertical text.
964        #[unsafe(method(textCombineAtIndex:range:))]
965        #[unsafe(method_family = none)]
966        pub unsafe fn textCombineAtIndex_range(
967            &self,
968            index: NSInteger,
969            out_range: *mut NSRange,
970        ) -> AVCaptionTextCombine;
971
972        /// Get Ruby associated with the characters.
973        ///
974        /// The range parameter receives UTF-16 code unit index range where the ruby text is applied. After returning from the call, the range will indicate where the current style returned (including NULL) will be active and allows discovery of the next change in the style.
975        ///
976        /// It returns nil when the text doesn't have a ruby at the position.
977        ///
978        /// CEA608 closed captions ignore this property.
979        #[unsafe(method(rubyAtIndex:range:))]
980        #[unsafe(method_family = none)]
981        pub unsafe fn rubyAtIndex_range(
982            &self,
983            index: NSInteger,
984            out_range: *mut NSRange,
985        ) -> Option<Retained<AVCaptionRuby>>;
986    );
987}
988
989/// Region.
990impl AVCaption {
991    extern_methods!(
992        /// The region where the caption is placed.
993        ///
994        /// It can be nil when the underlying caption format doesn't support or use regions.
995        #[unsafe(method(region))]
996        #[unsafe(method_family = none)]
997        pub unsafe fn region(&self) -> Option<Retained<AVCaptionRegion>>;
998
999        /// The text alignment within the containing region.
1000        ///
1001        /// This property throws an exception if a value is set which is not a valid AVCaptionTextAlignment.
1002        #[unsafe(method(textAlignment))]
1003        #[unsafe(method_family = none)]
1004        pub unsafe fn textAlignment(&self) -> AVCaptionTextAlignment;
1005    );
1006}
1007
1008/// Animation.
1009impl AVCaption {
1010    extern_methods!(
1011        #[unsafe(method(animation))]
1012        #[unsafe(method_family = none)]
1013        pub unsafe fn animation(&self) -> AVCaptionAnimation;
1014    );
1015}
1016
1017/// Styling.
1018impl AVMutableCaption {
1019    extern_methods!(
1020        #[cfg(feature = "objc2-core-graphics")]
1021        /// Set text color for the range.
1022        ///
1023        /// The range parameter uses UTF-16 code unit index range.
1024        #[unsafe(method(setTextColor:inRange:))]
1025        #[unsafe(method_family = none)]
1026        pub unsafe fn setTextColor_inRange(&self, color: &CGColor, range: NSRange);
1027
1028        #[cfg(feature = "objc2-core-graphics")]
1029        /// Set background color for the range.
1030        ///
1031        /// The range parameter uses UTF-16 code unit index range.
1032        #[unsafe(method(setBackgroundColor:inRange:))]
1033        #[unsafe(method_family = none)]
1034        pub unsafe fn setBackgroundColor_inRange(&self, color: &CGColor, range: NSRange);
1035
1036        /// Set font weight for the range.
1037        ///
1038        /// The range parameter uses UTF-16 code unit index range.
1039        #[unsafe(method(setFontWeight:inRange:))]
1040        #[unsafe(method_family = none)]
1041        pub unsafe fn setFontWeight_inRange(
1042            &self,
1043            font_weight: AVCaptionFontWeight,
1044            range: NSRange,
1045        );
1046
1047        /// Set font style for the range.
1048        ///
1049        /// The range parameter uses UTF-16 code unit index range.
1050        #[unsafe(method(setFontStyle:inRange:))]
1051        #[unsafe(method_family = none)]
1052        pub unsafe fn setFontStyle_inRange(&self, font_style: AVCaptionFontStyle, range: NSRange);
1053
1054        /// Set text decoration for the range.
1055        ///
1056        /// The range parameter uses UTF-16 code unit index range.
1057        #[unsafe(method(setDecoration:inRange:))]
1058        #[unsafe(method_family = none)]
1059        pub unsafe fn setDecoration_inRange(&self, decoration: AVCaptionDecoration, range: NSRange);
1060
1061        /// Set text combine for the range.
1062        ///
1063        /// The range parameter uses UTF-16 code unit index range.
1064        #[unsafe(method(setTextCombine:inRange:))]
1065        #[unsafe(method_family = none)]
1066        pub unsafe fn setTextCombine_inRange(
1067            &self,
1068            text_combine: AVCaptionTextCombine,
1069            range: NSRange,
1070        );
1071
1072        /// Set ruby text  for the range.
1073        ///
1074        /// The range parameter uses UTF-16 code unit index range.
1075        #[unsafe(method(setRuby:inRange:))]
1076        #[unsafe(method_family = none)]
1077        pub unsafe fn setRuby_inRange(&self, ruby: &AVCaptionRuby, range: NSRange);
1078
1079        /// Remove text color for the range.
1080        ///
1081        /// The range parameter uses UTF-16 code unit index range.
1082        #[unsafe(method(removeTextColorInRange:))]
1083        #[unsafe(method_family = none)]
1084        pub unsafe fn removeTextColorInRange(&self, range: NSRange);
1085
1086        /// Remove background color for the range.
1087        ///
1088        /// The range parameter uses UTF-16 code unit index range.
1089        #[unsafe(method(removeBackgroundColorInRange:))]
1090        #[unsafe(method_family = none)]
1091        pub unsafe fn removeBackgroundColorInRange(&self, range: NSRange);
1092
1093        /// Remove font weight for the range.
1094        ///
1095        /// The range parameter uses UTF-16 code unit index range.
1096        #[unsafe(method(removeFontWeightInRange:))]
1097        #[unsafe(method_family = none)]
1098        pub unsafe fn removeFontWeightInRange(&self, range: NSRange);
1099
1100        /// Remove font style for the range.
1101        ///
1102        /// The range parameter uses UTF-16 code unit index range.
1103        #[unsafe(method(removeFontStyleInRange:))]
1104        #[unsafe(method_family = none)]
1105        pub unsafe fn removeFontStyleInRange(&self, range: NSRange);
1106
1107        /// Remove text decoration for the range.
1108        ///
1109        /// The range parameter uses UTF-16 code unit index range.
1110        #[unsafe(method(removeDecorationInRange:))]
1111        #[unsafe(method_family = none)]
1112        pub unsafe fn removeDecorationInRange(&self, range: NSRange);
1113
1114        /// Remove text combine for the range.
1115        ///
1116        /// The range parameter uses UTF-16 code unit index range.
1117        #[unsafe(method(removeTextCombineInRange:))]
1118        #[unsafe(method_family = none)]
1119        pub unsafe fn removeTextCombineInRange(&self, range: NSRange);
1120
1121        /// Remove ruby text  for the range.
1122        ///
1123        /// The range parameter uses UTF-16 code unit index range.
1124        #[unsafe(method(removeRubyInRange:))]
1125        #[unsafe(method_family = none)]
1126        pub unsafe fn removeRubyInRange(&self, range: NSRange);
1127    );
1128}
1129
1130/// Region.
1131impl AVMutableCaption {
1132    extern_methods!(
1133        /// The region where the caption is placed.
1134        ///
1135        /// It can be nil when the underlying caption format doesn't support or use regions.
1136        /// This property throws an exception if region has unrecognizeable units.
1137        #[unsafe(method(region))]
1138        #[unsafe(method_family = none)]
1139        pub unsafe fn region(&self) -> Retained<AVCaptionRegion>;
1140
1141        /// Setter for [`region`][Self::region].
1142        #[unsafe(method(setRegion:))]
1143        #[unsafe(method_family = none)]
1144        pub unsafe fn setRegion(&self, region: &AVCaptionRegion);
1145
1146        /// The text alignemnt within the containing region.
1147        #[unsafe(method(textAlignment))]
1148        #[unsafe(method_family = none)]
1149        pub unsafe fn textAlignment(&self) -> AVCaptionTextAlignment;
1150
1151        /// Setter for [`textAlignment`][Self::textAlignment].
1152        #[unsafe(method(setTextAlignment:))]
1153        #[unsafe(method_family = none)]
1154        pub unsafe fn setTextAlignment(&self, text_alignment: AVCaptionTextAlignment);
1155    );
1156}
1157
1158/// Animation.
1159impl AVMutableCaption {
1160    extern_methods!(
1161        #[unsafe(method(animation))]
1162        #[unsafe(method_family = none)]
1163        pub unsafe fn animation(&self) -> AVCaptionAnimation;
1164
1165        /// Setter for [`animation`][Self::animation].
1166        #[unsafe(method(setAnimation:))]
1167        #[unsafe(method_family = none)]
1168        pub unsafe fn setAnimation(&self, animation: AVCaptionAnimation);
1169    );
1170}
1171
1172/// Choices for Ruby position
1173///
1174/// Display Ruby text above horizontal text or right of vertical text in a right to left block progression.
1175///
1176/// Display Ruby text below horizontal text or left of vertical text in a right to left block progression.
1177///
1178/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionrubyposition?language=objc)
1179// NS_ENUM
1180#[repr(transparent)]
1181#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1182pub struct AVCaptionRubyPosition(pub NSInteger);
1183impl AVCaptionRubyPosition {
1184    #[doc(alias = "AVCaptionRubyPositionBefore")]
1185    pub const Before: Self = Self(0);
1186    #[doc(alias = "AVCaptionRubyPositionAfter")]
1187    pub const After: Self = Self(1);
1188}
1189
1190unsafe impl Encode for AVCaptionRubyPosition {
1191    const ENCODING: Encoding = NSInteger::ENCODING;
1192}
1193
1194unsafe impl RefEncode for AVCaptionRubyPosition {
1195    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1196}
1197
1198/// Choices for Ruby alignment
1199///
1200///
1201/// Given a ruby text rendering area denoted as [...], each spacing policy works as follows.
1202///
1203/// Start          [Ruby Text         ]
1204///
1205/// Center         [     Ruby Text    ]
1206///
1207/// SpaceBetween   [R u b y  T e x t]
1208/// <
1209/// - 'R' and 't' are aligned with start end end edges, spaces between each Ruby text character is equal.
1210///
1211/// SpaceAround    [ R u b y  T e x t ]
1212/// <
1213/// - Spaces around each Ruby text character is equal
1214///
1215///
1216/// Align Ruby base and text at left edge of horizontal text in a left to right inline progression, or at top of the vertical text in a top to bottom inline progression.
1217///
1218/// Align Ruby text at the center of Ruby base.
1219///
1220/// Align Ruby text so that the spaces between the Ruby text characters are equal. This is the default.
1221///
1222/// Align Ruby text so that the spaces around each Ruby text character are equal.
1223///
1224/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionrubyalignment?language=objc)
1225// NS_ENUM
1226#[repr(transparent)]
1227#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1228pub struct AVCaptionRubyAlignment(pub NSInteger);
1229impl AVCaptionRubyAlignment {
1230    #[doc(alias = "AVCaptionRubyAlignmentStart")]
1231    pub const Start: Self = Self(0);
1232    #[doc(alias = "AVCaptionRubyAlignmentCenter")]
1233    pub const Center: Self = Self(1);
1234    #[doc(alias = "AVCaptionRubyAlignmentDistributeSpaceBetween")]
1235    pub const DistributeSpaceBetween: Self = Self(2);
1236    #[doc(alias = "AVCaptionRubyAlignmentDistributeSpaceAround")]
1237    pub const DistributeSpaceAround: Self = Self(3);
1238}
1239
1240unsafe impl Encode for AVCaptionRubyAlignment {
1241    const ENCODING: Encoding = NSInteger::ENCODING;
1242}
1243
1244unsafe impl RefEncode for AVCaptionRubyAlignment {
1245    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1246}
1247
1248extern_class!(
1249    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1250    ///
1251    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptionruby?language=objc)
1252    #[unsafe(super(NSObject))]
1253    #[derive(Debug, PartialEq, Eq, Hash)]
1254    pub struct AVCaptionRuby;
1255);
1256
1257unsafe impl Send for AVCaptionRuby {}
1258
1259unsafe impl Sync for AVCaptionRuby {}
1260
1261unsafe impl NSCoding for AVCaptionRuby {}
1262
1263unsafe impl NSCopying for AVCaptionRuby {}
1264
1265unsafe impl CopyingHelper for AVCaptionRuby {
1266    type Result = Self;
1267}
1268
1269unsafe impl NSObjectProtocol for AVCaptionRuby {}
1270
1271unsafe impl NSSecureCoding for AVCaptionRuby {}
1272
1273impl AVCaptionRuby {
1274    extern_methods!(
1275        #[unsafe(method(init))]
1276        #[unsafe(method_family = init)]
1277        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1278
1279        #[unsafe(method(new))]
1280        #[unsafe(method_family = new)]
1281        pub unsafe fn new() -> Retained<Self>;
1282
1283        #[unsafe(method(initWithText:))]
1284        #[unsafe(method_family = init)]
1285        pub unsafe fn initWithText(this: Allocated<Self>, text: &NSString) -> Retained<Self>;
1286
1287        #[unsafe(method(initWithText:position:alignment:))]
1288        #[unsafe(method_family = init)]
1289        pub unsafe fn initWithText_position_alignment(
1290            this: Allocated<Self>,
1291            text: &NSString,
1292            position: AVCaptionRubyPosition,
1293            alignment: AVCaptionRubyAlignment,
1294        ) -> Retained<Self>;
1295
1296        /// The ruby text
1297        #[unsafe(method(text))]
1298        #[unsafe(method_family = none)]
1299        pub unsafe fn text(&self) -> Retained<NSString>;
1300
1301        /// The position of ruby text with respect to the ruby base.
1302        #[unsafe(method(position))]
1303        #[unsafe(method_family = none)]
1304        pub unsafe fn position(&self) -> AVCaptionRubyPosition;
1305
1306        /// The alignment of ruby text.
1307        #[unsafe(method(alignment))]
1308        #[unsafe(method_family = none)]
1309        pub unsafe fn alignment(&self) -> AVCaptionRubyAlignment;
1310    );
1311}