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;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// AVPlayerItemMediaDataCollector is an abstract class encapsulating the common API for all AVPlayerItemMediaDataCollector subclasses.
12    ///
13    /// 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.
14    ///
15    /// You manage an association of an AVPlayerItemMediaDataCollector instance with an AVPlayerItem as the source input using the AVPlayerItem methods:
16    ///
17    /// • addMediaDataCollector:
18    /// • removeMediaDataCollector:
19    ///
20    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmediadatacollector?language=objc)
23    #[unsafe(super(NSObject))]
24    #[derive(Debug, PartialEq, Eq, Hash)]
25    pub struct AVPlayerItemMediaDataCollector;
26);
27
28unsafe impl Send for AVPlayerItemMediaDataCollector {}
29
30unsafe impl Sync for AVPlayerItemMediaDataCollector {}
31
32unsafe impl NSObjectProtocol for AVPlayerItemMediaDataCollector {}
33
34impl AVPlayerItemMediaDataCollector {
35    extern_methods!();
36}
37
38/// Methods declared on superclass `NSObject`.
39impl AVPlayerItemMediaDataCollector {
40    extern_methods!(
41        #[unsafe(method(init))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
44
45        #[unsafe(method(new))]
46        #[unsafe(method_family = new)]
47        pub unsafe fn new() -> Retained<Self>;
48    );
49}
50
51extern_class!(
52    /// A subclass of AVPlayerItemMediaDataCollector that provides AVMetadataGroups for an AVPlayerItem.
53    ///
54    /// 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.
55    ///
56    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
57    ///
58    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmetadatacollector?language=objc)
59    #[unsafe(super(AVPlayerItemMediaDataCollector, NSObject))]
60    #[derive(Debug, PartialEq, Eq, Hash)]
61    pub struct AVPlayerItemMetadataCollector;
62);
63
64unsafe impl Send for AVPlayerItemMetadataCollector {}
65
66unsafe impl Sync for AVPlayerItemMetadataCollector {}
67
68unsafe impl NSObjectProtocol for AVPlayerItemMetadataCollector {}
69
70impl AVPlayerItemMetadataCollector {
71    extern_methods!(
72        /// Returns an instance of AVPlayerItemMetadataCollector that can provide all available AVMetadataGroups matching a set of criteria.
73        ///
74        /// 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.
75        ///
76        /// 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.
77        ///
78        /// Returns: An instance of AVPlayerItemMetadataCollector.
79        ///
80        /// Some metadata available in some formats - such as timed metadata embedded in HLS segments - is not available for collector output.
81        /// The default init method can be used as an alternative to setting both identifiers and classifyingLabels to nil.
82        #[unsafe(method(initWithIdentifiers:classifyingLabels:))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn initWithIdentifiers_classifyingLabels(
85            this: Allocated<Self>,
86            identifiers: Option<&NSArray<NSString>>,
87            classifying_labels: Option<&NSArray<NSString>>,
88        ) -> Retained<Self>;
89
90        /// The receiver's delegate.
91        ///
92        /// 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.
93        #[unsafe(method(delegate))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn delegate(
96            &self,
97        ) -> Option<Retained<ProtocolObject<dyn AVPlayerItemMetadataCollectorPushDelegate>>>;
98    );
99}
100
101/// Methods declared on superclass `NSObject`.
102impl AVPlayerItemMetadataCollector {
103    extern_methods!(
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107
108        #[unsafe(method(new))]
109        #[unsafe(method_family = new)]
110        pub unsafe fn new() -> Retained<Self>;
111    );
112}
113
114extern_protocol!(
115    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmetadatacollectorpushdelegate?language=objc)
116    pub unsafe trait AVPlayerItemMetadataCollectorPushDelegate: NSObjectProtocol {
117        #[cfg(feature = "AVTimedMetadataGroup")]
118        /// A delegate callback that delivers the total set of AVDateRangeMetadataGroups for this collector.
119        ///
120        /// Parameter `metadataCollector`: The AVPlayerItemMetadataCollector source.
121        ///
122        /// Parameter `metadataGroups`: The set of all metadata groups meeting the criteria of the output.
123        ///
124        /// Parameter `indexesOfNewGroups`: Indexes of metadataGroups added since the last delegate invocation of this method.
125        ///
126        /// Parameter `indexesOfModifiedGroups`: Indexes of metadataGroups modified since the last delegate invocation of this method.
127        ///
128        /// 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.
129        #[unsafe(method(metadataCollector:didCollectDateRangeMetadataGroups:indexesOfNewGroups:indexesOfModifiedGroups:))]
130        #[unsafe(method_family = none)]
131        unsafe fn metadataCollector_didCollectDateRangeMetadataGroups_indexesOfNewGroups_indexesOfModifiedGroups(
132            &self,
133            metadata_collector: &AVPlayerItemMetadataCollector,
134            metadata_groups: &NSArray<AVDateRangeMetadataGroup>,
135            indexes_of_new_groups: &NSIndexSet,
136            indexes_of_modified_groups: &NSIndexSet,
137        );
138    }
139);