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