objc2_media_player/generated/MPContentItem.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 /// MPContentItem represents high-level metadata for a particular media item for
12 /// representation outside the client application. Examples of media items that a
13 /// developer might want to represent include song files, streaming audio URLs,
14 /// or radio stations.
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpcontentitem?language=objc)
17 #[unsafe(super(NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct MPContentItem;
20);
21
22extern_conformance!(
23 unsafe impl NSObjectProtocol for MPContentItem {}
24);
25
26impl MPContentItem {
27 extern_methods!(
28 /// Designated initializer. A unique identifier is required to identify the item
29 /// for later use.
30 #[unsafe(method(initWithIdentifier:))]
31 #[unsafe(method_family = init)]
32 pub unsafe fn initWithIdentifier(
33 this: Allocated<Self>,
34 identifier: &NSString,
35 ) -> Retained<Self>;
36
37 /// A unique identifier for this content item. (Required)
38 #[unsafe(method(identifier))]
39 #[unsafe(method_family = none)]
40 pub unsafe fn identifier(&self) -> Retained<NSString>;
41
42 /// A title for this item. Usually this would be the track name, if representing
43 /// a song, the episode name of a podcast, etc.
44 #[unsafe(method(title))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
47
48 /// Setter for [`title`][Self::title].
49 ///
50 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
51 #[unsafe(method(setTitle:))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn setTitle(&self, title: Option<&NSString>);
54
55 /// A subtitle for this item. If this were representing a song, this would
56 /// usually be the artist or composer.
57 #[unsafe(method(subtitle))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
60
61 /// Setter for [`subtitle`][Self::subtitle].
62 ///
63 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
64 #[unsafe(method(setSubtitle:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
67
68 #[cfg(feature = "MPMediaItem")]
69 /// Artwork for this item. Examples of artwork for a content item are the album
70 /// cover for a song, or a movie poster for a movie.
71 #[unsafe(method(artwork))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn artwork(&self) -> Option<Retained<MPMediaItemArtwork>>;
74
75 #[cfg(feature = "MPMediaItem")]
76 /// Setter for [`artwork`][Self::artwork].
77 #[unsafe(method(setArtwork:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn setArtwork(&self, artwork: Option<&MPMediaItemArtwork>);
80
81 /// Represents the current playback progress of the item.
82 /// 0.0 = not watched/listened/viewed, 1.0 = fully watched/listened/viewed
83 /// Default is -1.0 (no progress indicator shown)
84 #[unsafe(method(playbackProgress))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn playbackProgress(&self) -> c_float;
87
88 /// Setter for [`playbackProgress`][Self::playbackProgress].
89 #[unsafe(method(setPlaybackProgress:))]
90 #[unsafe(method_family = none)]
91 pub unsafe fn setPlaybackProgress(&self, playback_progress: c_float);
92
93 /// Represents whether this content item is streaming content, i.e. from the cloud
94 /// where the content is not stored locally.
95 #[unsafe(method(isStreamingContent))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn isStreamingContent(&self) -> bool;
98
99 /// Setter for [`isStreamingContent`][Self::isStreamingContent].
100 #[unsafe(method(setStreamingContent:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setStreamingContent(&self, streaming_content: bool);
103
104 /// Represents whether this content item is explicit content
105 #[unsafe(method(isExplicitContent))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn isExplicitContent(&self) -> bool;
108
109 /// Setter for [`isExplicitContent`][Self::isExplicitContent].
110 #[unsafe(method(setExplicitContent:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setExplicitContent(&self, explicit_content: bool);
113
114 /// Represents whether the content item is a container that may contain other
115 /// content items, e.g. an album or a playlist.
116 #[unsafe(method(isContainer))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn isContainer(&self) -> bool;
119
120 /// Setter for [`isContainer`][Self::isContainer].
121 #[unsafe(method(setContainer:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn setContainer(&self, container: bool);
124
125 /// Represents whether the content item is actionable from a playback
126 /// perspective. Albums are playable, for example, because selecting an album
127 /// for playback means the app should play each song in the album in order. An
128 /// example of a content item that may not be playable is a genre, since an app
129 /// experience typically doesn't involve selecting an entire genre for playback.
130 #[unsafe(method(isPlayable))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn isPlayable(&self) -> bool;
133
134 /// Setter for [`isPlayable`][Self::isPlayable].
135 #[unsafe(method(setPlayable:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setPlayable(&self, playable: bool);
138 );
139}
140
141/// Methods declared on superclass `NSObject`.
142impl MPContentItem {
143 extern_methods!(
144 #[unsafe(method(init))]
145 #[unsafe(method_family = init)]
146 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
147
148 #[unsafe(method(new))]
149 #[unsafe(method_family = new)]
150 pub unsafe fn new() -> Retained<Self>;
151 );
152}