objc2_av_foundation/generated/
AVPlayerItemMediaDataCollector.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// AVPlayerItemMediaDataCollector is an abstract class encapsulating the common API for all AVPlayerItemMediaDataCollector subclasses.
14    ///
15    /// Instances of AVPlayerItemMediaDataCollector permit the collection of media data from an AVAsset during playback by an AVPlayer. As opposed to AVPlayerItemOutputs, AVPlayerItemMediaDataCollectors collect all media data across an AVPlayerItem's timebase, relevant to the specific collector being used. Attaching an AVPlayerItemMediaDataCollector may incur additional I/O accordingly.
16    ///
17    /// You manage an association of an AVPlayerItemMediaDataCollector instance with an AVPlayerItem as the source input using the AVPlayerItem methods:
18    ///
19    /// • addMediaDataCollector:
20    /// • removeMediaDataCollector:
21    ///
22    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
23    ///
24    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmediadatacollector?language=objc)
25    #[unsafe(super(NSObject))]
26    #[derive(Debug, PartialEq, Eq, Hash)]
27    pub struct AVPlayerItemMediaDataCollector;
28);
29
30unsafe impl Send for AVPlayerItemMediaDataCollector {}
31
32unsafe impl Sync for AVPlayerItemMediaDataCollector {}
33
34extern_conformance!(
35    unsafe impl NSObjectProtocol for AVPlayerItemMediaDataCollector {}
36);
37
38impl AVPlayerItemMediaDataCollector {
39    extern_methods!();
40}
41
42/// Methods declared on superclass `NSObject`.
43impl AVPlayerItemMediaDataCollector {
44    extern_methods!(
45        #[unsafe(method(init))]
46        #[unsafe(method_family = init)]
47        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
48
49        #[unsafe(method(new))]
50        #[unsafe(method_family = new)]
51        pub unsafe fn new() -> Retained<Self>;
52    );
53}
54
55extern_class!(
56    /// A subclass of AVPlayerItemMediaDataCollector that provides AVMetadataGroups for an AVPlayerItem.
57    ///
58    /// This class can be used to inform clients of the current set of AVMetadataGroups on an AVPlayerItem, and when new AVMetadataGroups become available - e.g. in a Live HLS stream.
59    ///
60    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
61    ///
62    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmetadatacollector?language=objc)
63    #[unsafe(super(AVPlayerItemMediaDataCollector, NSObject))]
64    #[derive(Debug, PartialEq, Eq, Hash)]
65    pub struct AVPlayerItemMetadataCollector;
66);
67
68unsafe impl Send for AVPlayerItemMetadataCollector {}
69
70unsafe impl Sync for AVPlayerItemMetadataCollector {}
71
72extern_conformance!(
73    unsafe impl NSObjectProtocol for AVPlayerItemMetadataCollector {}
74);
75
76impl AVPlayerItemMetadataCollector {
77    extern_methods!(
78        /// Returns an instance of AVPlayerItemMetadataCollector that can provide all available AVMetadataGroups matching a set of criteria.
79        ///
80        /// Parameter `identifiers`: A array of metadata identifiers indicating the metadata items that the output should provide. See AVMetadataIdentifiers.h for publicly defined metadata identifiers. Pass nil to include metadata with any identifier.
81        ///
82        /// Parameter `classifyingLabels`: If the metadata format supports labeling each metadata group with a string, supplying an array of group labels indicates that the output should provide metadata groups that match one of the supplied labels. Pass nil to include metadata with any (or no) classifying label.
83        ///
84        /// Returns: An instance of AVPlayerItemMetadataCollector.
85        ///
86        /// Some metadata available in some formats - such as timed metadata embedded in HLS segments - is not available for collector output.
87        /// The default init method can be used as an alternative to setting both identifiers and classifyingLabels to nil.
88        #[unsafe(method(initWithIdentifiers:classifyingLabels:))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn initWithIdentifiers_classifyingLabels(
91            this: Allocated<Self>,
92            identifiers: Option<&NSArray<NSString>>,
93            classifying_labels: Option<&NSArray<NSString>>,
94        ) -> Retained<Self>;
95
96        #[cfg(feature = "dispatch2")]
97        /// Sets the receiver's delegate and a dispatch queue on which the delegate will be called.
98        ///
99        /// Parameter `delegate`: An object conforming to AVPlayerItemMetadataCollectorPushDelegate protocol.
100        ///
101        /// Parameter `delegateQueue`: A dispatch queue on which all delegate methods will be called.
102        ///
103        /// # Safety
104        ///
105        /// `delegate_queue` possibly has additional threading requirements.
106        #[unsafe(method(setDelegate:queue:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setDelegate_queue(
109            &self,
110            delegate: Option<&ProtocolObject<dyn AVPlayerItemMetadataCollectorPushDelegate>>,
111            delegate_queue: Option<&DispatchQueue>,
112        );
113
114        /// The receiver's delegate.
115        ///
116        /// The delegate is held using a zeroing-weak reference, so this property will have a value of nil after a delegate that was previously set has been deallocated.  This property is not key-value observable.
117        ///
118        /// This property is not atomic.
119        ///
120        /// # Safety
121        ///
122        /// This might not be thread-safe.
123        #[unsafe(method(delegate))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn delegate(
126            &self,
127        ) -> Option<Retained<ProtocolObject<dyn AVPlayerItemMetadataCollectorPushDelegate>>>;
128
129        #[cfg(feature = "dispatch2")]
130        /// The dispatch queue on which messages are sent to the delegate.
131        ///
132        /// This property is not key-value observable.
133        ///
134        /// This property is not atomic.
135        ///
136        /// # Safety
137        ///
138        /// This might not be thread-safe.
139        #[unsafe(method(delegateQueue))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn delegateQueue(&self) -> Option<Retained<DispatchQueue>>;
142    );
143}
144
145/// Methods declared on superclass `NSObject`.
146impl AVPlayerItemMetadataCollector {
147    extern_methods!(
148        #[unsafe(method(init))]
149        #[unsafe(method_family = init)]
150        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
151
152        #[unsafe(method(new))]
153        #[unsafe(method_family = new)]
154        pub unsafe fn new() -> Retained<Self>;
155    );
156}
157
158extern_protocol!(
159    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmetadatacollectorpushdelegate?language=objc)
160    pub unsafe trait AVPlayerItemMetadataCollectorPushDelegate:
161        NSObjectProtocol + Send + Sync
162    {
163        #[cfg(feature = "AVTimedMetadataGroup")]
164        /// A delegate callback that delivers the total set of AVDateRangeMetadataGroups for this collector.
165        ///
166        /// Parameter `metadataCollector`: The AVPlayerItemMetadataCollector source.
167        ///
168        /// Parameter `metadataGroups`: The set of all metadata groups meeting the criteria of the output.
169        ///
170        /// Parameter `indexesOfNewGroups`: Indexes of metadataGroups added since the last delegate invocation of this method.
171        ///
172        /// Parameter `indexesOfModifiedGroups`: Indexes of metadataGroups modified since the last delegate invocation of this method.
173        ///
174        /// This method will be invoked whenever new AVDateRangeMetadataGroups are added to metadataGroups or whenever any AVDateRangeMetadataGroups in metadataGroups have been modified since previous invocations. The initial invocation will have indexesOfNewGroup referring to every index in metadataGroups. Subsequent invocations may not contain all previously collected metadata groups if they no longer refer to a region in the AVPlayerItem's seekableTimeRanges.
175        #[unsafe(method(metadataCollector:didCollectDateRangeMetadataGroups:indexesOfNewGroups:indexesOfModifiedGroups:))]
176        #[unsafe(method_family = none)]
177        unsafe fn metadataCollector_didCollectDateRangeMetadataGroups_indexesOfNewGroups_indexesOfModifiedGroups(
178            &self,
179            metadata_collector: &AVPlayerItemMetadataCollector,
180            metadata_groups: &NSArray<AVDateRangeMetadataGroup>,
181            indexes_of_new_groups: &NSIndexSet,
182            indexes_of_modified_groups: &NSIndexSet,
183        );
184    }
185);