objc2_media_player/generated/
MPMediaItem.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct MPMediaType(pub NSUInteger);
19bitflags::bitflags! {
20 impl MPMediaType: NSUInteger {
21 #[doc(alias = "MPMediaTypeMusic")]
22 const Music = 1<<0;
23 #[doc(alias = "MPMediaTypePodcast")]
24 const Podcast = 1<<1;
25 #[doc(alias = "MPMediaTypeAudioBook")]
26 const AudioBook = 1<<2;
27 #[doc(alias = "MPMediaTypeAudioITunesU")]
28 const AudioITunesU = 1<<3;
29 #[doc(alias = "MPMediaTypeAnyAudio")]
30 const AnyAudio = 0x00ff;
31 #[doc(alias = "MPMediaTypeMovie")]
32 const Movie = 1<<8;
33 #[doc(alias = "MPMediaTypeTVShow")]
34 const TVShow = 1<<9;
35 #[doc(alias = "MPMediaTypeVideoPodcast")]
36 const VideoPodcast = 1<<10;
37 #[doc(alias = "MPMediaTypeMusicVideo")]
38 const MusicVideo = 1<<11;
39 #[doc(alias = "MPMediaTypeVideoITunesU")]
40 const VideoITunesU = 1<<12;
41 #[doc(alias = "MPMediaTypeHomeVideo")]
42 const HomeVideo = 1<<13;
43 #[doc(alias = "MPMediaTypeAnyVideo")]
44 const AnyVideo = 0xff00;
45 #[doc(alias = "MPMediaTypeAny")]
46 const Any = !0;
47 }
48}
49
50unsafe impl Encode for MPMediaType {
51 const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for MPMediaType {
55 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern "C" {
59 pub static MPMediaItemPropertyPersistentID: &'static NSString;
61}
62
63extern "C" {
64 pub static MPMediaItemPropertyMediaType: &'static NSString;
66}
67
68extern "C" {
69 pub static MPMediaItemPropertyTitle: &'static NSString;
71}
72
73extern "C" {
74 pub static MPMediaItemPropertyAlbumTitle: &'static NSString;
76}
77
78extern "C" {
79 pub static MPMediaItemPropertyAlbumPersistentID: &'static NSString;
81}
82
83extern "C" {
84 pub static MPMediaItemPropertyArtist: &'static NSString;
86}
87
88extern "C" {
89 pub static MPMediaItemPropertyArtistPersistentID: &'static NSString;
91}
92
93extern "C" {
94 pub static MPMediaItemPropertyAlbumArtist: &'static NSString;
96}
97
98extern "C" {
99 pub static MPMediaItemPropertyAlbumArtistPersistentID: &'static NSString;
101}
102
103extern "C" {
104 pub static MPMediaItemPropertyGenre: &'static NSString;
106}
107
108extern "C" {
109 pub static MPMediaItemPropertyGenrePersistentID: &'static NSString;
111}
112
113extern "C" {
114 pub static MPMediaItemPropertyComposer: &'static NSString;
116}
117
118extern "C" {
119 pub static MPMediaItemPropertyComposerPersistentID: &'static NSString;
121}
122
123extern "C" {
124 pub static MPMediaItemPropertyPlaybackDuration: &'static NSString;
126}
127
128extern "C" {
129 pub static MPMediaItemPropertyAlbumTrackNumber: &'static NSString;
131}
132
133extern "C" {
134 pub static MPMediaItemPropertyAlbumTrackCount: &'static NSString;
136}
137
138extern "C" {
139 pub static MPMediaItemPropertyDiscNumber: &'static NSString;
141}
142
143extern "C" {
144 pub static MPMediaItemPropertyDiscCount: &'static NSString;
146}
147
148extern "C" {
149 pub static MPMediaItemPropertyArtwork: &'static NSString;
151}
152
153extern "C" {
154 pub static MPMediaItemPropertyIsExplicit: &'static NSString;
156}
157
158extern "C" {
159 pub static MPMediaItemPropertyLyrics: &'static NSString;
161}
162
163extern "C" {
164 pub static MPMediaItemPropertyIsCompilation: &'static NSString;
166}
167
168extern "C" {
169 pub static MPMediaItemPropertyReleaseDate: &'static NSString;
171}
172
173extern "C" {
174 pub static MPMediaItemPropertyBeatsPerMinute: &'static NSString;
176}
177
178extern "C" {
179 pub static MPMediaItemPropertyComments: &'static NSString;
181}
182
183extern "C" {
184 pub static MPMediaItemPropertyAssetURL: &'static NSString;
186}
187
188extern "C" {
189 pub static MPMediaItemPropertyIsCloudItem: &'static NSString;
191}
192
193extern "C" {
194 pub static MPMediaItemPropertyHasProtectedAsset: &'static NSString;
196}
197
198extern "C" {
199 pub static MPMediaItemPropertyPodcastTitle: &'static NSString;
201}
202
203extern "C" {
204 pub static MPMediaItemPropertyPodcastPersistentID: &'static NSString;
206}
207
208extern "C" {
209 pub static MPMediaItemPropertyPlayCount: &'static NSString;
211}
212
213extern "C" {
214 pub static MPMediaItemPropertySkipCount: &'static NSString;
216}
217
218extern "C" {
219 pub static MPMediaItemPropertyRating: &'static NSString;
221}
222
223extern "C" {
224 pub static MPMediaItemPropertyLastPlayedDate: &'static NSString;
226}
227
228extern "C" {
229 pub static MPMediaItemPropertyUserGrouping: &'static NSString;
231}
232
233extern "C" {
234 pub static MPMediaItemPropertyBookmarkTime: &'static NSString;
236}
237
238extern "C" {
239 pub static MPMediaItemPropertyDateAdded: &'static NSString;
241}
242
243extern "C" {
244 pub static MPMediaItemPropertyPlaybackStoreID: &'static NSString;
246}
247
248extern "C" {
249 pub static MPMediaItemPropertyIsPreorder: &'static NSString;
251}
252
253extern_class!(
254 #[unsafe(super(MPMediaEntity, NSObject))]
256 #[derive(Debug, PartialEq, Eq, Hash)]
257 #[cfg(feature = "MPMediaEntity")]
258 pub struct MPMediaItem;
259);
260
261#[cfg(feature = "MPMediaEntity")]
262extern_conformance!(
263 unsafe impl NSCoding for MPMediaItem {}
264);
265
266#[cfg(feature = "MPMediaEntity")]
267extern_conformance!(
268 unsafe impl NSObjectProtocol for MPMediaItem {}
269);
270
271#[cfg(feature = "MPMediaEntity")]
272extern_conformance!(
273 unsafe impl NSSecureCoding for MPMediaItem {}
274);
275
276#[cfg(feature = "MPMediaEntity")]
277impl MPMediaItem {
278 extern_methods!(
279 #[unsafe(method(persistentID))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn persistentID(&self) -> MPMediaEntityPersistentID;
282
283 #[unsafe(method(mediaType))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn mediaType(&self) -> MPMediaType;
286
287 #[unsafe(method(title))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
290
291 #[unsafe(method(albumTitle))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn albumTitle(&self) -> Option<Retained<NSString>>;
294
295 #[unsafe(method(albumPersistentID))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn albumPersistentID(&self) -> MPMediaEntityPersistentID;
298
299 #[unsafe(method(artist))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn artist(&self) -> Option<Retained<NSString>>;
302
303 #[unsafe(method(artistPersistentID))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn artistPersistentID(&self) -> MPMediaEntityPersistentID;
306
307 #[unsafe(method(albumArtist))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn albumArtist(&self) -> Option<Retained<NSString>>;
310
311 #[unsafe(method(albumArtistPersistentID))]
312 #[unsafe(method_family = none)]
313 pub unsafe fn albumArtistPersistentID(&self) -> MPMediaEntityPersistentID;
314
315 #[unsafe(method(genre))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn genre(&self) -> Option<Retained<NSString>>;
318
319 #[unsafe(method(genrePersistentID))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn genrePersistentID(&self) -> MPMediaEntityPersistentID;
322
323 #[unsafe(method(composer))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn composer(&self) -> Option<Retained<NSString>>;
326
327 #[unsafe(method(composerPersistentID))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn composerPersistentID(&self) -> MPMediaEntityPersistentID;
330
331 #[unsafe(method(playbackDuration))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn playbackDuration(&self) -> NSTimeInterval;
334
335 #[unsafe(method(albumTrackNumber))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn albumTrackNumber(&self) -> NSUInteger;
338
339 #[unsafe(method(albumTrackCount))]
340 #[unsafe(method_family = none)]
341 pub unsafe fn albumTrackCount(&self) -> NSUInteger;
342
343 #[unsafe(method(discNumber))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn discNumber(&self) -> NSUInteger;
346
347 #[unsafe(method(discCount))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn discCount(&self) -> NSUInteger;
350
351 #[unsafe(method(artwork))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn artwork(&self) -> Option<Retained<MPMediaItemArtwork>>;
354
355 #[unsafe(method(isExplicitItem))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn isExplicitItem(&self) -> bool;
358
359 #[unsafe(method(lyrics))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn lyrics(&self) -> Option<Retained<NSString>>;
362
363 #[unsafe(method(isCompilation))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn isCompilation(&self) -> bool;
366
367 #[unsafe(method(releaseDate))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn releaseDate(&self) -> Option<Retained<NSDate>>;
370
371 #[unsafe(method(beatsPerMinute))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn beatsPerMinute(&self) -> NSUInteger;
374
375 #[unsafe(method(comments))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn comments(&self) -> Option<Retained<NSString>>;
378
379 #[unsafe(method(assetURL))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn assetURL(&self) -> Option<Retained<NSURL>>;
382
383 #[unsafe(method(isCloudItem))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn isCloudItem(&self) -> bool;
386
387 #[unsafe(method(hasProtectedAsset))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn hasProtectedAsset(&self) -> bool;
390
391 #[unsafe(method(podcastTitle))]
392 #[unsafe(method_family = none)]
393 pub unsafe fn podcastTitle(&self) -> Option<Retained<NSString>>;
394
395 #[unsafe(method(podcastPersistentID))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn podcastPersistentID(&self) -> MPMediaEntityPersistentID;
398
399 #[unsafe(method(playCount))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn playCount(&self) -> NSUInteger;
402
403 #[unsafe(method(skipCount))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn skipCount(&self) -> NSUInteger;
406
407 #[unsafe(method(rating))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn rating(&self) -> NSUInteger;
410
411 #[unsafe(method(lastPlayedDate))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn lastPlayedDate(&self) -> Option<Retained<NSDate>>;
414
415 #[unsafe(method(userGrouping))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn userGrouping(&self) -> Option<Retained<NSString>>;
418
419 #[unsafe(method(bookmarkTime))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn bookmarkTime(&self) -> NSTimeInterval;
422
423 #[unsafe(method(dateAdded))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn dateAdded(&self) -> Retained<NSDate>;
426
427 #[unsafe(method(playbackStoreID))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn playbackStoreID(&self) -> Retained<NSString>;
430
431 #[unsafe(method(isPreorder))]
432 #[unsafe(method_family = none)]
433 pub unsafe fn isPreorder(&self) -> bool;
434 );
435}
436
437#[cfg(feature = "MPMediaEntity")]
439impl MPMediaItem {
440 extern_methods!(
441 #[unsafe(method(init))]
442 #[unsafe(method_family = init)]
443 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
444
445 #[unsafe(method(new))]
446 #[unsafe(method_family = new)]
447 pub unsafe fn new() -> Retained<Self>;
448 );
449}
450
451extern_class!(
452 #[unsafe(super(NSObject))]
454 #[derive(Debug, PartialEq, Eq, Hash)]
455 pub struct MPMediaItemArtwork;
456);
457
458extern_conformance!(
459 unsafe impl NSObjectProtocol for MPMediaItemArtwork {}
460);
461
462impl MPMediaItemArtwork {
463 extern_methods!(
464 #[unsafe(method(new))]
465 #[unsafe(method_family = new)]
466 pub unsafe fn new() -> Retained<Self>;
467
468 #[unsafe(method(init))]
469 #[unsafe(method_family = init)]
470 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
471
472 #[cfg(all(
473 feature = "block2",
474 feature = "objc2-app-kit",
475 feature = "objc2-core-foundation"
476 ))]
477 #[cfg(target_os = "macos")]
478 #[unsafe(method(initWithBoundsSize:requestHandler:))]
479 #[unsafe(method_family = init)]
480 pub unsafe fn initWithBoundsSize_requestHandler(
481 this: Allocated<Self>,
482 bounds_size: CGSize,
483 request_handler: &block2::DynBlock<dyn Fn(CGSize) -> NonNull<NSImage>>,
484 ) -> Retained<Self>;
485
486 #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
487 #[cfg(target_os = "macos")]
488 #[unsafe(method(imageWithSize:))]
489 #[unsafe(method_family = none)]
490 pub unsafe fn imageWithSize(&self, size: CGSize) -> Option<Retained<NSImage>>;
491
492 #[cfg(feature = "objc2-core-foundation")]
493 #[unsafe(method(bounds))]
494 #[unsafe(method_family = none)]
495 pub unsafe fn bounds(&self) -> CGRect;
496
497 #[cfg(feature = "objc2-core-foundation")]
498 #[deprecated = "cropRect is no longer used"]
499 #[unsafe(method(imageCropRect))]
500 #[unsafe(method_family = none)]
501 pub unsafe fn imageCropRect(&self) -> CGRect;
502 );
503}