objc2_av_foundation/generated/AVMediaSelectionGroup.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmediaselectiongroup?language=objc)
11 #[unsafe(super(NSObject))]
12 #[derive(Debug, PartialEq, Eq, Hash)]
13 pub struct AVMediaSelectionGroup;
14);
15
16extern_conformance!(
17 unsafe impl NSCopying for AVMediaSelectionGroup {}
18);
19
20unsafe impl CopyingHelper for AVMediaSelectionGroup {
21 type Result = Self;
22}
23
24extern_conformance!(
25 unsafe impl NSObjectProtocol for AVMediaSelectionGroup {}
26);
27
28impl AVMediaSelectionGroup {
29 extern_methods!(
30 /// A collection of mutually exclusive media selection options.
31 ///
32 /// An NSArray of AVMediaSelectionOption*.
33 #[unsafe(method(options))]
34 #[unsafe(method_family = none)]
35 pub unsafe fn options(&self) -> Retained<NSArray<AVMediaSelectionOption>>;
36
37 /// Indicates the default option in the group, i.e. the option that's intended for use in the absence of a specific end-user selection or preference.
38 ///
39 /// Can be nil, indicating that without a specific end-user selection or preference, no option in the group is intended to be selected.
40 #[unsafe(method(defaultOption))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn defaultOption(&self) -> Option<Retained<AVMediaSelectionOption>>;
43
44 /// Indicates whether it's possible to present none of the options in the group when an associated AVPlayerItem is played.
45 ///
46 /// If allowsEmptySelection is YES, all of the available media options in the group can be deselected by passing nil
47 /// as the specified AVMediaSelectionOption to -[AVPlayerItem selectMediaOption:inMediaSelectionGroup:].
48 #[unsafe(method(allowsEmptySelection))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn allowsEmptySelection(&self) -> bool;
51
52 /// Returns the instance of AVMediaSelectionOption with properties that match the specified property list.
53 ///
54 /// Parameter `plist`: A property list previously obtained from an option in the group via -[AVMediaSelectionOption propertyList].
55 ///
56 /// Returns: If the specified properties match those of an option in the group, an instance of AVMediaSelectionOption. Otherwise nil.
57 #[unsafe(method(mediaSelectionOptionWithPropertyList:))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn mediaSelectionOptionWithPropertyList(
60 &self,
61 plist: &AnyObject,
62 ) -> Option<Retained<AVMediaSelectionOption>>;
63 );
64}
65
66/// Methods declared on superclass `NSObject`.
67impl AVMediaSelectionGroup {
68 extern_methods!(
69 #[unsafe(method(init))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73 #[unsafe(method(new))]
74 #[unsafe(method_family = new)]
75 pub unsafe fn new() -> Retained<Self>;
76 );
77}
78
79/// AVMediaSelectionOptionFiltering.
80/// Filtering of media selection options.
81///
82/// The AVMediaSelectionOptionFiltering category is provided for convenience in filtering the media selection options in a group
83/// according to playability, locale, and media characteristics.
84/// Note that it's possible to implement additional filtering behaviors by using -[NSArray indexesOfObjectsPassingTest:].
85impl AVMediaSelectionGroup {
86 extern_methods!(
87 /// Filters an array of AVMediaSelectionOptions according to whether they are playable.
88 ///
89 /// Parameter `mediaSelectionOptions`: An array of AVMediaSelectionOption to be filtered according to whether they are playable.
90 ///
91 /// Returns: An instance of NSArray containing the media selection options of the specified NSArray that are playable.
92 #[unsafe(method(playableMediaSelectionOptionsFromArray:))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn playableMediaSelectionOptionsFromArray(
95 media_selection_options: &NSArray<AVMediaSelectionOption>,
96 ) -> Retained<NSArray<AVMediaSelectionOption>>;
97
98 /// Filters an array of AVMediaSelectionOptions according to whether their locales match any language identifier in the specified array of preferred languages. The returned array is sorted according to the order of preference of the language each matches.
99 ///
100 /// Parameter `mediaSelectionOptions`: An array of AVMediaSelectionOptions to be filtered and sorted.
101 ///
102 /// Parameter `preferredLanguages`: An array of language identifiers in order of preference, each of which is an IETF BCP 47 (RFC 4646) language identifier. Use +[NSLocale preferredLanguages] to obtain the user's list of preferred languages.
103 ///
104 /// Returns: An instance of NSArray containing media selection options of the specified NSArray that match a preferred language, sorted according to the order of preference of the language each matches.
105 #[unsafe(method(mediaSelectionOptionsFromArray:filteredAndSortedAccordingToPreferredLanguages:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn mediaSelectionOptionsFromArray_filteredAndSortedAccordingToPreferredLanguages(
108 media_selection_options: &NSArray<AVMediaSelectionOption>,
109 preferred_languages: &NSArray<NSString>,
110 ) -> Retained<NSArray<AVMediaSelectionOption>>;
111
112 /// Filters an array of AVMediaSelectionOptions according to locale.
113 ///
114 /// Parameter `mediaSelectionOptions`: An array of AVMediaSelectionOption to be filtered by locale.
115 ///
116 /// Parameter `locale`: The NSLocale that must be matched for a media selection option to be copied to the output array.
117 ///
118 /// Returns: An instance of NSArray containing the media selection options of the specified NSArray that match the specified locale.
119 #[unsafe(method(mediaSelectionOptionsFromArray:withLocale:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn mediaSelectionOptionsFromArray_withLocale(
122 media_selection_options: &NSArray<AVMediaSelectionOption>,
123 locale: &NSLocale,
124 ) -> Retained<NSArray<AVMediaSelectionOption>>;
125
126 #[cfg(feature = "AVMediaFormat")]
127 /// Filters an array of AVMediaSelectionOptions according to one or more media characteristics.
128 ///
129 /// Parameter `mediaSelectionOptions`: An array of AVMediaSelectionOptions to be filtered by media characteristic.
130 ///
131 /// Parameter `mediaCharacteristics`: The media characteristics that must be matched for a media selection option to be copied to the output array.
132 ///
133 /// Returns: An instance of NSArray containing the media selection options of the specified NSArray that match the specified
134 /// media characteristics.
135 #[unsafe(method(mediaSelectionOptionsFromArray:withMediaCharacteristics:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn mediaSelectionOptionsFromArray_withMediaCharacteristics(
138 media_selection_options: &NSArray<AVMediaSelectionOption>,
139 media_characteristics: &NSArray<AVMediaCharacteristic>,
140 ) -> Retained<NSArray<AVMediaSelectionOption>>;
141
142 #[cfg(feature = "AVMediaFormat")]
143 /// Filters an array of AVMediaSelectionOptions according to whether they lack one or more media characteristics.
144 ///
145 /// Parameter `mediaSelectionOptions`: An array of AVMediaSelectionOptions to be filtered by media characteristic.
146 ///
147 /// Parameter `mediaCharacteristics`: The media characteristics that must not be present for a media selection option to be copied to the output array.
148 ///
149 /// Returns: An instance of NSArray containing the media selection options of the specified NSArray that lack the specified
150 /// media characteristics.
151 #[unsafe(method(mediaSelectionOptionsFromArray:withoutMediaCharacteristics:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn mediaSelectionOptionsFromArray_withoutMediaCharacteristics(
154 media_selection_options: &NSArray<AVMediaSelectionOption>,
155 media_characteristics: &NSArray<AVMediaCharacteristic>,
156 ) -> Retained<NSArray<AVMediaSelectionOption>>;
157 );
158}
159
160extern_class!(
161 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmediaselectionoption?language=objc)
162 #[unsafe(super(NSObject))]
163 #[derive(Debug, PartialEq, Eq, Hash)]
164 pub struct AVMediaSelectionOption;
165);
166
167extern_conformance!(
168 unsafe impl NSCopying for AVMediaSelectionOption {}
169);
170
171unsafe impl CopyingHelper for AVMediaSelectionOption {
172 type Result = Self;
173}
174
175extern_conformance!(
176 unsafe impl NSObjectProtocol for AVMediaSelectionOption {}
177);
178
179impl AVMediaSelectionOption {
180 extern_methods!(
181 #[cfg(feature = "AVMediaFormat")]
182 /// The media type of the media data, e.g. AVMediaTypeAudio, AVMediaTypeSubtitle, etc.
183 #[unsafe(method(mediaType))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;
186
187 /// The mediaSubTypes of the media data associated with the option.
188 ///
189 /// An NSArray of NSNumbers carrying four character codes (of type FourCharCode) as defined in CoreAudioTypes.h for audio media and in CMFormatDescription.h for video media.
190 /// Also see CMFormatDescriptionGetMediaSubType in CMFormatDescription.h for more information about media subtypes.
191 ///
192 /// Note that if no information is available about the encoding of the media presented when a media option is selected, the value of mediaSubTypes will be an empty array. This can occur, for example, with streaming media. In these cases the value of mediaSubTypes should simply not be used as a criteria for selection.
193 #[unsafe(method(mediaSubTypes))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn mediaSubTypes(&self) -> Retained<NSArray<NSNumber>>;
196
197 #[cfg(feature = "AVMediaFormat")]
198 /// Reports whether the media selection option includes media with the specified media characteristic.
199 ///
200 /// Parameter `mediaCharacteristic`: The media characteristic of interest, e.g. AVMediaCharacteristicVisual, AVMediaCharacteristicAudible, AVMediaCharacteristicLegible, etc.
201 ///
202 /// Returns: YES if the media selection option includes media with the specified characteristic, otherwise NO.
203 #[unsafe(method(hasMediaCharacteristic:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn hasMediaCharacteristic(
206 &self,
207 media_characteristic: &AVMediaCharacteristic,
208 ) -> bool;
209
210 /// Indicates whether a media selection option is playable.
211 ///
212 /// If the media data associated with the option cannot be decoded or otherwise rendered, playable is NO.
213 #[unsafe(method(isPlayable))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn isPlayable(&self) -> bool;
216
217 /// Indicates the RFC 4646 language tag associated with the option. May be nil.
218 #[unsafe(method(extendedLanguageTag))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn extendedLanguageTag(&self) -> Option<Retained<NSString>>;
221
222 /// Indicates the locale for which the media option was authored.
223 ///
224 /// Use -[NSLocale objectForKey:NSLocaleLanguageCode] to obtain the language code of the locale. See NSLocale.h for additional information.
225 #[unsafe(method(locale))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
228
229 #[cfg(feature = "AVMetadataItem")]
230 /// Provides an array of AVMetadataItems for each common metadata key for which a value is available.
231 ///
232 /// The array of AVMetadataItems can be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:], according to locale via +[AVMetadataItem metadataItemsFromArray:withLocale:],
233 /// or according to key via +[AVMetadataItem metadataItemsFromArray:withKey:keySpace:].
234 /// Example: to obtain the name (or title) of a media selection option in any of the user's preferred languages.
235 ///
236 /// NSString *title = nil;
237 /// NSArray *titles = [AVMetadataItem metadataItemsFromArray:[mediaSelectionOption commonMetadata] withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
238 /// if ([titles count] > 0)
239 /// {
240 /// // Try to get a title that matches one of the user's preferred languages.
241 /// NSArray *titlesForPreferredLanguages = [AVMetadataItem metadataItemsFromArray:titles filteredAndSortedAccordingToPreferredLanguages:[NSLocale preferredLanguages]];
242 /// if ([titlesForPreferredLanguages count] > 0)
243 /// {
244 /// title = [[titlesForPreferredLanguages objectAtIndex:0] stringValue];
245 /// }
246 ///
247 /// // No matches in any of the preferred languages. Just use the primary title metadata we find.
248 /// if (title == nil)
249 /// {
250 /// title = [[titles objectAtIndex:0] stringValue];
251 /// }
252 /// }
253 #[unsafe(method(commonMetadata))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn commonMetadata(&self) -> Retained<NSArray<AVMetadataItem>>;
256
257 /// Provides an NSArray of NSStrings, each representing a metadata format that contains metadata associated with the option (e.g. ID3, iTunes metadata, etc.).
258 ///
259 /// Metadata formats are defined in AVMetadataFormat.h.
260 #[unsafe(method(availableMetadataFormats))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn availableMetadataFormats(&self) -> Retained<NSArray<NSString>>;
263
264 #[cfg(feature = "AVMetadataItem")]
265 /// Provides an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format.
266 ///
267 /// Parameter `format`: The metadata format for which items are requested.
268 ///
269 /// Returns: An NSArray containing AVMetadataItems.
270 #[unsafe(method(metadataForFormat:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn metadataForFormat(
273 &self,
274 format: &NSString,
275 ) -> Retained<NSArray<AVMetadataItem>>;
276
277 /// If a media selection option in another group is associated with the specified option, returns a reference to the associated option.
278 ///
279 /// Parameter `mediaSelectionGroup`: A media selection group in which an associated option is to be sought.
280 ///
281 /// Returns: An instance of AVMediaSelectionOption.
282 ///
283 /// Audible media selection options often have associated legible media selection options; in particular, audible options are typically associated with forced-only subtitle options with the same locale. See AVMediaCharacteristicContainsOnlyForcedSubtitles in AVMediaFormat.h for a discussion of forced-only subtitles.
284 #[unsafe(method(associatedMediaSelectionOptionInMediaSelectionGroup:))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn associatedMediaSelectionOptionInMediaSelectionGroup(
287 &self,
288 media_selection_group: &AVMediaSelectionGroup,
289 ) -> Option<Retained<AVMediaSelectionOption>>;
290
291 /// Returns a serializable property list that can be used to obtain an instance of AVMediaSelectionOption representing the same option as the receiver via -[AVMediaSelectionGroup mediaSelectionOptionWithPropertyList:].
292 ///
293 /// Returns: A serializable property list that's sufficient to identify the option within its group. For serialization utilities, see NSPropertyList.h.
294 #[unsafe(method(propertyList))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn propertyList(&self) -> Retained<AnyObject>;
297
298 /// Provides an NSString suitable for display.
299 ///
300 /// Parameter `locale`: Localize manufactured portions of the string using the specificed locale.
301 ///
302 /// May use this option's common metadata, media characteristics and locale properties in addition to the provided locale to formulate an NSString intended for display. Will only consider common metadata with the specified locale.
303 #[unsafe(method(displayNameWithLocale:))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn displayNameWithLocale(&self, locale: &NSLocale) -> Retained<NSString>;
306
307 /// Provides an NSString suitable for display using the current system locale.
308 ///
309 /// May use this option's common metadata, media characteristics and locale properties in addition to the current system locale to formulate an NSString intended for display.
310 /// In the event that common metadata is not available in the specified locale, displayName will fall back to considering locales with the multilingual ("mul") then undetermined ("und") locale identifiers.
311 /// For a display name strictly with the specified locale use displayNameWithLocale: instead.
312 #[unsafe(method(displayName))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn displayName(&self) -> Retained<NSString>;
315 );
316}
317
318/// Methods declared on superclass `NSObject`.
319impl AVMediaSelectionOption {
320 extern_methods!(
321 #[unsafe(method(init))]
322 #[unsafe(method_family = init)]
323 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
324
325 #[unsafe(method(new))]
326 #[unsafe(method_family = new)]
327 pub unsafe fn new() -> Retained<Self>;
328 );
329}