use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
use crate::*;
mod private_NSExtensionContextRPBroadcastExtension {
pub trait Sealed {}
}
#[doc(alias = "RPBroadcastExtension")]
pub unsafe trait NSExtensionContextRPBroadcastExtension:
ClassType + Sized + private_NSExtensionContextRPBroadcastExtension::Sealed
{
extern_methods!(
#[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[unsafe(method(loadBroadcastingApplicationInfoWithCompletion:))]
#[unsafe(method_family = none)]
unsafe fn loadBroadcastingApplicationInfoWithCompletion(
&self,
handler: &block2::DynBlock<dyn Fn(NonNull<NSString>, NonNull<NSString>, *mut NSImage)>,
);
#[unsafe(method(completeRequestWithBroadcastURL:setupInfo:))]
#[unsafe(method_family = none)]
unsafe fn completeRequestWithBroadcastURL_setupInfo(
&self,
broadcast_url: &NSURL,
setup_info: Option<&NSDictionary<NSString, NSObject>>,
);
);
}
impl private_NSExtensionContextRPBroadcastExtension::Sealed for NSExtensionContext {}
unsafe impl NSExtensionContextRPBroadcastExtension for NSExtensionContext {}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct RPBroadcastHandler;
);
extern_conformance!(
unsafe impl NSExtensionRequestHandling for RPBroadcastHandler {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for RPBroadcastHandler {}
);
impl RPBroadcastHandler {
extern_methods!(
#[unsafe(method(updateServiceInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn updateServiceInfo(&self, service_info: &NSDictionary<NSString, NSObject>);
#[unsafe(method(updateBroadcastURL:))]
#[unsafe(method_family = none)]
pub unsafe fn updateBroadcastURL(&self, broadcast_url: &NSURL);
);
}
impl RPBroadcastHandler {
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>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct RPSampleBufferType(pub NSInteger);
impl RPSampleBufferType {
#[doc(alias = "RPSampleBufferTypeVideo")]
pub const Video: Self = Self(1);
#[doc(alias = "RPSampleBufferTypeAudioApp")]
pub const AudioApp: Self = Self(2);
#[doc(alias = "RPSampleBufferTypeAudioMic")]
pub const AudioMic: Self = Self(3);
}
unsafe impl Encode for RPSampleBufferType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for RPSampleBufferType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static RPVideoSampleOrientationKey: &'static NSString;
}
extern "C" {
pub static RPApplicationInfoBundleIdentifierKey: &'static NSString;
}
extern_class!(
#[unsafe(super(RPBroadcastHandler, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct RPBroadcastSampleHandler;
);
extern_conformance!(
unsafe impl NSExtensionRequestHandling for RPBroadcastSampleHandler {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for RPBroadcastSampleHandler {}
);
impl RPBroadcastSampleHandler {
extern_methods!(
#[unsafe(method(broadcastStartedWithSetupInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn broadcastStartedWithSetupInfo(
&self,
setup_info: Option<&NSDictionary<NSString, NSObject>>,
);
#[unsafe(method(broadcastPaused))]
#[unsafe(method_family = none)]
pub unsafe fn broadcastPaused(&self);
#[unsafe(method(broadcastResumed))]
#[unsafe(method_family = none)]
pub unsafe fn broadcastResumed(&self);
#[unsafe(method(broadcastFinished))]
#[unsafe(method_family = none)]
pub unsafe fn broadcastFinished(&self);
#[unsafe(method(broadcastAnnotatedWithApplicationInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn broadcastAnnotatedWithApplicationInfo(&self, application_info: &NSDictionary);
#[cfg(feature = "objc2-core-media")]
#[unsafe(method(processSampleBuffer:withType:))]
#[unsafe(method_family = none)]
pub unsafe fn processSampleBuffer_withType(
&self,
sample_buffer: &CMSampleBuffer,
sample_buffer_type: RPSampleBufferType,
);
#[unsafe(method(finishBroadcastWithError:))]
#[unsafe(method_family = none)]
pub unsafe fn finishBroadcastWithError(&self, error: &NSError);
);
}
impl RPBroadcastSampleHandler {
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>;
);
}