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        #[unsafe(method(setTitle:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn setTitle(&self, title: Option<&NSString>);
52
53        /// A subtitle for this item. If this were representing a song, this would
54        /// usually be the artist or composer.
55        #[unsafe(method(subtitle))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
58
59        /// Setter for [`subtitle`][Self::subtitle].
60        #[unsafe(method(setSubtitle:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
63
64        #[cfg(feature = "MPMediaItem")]
65        /// Artwork for this item. Examples of artwork for a content item are the album
66        /// cover for a song, or a movie poster for a movie.
67        #[unsafe(method(artwork))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn artwork(&self) -> Option<Retained<MPMediaItemArtwork>>;
70
71        #[cfg(feature = "MPMediaItem")]
72        /// Setter for [`artwork`][Self::artwork].
73        #[unsafe(method(setArtwork:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setArtwork(&self, artwork: Option<&MPMediaItemArtwork>);
76
77        /// Represents the current playback progress of the item.
78        /// 0.0 = not watched/listened/viewed, 1.0 = fully watched/listened/viewed
79        /// Default is -1.0 (no progress indicator shown)
80        #[unsafe(method(playbackProgress))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn playbackProgress(&self) -> c_float;
83
84        /// Setter for [`playbackProgress`][Self::playbackProgress].
85        #[unsafe(method(setPlaybackProgress:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setPlaybackProgress(&self, playback_progress: c_float);
88
89        /// Represents whether this content item is streaming content, i.e. from the cloud
90        /// where the content is not stored locally.
91        #[unsafe(method(isStreamingContent))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn isStreamingContent(&self) -> bool;
94
95        /// Setter for [`isStreamingContent`][Self::isStreamingContent].
96        #[unsafe(method(setStreamingContent:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setStreamingContent(&self, streaming_content: bool);
99
100        /// Represents whether this content item is explicit content
101        #[unsafe(method(isExplicitContent))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn isExplicitContent(&self) -> bool;
104
105        /// Setter for [`isExplicitContent`][Self::isExplicitContent].
106        #[unsafe(method(setExplicitContent:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setExplicitContent(&self, explicit_content: bool);
109
110        /// Represents whether the content item is a container that may contain other
111        /// content items, e.g. an album or a playlist.
112        #[unsafe(method(isContainer))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn isContainer(&self) -> bool;
115
116        /// Setter for [`isContainer`][Self::isContainer].
117        #[unsafe(method(setContainer:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setContainer(&self, container: bool);
120
121        /// Represents whether the content item is actionable from a playback
122        /// perspective. Albums are playable, for example, because selecting an album
123        /// for playback means the app should play each song in the album in order. An
124        /// example of a content item that may not be playable is a genre, since an app
125        /// experience typically doesn't involve selecting an entire genre for playback.
126        #[unsafe(method(isPlayable))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn isPlayable(&self) -> bool;
129
130        /// Setter for [`isPlayable`][Self::isPlayable].
131        #[unsafe(method(setPlayable:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setPlayable(&self, playable: bool);
134    );
135}
136
137/// Methods declared on superclass `NSObject`.
138impl MPContentItem {
139    extern_methods!(
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}