objc2-media-player 0.3.2

Bindings to the MediaPlayer framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpremotecommandevent?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPRemoteCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPRemoteCommandEvent {}
);

impl MPRemoteCommandEvent {
    extern_methods!(
        #[cfg(feature = "MPRemoteCommand")]
        /// The command that sent the event.
        #[unsafe(method(command))]
        #[unsafe(method_family = none)]
        pub unsafe fn command(&self) -> Retained<MPRemoteCommand>;

        /// The time when the event occurred.
        #[unsafe(method(timestamp))]
        #[unsafe(method_family = none)]
        pub unsafe fn timestamp(&self) -> NSTimeInterval;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPRemoteCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpskipintervalcommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPSkipIntervalCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPSkipIntervalCommandEvent {}
);

impl MPSkipIntervalCommandEvent {
    extern_methods!(
        /// The chosen interval for this skip command event.
        #[unsafe(method(interval))]
        #[unsafe(method_family = none)]
        pub unsafe fn interval(&self) -> NSTimeInterval;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPSkipIntervalCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpseekcommandeventtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MPSeekCommandEventType(pub NSUInteger);
impl MPSeekCommandEventType {
    #[doc(alias = "MPSeekCommandEventTypeBeginSeeking")]
    pub const BeginSeeking: Self = Self(0);
    #[doc(alias = "MPSeekCommandEventTypeEndSeeking")]
    pub const EndSeeking: Self = Self(1);
}

unsafe impl Encode for MPSeekCommandEventType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MPSeekCommandEventType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpseekcommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPSeekCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPSeekCommandEvent {}
);

impl MPSeekCommandEvent {
    extern_methods!(
        /// The type of seek command event, which specifies whether an external player
        /// began or ended seeking.
        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> MPSeekCommandEventType;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPSeekCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpratingcommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPRatingCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPRatingCommandEvent {}
);

impl MPRatingCommandEvent {
    extern_methods!(
        /// The chosen rating for this command event. This value will be within the
        /// minimumRating and maximumRating values set for the MPRatingCommand object.
        #[unsafe(method(rating))]
        #[unsafe(method_family = none)]
        pub unsafe fn rating(&self) -> c_float;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPRatingCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangeplaybackratecommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPChangePlaybackRateCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPChangePlaybackRateCommandEvent {}
);

impl MPChangePlaybackRateCommandEvent {
    extern_methods!(
        /// The chosen playback rate for this command event. This value will be equal
        /// to one of the values specified in the supportedPlaybackRates array for the
        /// MPChangePlaybackRateCommand object.
        #[unsafe(method(playbackRate))]
        #[unsafe(method_family = none)]
        pub unsafe fn playbackRate(&self) -> c_float;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPChangePlaybackRateCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpfeedbackcommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPFeedbackCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPFeedbackCommandEvent {}
);

impl MPFeedbackCommandEvent {
    extern_methods!(
        /// Whether the command event is a negative operation. For example, the command
        /// might ask that the app remove a bookmark for a particular track, rather than
        /// add it. In this case, the handler for the bookmark command should check this
        /// flag and remove the bookmark if it is set to YES.
        ///
        /// For like/dislike, a "negative like" might be treated differently from a
        /// dislike command. The app might want to remove the "like" flag from the
        /// current track, but not treat it as a dislike command.
        #[unsafe(method(isNegative))]
        #[unsafe(method_family = none)]
        pub unsafe fn isNegative(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPFeedbackCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangelanguageoptioncommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPChangeLanguageOptionCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPChangeLanguageOptionCommandEvent {}
);

impl MPChangeLanguageOptionCommandEvent {
    extern_methods!(
        #[cfg(feature = "MPNowPlayingInfoLanguageOption")]
        /// The requested language option to change.
        /// The supplied language option may be the Automatic Legible Language Option
        /// which would mean that best legible language option based on user preferences
        /// is being requested. See MPNowPlayingInfoLanguageOption isAutomaticLegibleLanguageOption
        #[unsafe(method(languageOption))]
        #[unsafe(method_family = none)]
        pub unsafe fn languageOption(&self) -> Retained<MPNowPlayingInfoLanguageOption>;

        #[cfg(feature = "MPRemoteControlTypes")]
        /// Describes the extent of the changed language option
        #[unsafe(method(setting))]
        #[unsafe(method_family = none)]
        pub unsafe fn setting(&self) -> MPChangeLanguageOptionSetting;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPChangeLanguageOptionCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangeplaybackpositioncommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPChangePlaybackPositionCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPChangePlaybackPositionCommandEvent {}
);

impl MPChangePlaybackPositionCommandEvent {
    extern_methods!(
        /// The desired playback position to use when setting the current time of the player.
        #[unsafe(method(positionTime))]
        #[unsafe(method_family = none)]
        pub unsafe fn positionTime(&self) -> NSTimeInterval;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPChangePlaybackPositionCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangeshufflemodecommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPChangeShuffleModeCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPChangeShuffleModeCommandEvent {}
);

impl MPChangeShuffleModeCommandEvent {
    extern_methods!(
        #[cfg(feature = "MPRemoteControlTypes")]
        /// The desired shuffle type to use when fulfilling the request.
        #[unsafe(method(shuffleType))]
        #[unsafe(method_family = none)]
        pub unsafe fn shuffleType(&self) -> MPShuffleType;

        /// Whether or not the selection should be preserved between playback sessions
        #[unsafe(method(preservesShuffleMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn preservesShuffleMode(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPChangeShuffleModeCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangerepeatmodecommandevent?language=objc)
    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MPChangeRepeatModeCommandEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MPChangeRepeatModeCommandEvent {}
);

impl MPChangeRepeatModeCommandEvent {
    extern_methods!(
        #[cfg(feature = "MPRemoteControlTypes")]
        /// The desired repeat type to use when fulfilling the request.
        #[unsafe(method(repeatType))]
        #[unsafe(method_family = none)]
        pub unsafe fn repeatType(&self) -> MPRepeatType;

        /// Whether or not the selection should be preserved between playback sessions
        #[unsafe(method(preservesRepeatMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn preservesRepeatMode(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl MPChangeRepeatModeCommandEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}