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")]
262unsafe impl NSCoding for MPMediaItem {}
263
264#[cfg(feature = "MPMediaEntity")]
265unsafe impl NSObjectProtocol for MPMediaItem {}
266
267#[cfg(feature = "MPMediaEntity")]
268unsafe impl NSSecureCoding for MPMediaItem {}
269
270#[cfg(feature = "MPMediaEntity")]
271impl MPMediaItem {
272 extern_methods!(
273 #[unsafe(method(persistentID))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn persistentID(&self) -> MPMediaEntityPersistentID;
276
277 #[unsafe(method(mediaType))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn mediaType(&self) -> MPMediaType;
280
281 #[unsafe(method(title))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
284
285 #[unsafe(method(albumTitle))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn albumTitle(&self) -> Option<Retained<NSString>>;
288
289 #[unsafe(method(albumPersistentID))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn albumPersistentID(&self) -> MPMediaEntityPersistentID;
292
293 #[unsafe(method(artist))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn artist(&self) -> Option<Retained<NSString>>;
296
297 #[unsafe(method(artistPersistentID))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn artistPersistentID(&self) -> MPMediaEntityPersistentID;
300
301 #[unsafe(method(albumArtist))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn albumArtist(&self) -> Option<Retained<NSString>>;
304
305 #[unsafe(method(albumArtistPersistentID))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn albumArtistPersistentID(&self) -> MPMediaEntityPersistentID;
308
309 #[unsafe(method(genre))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn genre(&self) -> Option<Retained<NSString>>;
312
313 #[unsafe(method(genrePersistentID))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn genrePersistentID(&self) -> MPMediaEntityPersistentID;
316
317 #[unsafe(method(composer))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn composer(&self) -> Option<Retained<NSString>>;
320
321 #[unsafe(method(composerPersistentID))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn composerPersistentID(&self) -> MPMediaEntityPersistentID;
324
325 #[unsafe(method(playbackDuration))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn playbackDuration(&self) -> NSTimeInterval;
328
329 #[unsafe(method(albumTrackNumber))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn albumTrackNumber(&self) -> NSUInteger;
332
333 #[unsafe(method(albumTrackCount))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn albumTrackCount(&self) -> NSUInteger;
336
337 #[unsafe(method(discNumber))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn discNumber(&self) -> NSUInteger;
340
341 #[unsafe(method(discCount))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn discCount(&self) -> NSUInteger;
344
345 #[unsafe(method(artwork))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn artwork(&self) -> Option<Retained<MPMediaItemArtwork>>;
348
349 #[unsafe(method(isExplicitItem))]
350 #[unsafe(method_family = none)]
351 pub unsafe fn isExplicitItem(&self) -> bool;
352
353 #[unsafe(method(lyrics))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn lyrics(&self) -> Option<Retained<NSString>>;
356
357 #[unsafe(method(isCompilation))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn isCompilation(&self) -> bool;
360
361 #[unsafe(method(releaseDate))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn releaseDate(&self) -> Option<Retained<NSDate>>;
364
365 #[unsafe(method(beatsPerMinute))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn beatsPerMinute(&self) -> NSUInteger;
368
369 #[unsafe(method(comments))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn comments(&self) -> Option<Retained<NSString>>;
372
373 #[unsafe(method(assetURL))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn assetURL(&self) -> Option<Retained<NSURL>>;
376
377 #[unsafe(method(isCloudItem))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn isCloudItem(&self) -> bool;
380
381 #[unsafe(method(hasProtectedAsset))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn hasProtectedAsset(&self) -> bool;
384
385 #[unsafe(method(podcastTitle))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn podcastTitle(&self) -> Option<Retained<NSString>>;
388
389 #[unsafe(method(podcastPersistentID))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn podcastPersistentID(&self) -> MPMediaEntityPersistentID;
392
393 #[unsafe(method(playCount))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn playCount(&self) -> NSUInteger;
396
397 #[unsafe(method(skipCount))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn skipCount(&self) -> NSUInteger;
400
401 #[unsafe(method(rating))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn rating(&self) -> NSUInteger;
404
405 #[unsafe(method(lastPlayedDate))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn lastPlayedDate(&self) -> Option<Retained<NSDate>>;
408
409 #[unsafe(method(userGrouping))]
410 #[unsafe(method_family = none)]
411 pub unsafe fn userGrouping(&self) -> Option<Retained<NSString>>;
412
413 #[unsafe(method(bookmarkTime))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn bookmarkTime(&self) -> NSTimeInterval;
416
417 #[unsafe(method(dateAdded))]
418 #[unsafe(method_family = none)]
419 pub unsafe fn dateAdded(&self) -> Retained<NSDate>;
420
421 #[unsafe(method(playbackStoreID))]
422 #[unsafe(method_family = none)]
423 pub unsafe fn playbackStoreID(&self) -> Retained<NSString>;
424
425 #[unsafe(method(isPreorder))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn isPreorder(&self) -> bool;
428 );
429}
430
431#[cfg(feature = "MPMediaEntity")]
433impl MPMediaItem {
434 extern_methods!(
435 #[unsafe(method(init))]
436 #[unsafe(method_family = init)]
437 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
438
439 #[unsafe(method(new))]
440 #[unsafe(method_family = new)]
441 pub unsafe fn new() -> Retained<Self>;
442 );
443}
444
445extern_class!(
446 #[unsafe(super(NSObject))]
448 #[derive(Debug, PartialEq, Eq, Hash)]
449 pub struct MPMediaItemArtwork;
450);
451
452unsafe impl NSObjectProtocol for MPMediaItemArtwork {}
453
454impl MPMediaItemArtwork {
455 extern_methods!(
456 #[unsafe(method(new))]
457 #[unsafe(method_family = new)]
458 pub unsafe fn new() -> Retained<Self>;
459
460 #[unsafe(method(init))]
461 #[unsafe(method_family = init)]
462 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
463
464 #[cfg(all(
465 feature = "block2",
466 feature = "objc2-app-kit",
467 feature = "objc2-core-foundation"
468 ))]
469 #[cfg(target_os = "macos")]
470 #[unsafe(method(initWithBoundsSize:requestHandler:))]
471 #[unsafe(method_family = init)]
472 pub unsafe fn initWithBoundsSize_requestHandler(
473 this: Allocated<Self>,
474 bounds_size: CGSize,
475 request_handler: &block2::Block<dyn Fn(CGSize) -> NonNull<NSImage>>,
476 ) -> Retained<Self>;
477
478 #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
479 #[cfg(target_os = "macos")]
480 #[unsafe(method(imageWithSize:))]
481 #[unsafe(method_family = none)]
482 pub unsafe fn imageWithSize(&self, size: CGSize) -> Option<Retained<NSImage>>;
483
484 #[cfg(feature = "objc2-core-foundation")]
485 #[unsafe(method(bounds))]
486 #[unsafe(method_family = none)]
487 pub unsafe fn bounds(&self) -> CGRect;
488
489 #[cfg(feature = "objc2-core-foundation")]
490 #[deprecated = "cropRect is no longer used"]
491 #[unsafe(method(imageCropRect))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn imageCropRect(&self) -> CGRect;
494 );
495}