use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-av-foundation")]
use objc2_av_foundation::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MPAdTimeRange;
);
extern_conformance!(
unsafe impl NSCopying for MPAdTimeRange {}
);
unsafe impl CopyingHelper for MPAdTimeRange {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MPAdTimeRange {}
);
impl MPAdTimeRange {
extern_methods!(
#[cfg(feature = "objc2-core-media")]
#[unsafe(method(timeRange))]
#[unsafe(method_family = none)]
pub unsafe fn timeRange(&self) -> CMTimeRange;
#[cfg(feature = "objc2-core-media")]
#[unsafe(method(setTimeRange:))]
#[unsafe(method_family = none)]
pub unsafe fn setTimeRange(&self, time_range: CMTimeRange);
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "objc2-core-media")]
#[unsafe(method(initWithTimeRange:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTimeRange(
this: Allocated<Self>,
time_range: CMTimeRange,
) -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MPNowPlayingSession;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MPNowPlayingSession {}
);
impl MPNowPlayingSession {
extern_methods!(
#[cfg(feature = "objc2-av-foundation")]
#[unsafe(method(initWithPlayers:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithPlayers(
this: Allocated<Self>,
players: &NSArray<AVPlayer>,
) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "objc2-av-foundation")]
#[unsafe(method(players))]
#[unsafe(method_family = none)]
pub unsafe fn players(&self, mtm: MainThreadMarker) -> Retained<NSArray<AVPlayer>>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn MPNowPlayingSessionDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn MPNowPlayingSessionDelegate>>,
);
#[unsafe(method(automaticallyPublishesNowPlayingInfo))]
#[unsafe(method_family = none)]
pub unsafe fn automaticallyPublishesNowPlayingInfo(&self) -> bool;
#[unsafe(method(setAutomaticallyPublishesNowPlayingInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn setAutomaticallyPublishesNowPlayingInfo(
&self,
automatically_publishes_now_playing_info: bool,
);
#[cfg(feature = "MPNowPlayingInfoCenter")]
#[unsafe(method(nowPlayingInfoCenter))]
#[unsafe(method_family = none)]
pub unsafe fn nowPlayingInfoCenter(&self) -> Retained<MPNowPlayingInfoCenter>;
#[cfg(feature = "MPRemoteCommandCenter")]
#[unsafe(method(remoteCommandCenter))]
#[unsafe(method_family = none)]
pub unsafe fn remoteCommandCenter(&self) -> Retained<MPRemoteCommandCenter>;
#[unsafe(method(canBecomeActive))]
#[unsafe(method_family = none)]
pub unsafe fn canBecomeActive(&self) -> bool;
#[unsafe(method(isActive))]
#[unsafe(method_family = none)]
pub unsafe fn isActive(&self) -> bool;
#[cfg(feature = "block2")]
#[unsafe(method(becomeActiveIfPossibleWithCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn becomeActiveIfPossibleWithCompletion(
&self,
completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
);
#[cfg(feature = "objc2-av-foundation")]
#[unsafe(method(addPlayer:))]
#[unsafe(method_family = none)]
pub unsafe fn addPlayer(&self, player: &AVPlayer);
#[cfg(feature = "objc2-av-foundation")]
#[unsafe(method(removePlayer:))]
#[unsafe(method_family = none)]
pub unsafe fn removePlayer(&self, player: &AVPlayer);
);
}
extern_protocol!(
pub unsafe trait MPNowPlayingSessionDelegate: NSObjectProtocol {
#[optional]
#[unsafe(method(nowPlayingSessionDidChangeActive:))]
#[unsafe(method_family = none)]
unsafe fn nowPlayingSessionDidChangeActive(
&self,
now_playing_session: &MPNowPlayingSession,
);
#[optional]
#[unsafe(method(nowPlayingSessionDidChangeCanBecomeActive:))]
#[unsafe(method_family = none)]
unsafe fn nowPlayingSessionDidChangeCanBecomeActive(
&self,
now_playing_session: &MPNowPlayingSession,
);
}
);