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