objc2_av_foundation/generated/
AVCaptionGroup.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-media")]
6use objc2_core_media::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// An instance of AVCaptionGroup represents zero or more captions that intersect in time.
13    ///
14    /// The time range of each caption may overlap as there can be more than one active caption at a time. A sequence of AVCaptionGroup objects represents such overlapping caption timeline.
15    ///
16    /// An instance of AVCaptionGroup has a time range and a list of active captions for the time range. Two successive AVCaptionGroup objects have contiguous and non-overlapping time ranges. A new AVCaptionGroup time range commences whenever any of caption becomes active or inactive. When a caption spans over multiple AVCaptionGroup time ranges, these  AVCaptionGroup objects refer to an equal AVCaption object.
17    ///
18    /// An empty AVCaptionGroup represents the time range without any active captions.
19    ///
20    /// The list of captions in the group is ordered according to the document order. For example, suppose a TTML document has two temporally overhapping captions:
21    ///
22    /// <div>
23    /// <p begin="1s" end="3s">
24    /// Hello
25    /// <p>
26    /// <p begin="0s" end="2s">
27    /// World
28    /// <p>
29    /// </div>
30    ///
31    /// AVCaptionGroup for time range 1s to 2s has the list of captions: Hello and World in this order despite the fact that "World" is shown earlier than "Hello".
32    ///
33    /// A client may use AVCaptionGroup to get the list of active captions for the time range. For example, presentation processing may find the AVCaptionGroup object for the current time, get the list of captions, and place them into the destination display region.
34    ///
35    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptiongroup?language=objc)
36    #[unsafe(super(NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    pub struct AVCaptionGroup;
39);
40
41extern_conformance!(
42    unsafe impl NSObjectProtocol for AVCaptionGroup {}
43);
44
45impl AVCaptionGroup {
46    extern_methods!(
47        #[cfg(all(feature = "AVCaption", feature = "objc2-core-media"))]
48        /// Initializes a caption group with the given set of captions and the time range.
49        ///
50        /// Every caption in the array must be equal or sub range of the time range, otherwise an exception is raised.
51        ///
52        /// Parameter `captions`: The captions that will be included in the group. The array is coped.
53        ///
54        /// Returns: A newly-initialized caption group.
55        #[unsafe(method(initWithCaptions:timeRange:))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn initWithCaptions_timeRange(
58            this: Allocated<Self>,
59            captions: &NSArray<AVCaption>,
60            time_range: CMTimeRange,
61        ) -> Retained<Self>;
62
63        #[cfg(feature = "objc2-core-media")]
64        /// Initializes an empty caption group with the given time range.
65        ///
66        /// This is a convenient initializer to create an empty caption group time range.
67        ///
68        /// Parameter `timeRange`: The time range for which there are no captions.
69        ///
70        /// Returns: A newly-initialized empty caption group.
71        #[unsafe(method(initWithTimeRange:))]
72        #[unsafe(method_family = init)]
73        pub unsafe fn initWithTimeRange(
74            this: Allocated<Self>,
75            time_range: CMTimeRange,
76        ) -> Retained<Self>;
77
78        #[cfg(feature = "objc2-core-media")]
79        /// The time range represented by the caption group.
80        ///
81        /// If there are no captions in the group (i.e. the value of the captions property is an empty array), then the value of this property represents the time range of a sequence where no captions are present.
82        #[unsafe(method(timeRange))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn timeRange(&self) -> CMTimeRange;
85
86        #[cfg(feature = "AVCaption")]
87        /// An array of AVCaption objects.
88        ///
89        /// If the value is an empty array, the caption group represents a region of the timeline in which there are no captions.
90        #[unsafe(method(captions))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn captions(&self) -> Retained<NSArray<AVCaption>>;
93    );
94}
95
96/// Methods declared on superclass `NSObject`.
97impl AVCaptionGroup {
98    extern_methods!(
99        #[unsafe(method(init))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
102
103        #[unsafe(method(new))]
104        #[unsafe(method_family = new)]
105        pub unsafe fn new() -> Retained<Self>;
106    );
107}