objc2_replay_kit/generated/
RPBroadcastExtension.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::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-media")]
10use objc2_core_media::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15mod private_NSExtensionContextRPBroadcastExtension {
16    pub trait Sealed {}
17}
18
19/// Category "RPBroadcastExtension" on [`NSExtensionContext`].
20///
21/// Category which defines the method to call from on an extension context object when user interaction is complete during the broadcast setup flow.
22#[doc(alias = "RPBroadcastExtension")]
23pub unsafe trait NSExtensionContextRPBroadcastExtension:
24    ClassType + Sized + private_NSExtensionContextRPBroadcastExtension::Sealed
25{
26    extern_methods!(
27        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
28        #[cfg(target_os = "macos")]
29        /// Load information about the broadcasting app.
30        ///
31        /// Parameter `handler`: block which will be supplied a bundleID, displayName and an optional appIcon.
32        #[unsafe(method(loadBroadcastingApplicationInfoWithCompletion:))]
33        #[unsafe(method_family = none)]
34        unsafe fn loadBroadcastingApplicationInfoWithCompletion(
35            &self,
36            handler: &block2::DynBlock<dyn Fn(NonNull<NSString>, NonNull<NSString>, *mut NSImage)>,
37        );
38
39        /// # Safety
40        ///
41        /// `setup_info` generic must implement NSCoding.
42        #[unsafe(method(completeRequestWithBroadcastURL:setupInfo:))]
43        #[unsafe(method_family = none)]
44        unsafe fn completeRequestWithBroadcastURL_setupInfo(
45            &self,
46            broadcast_url: &NSURL,
47            setup_info: Option<&NSDictionary<NSString, NSObject>>,
48        );
49    );
50}
51
52impl private_NSExtensionContextRPBroadcastExtension::Sealed for NSExtensionContext {}
53unsafe impl NSExtensionContextRPBroadcastExtension for NSExtensionContext {}
54
55extern_class!(
56    /// Base class for extensions that are responsible for handling video and audio data.
57    ///
58    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcasthandler?language=objc)
59    #[unsafe(super(NSObject))]
60    #[derive(Debug, PartialEq, Eq, Hash)]
61    pub struct RPBroadcastHandler;
62);
63
64extern_conformance!(
65    unsafe impl NSExtensionRequestHandling for RPBroadcastHandler {}
66);
67
68extern_conformance!(
69    unsafe impl NSObjectProtocol for RPBroadcastHandler {}
70);
71
72impl RPBroadcastHandler {
73    extern_methods!(
74        /// Call this method, supplying it with a dictionary defined by the service, to populate the serviceInfo property on RPBroadcastController. This can be used to communicate viewing stats or messages back to the broadcasting app.
75        ///
76        /// Parameter `serviceInfo`: Dictionary that can be passed back to the broadcasting app that may contain information about the ongoing broadcast.
77        ///
78        /// # Safety
79        ///
80        /// `service_info` generic must implement NSCoding.
81        #[unsafe(method(updateServiceInfo:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn updateServiceInfo(&self, service_info: &NSDictionary<NSString, NSObject>);
84
85        /// Call this method, supplying it with a URL to update the broadcastURL property on RPBroadcastController.
86        ///
87        /// Parameter `broadcastURL`: URL of the resource where broadcast can be viewed which will be passed to the broadcasting app.
88        #[unsafe(method(updateBroadcastURL:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn updateBroadcastURL(&self, broadcast_url: &NSURL);
91    );
92}
93
94/// Methods declared on superclass `NSObject`.
95impl RPBroadcastHandler {
96    extern_methods!(
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new() -> Retained<Self>;
104    );
105}
106
107/// [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpsamplebuffertype?language=objc)
108// NS_ENUM
109#[repr(transparent)]
110#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
111pub struct RPSampleBufferType(pub NSInteger);
112impl RPSampleBufferType {
113    #[doc(alias = "RPSampleBufferTypeVideo")]
114    pub const Video: Self = Self(1);
115    #[doc(alias = "RPSampleBufferTypeAudioApp")]
116    pub const AudioApp: Self = Self(2);
117    #[doc(alias = "RPSampleBufferTypeAudioMic")]
118    pub const AudioMic: Self = Self(3);
119}
120
121unsafe impl Encode for RPSampleBufferType {
122    const ENCODING: Encoding = NSInteger::ENCODING;
123}
124
125unsafe impl RefEncode for RPSampleBufferType {
126    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
127}
128
129extern "C" {
130    /// RPVideoSampleOrientationKey
131    ///
132    /// Use this key in conjunction with CMGetAttachment on CMSampleBufferRef to get the orientation for the sample. The orientation will follow the enum CGImagePropertyOrientation
133    ///
134    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpvideosampleorientationkey?language=objc)
135    pub static RPVideoSampleOrientationKey: &'static NSString;
136}
137
138extern "C" {
139    /// RPApplicationInfoBundleIdentifierKey
140    ///
141    /// Use this key to retrieve bundle identifier from dictionary provided by broadcastAnnotatedWithApplicationInfo
142    ///
143    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpapplicationinfobundleidentifierkey?language=objc)
144    pub static RPApplicationInfoBundleIdentifierKey: &'static NSString;
145}
146
147extern_class!(
148    /// Subclass this class to handle CMSampleBuffer objects as they are captured by ReplayKit. To enable this mode of handling, set the RPBroadcastProcessMode in the extension's info.plist to RPBroadcastProcessModeSampleBuffer.
149    ///
150    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastsamplehandler?language=objc)
151    #[unsafe(super(RPBroadcastHandler, NSObject))]
152    #[derive(Debug, PartialEq, Eq, Hash)]
153    pub struct RPBroadcastSampleHandler;
154);
155
156extern_conformance!(
157    unsafe impl NSExtensionRequestHandling for RPBroadcastSampleHandler {}
158);
159
160extern_conformance!(
161    unsafe impl NSObjectProtocol for RPBroadcastSampleHandler {}
162);
163
164impl RPBroadcastSampleHandler {
165    extern_methods!(
166        /// Method is called when the RPBroadcastController startBroadcast method is called from the broadcasting application.
167        ///
168        /// Parameter `setupInfo`: Dictionary that can be supplied by the UI extension to the sample handler.
169        ///
170        /// # Safety
171        ///
172        /// `setup_info` generic should be of the correct type.
173        #[unsafe(method(broadcastStartedWithSetupInfo:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn broadcastStartedWithSetupInfo(
176            &self,
177            setup_info: Option<&NSDictionary<NSString, NSObject>>,
178        );
179
180        /// Method is called when the RPBroadcastController pauseBroadcast method is called from the broadcasting application.
181        #[unsafe(method(broadcastPaused))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn broadcastPaused(&self);
184
185        /// Method is called when the RPBroadcastController resumeBroadcast method is called from the broadcasting application.
186        #[unsafe(method(broadcastResumed))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn broadcastResumed(&self);
189
190        /// Method is called when the RPBroadcastController finishBroadcast method is called from the broadcasting application.
191        #[unsafe(method(broadcastFinished))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn broadcastFinished(&self);
194
195        /// Method is called when broadcast is started from Control Center and provides extension information about the first application opened or used during the broadcast.
196        ///
197        /// Parameter `applicationInfo`: Dictionary that contains information about the first application opened or used buring the broadcast.
198        ///
199        /// # Safety
200        ///
201        /// `application_info` generic should be of the correct type.
202        #[unsafe(method(broadcastAnnotatedWithApplicationInfo:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn broadcastAnnotatedWithApplicationInfo(&self, application_info: &NSDictionary);
205
206        #[cfg(feature = "objc2-core-media")]
207        /// Method is called as video and audio data become available during a broadcast session and is delivered as CMSampleBuffer objects.
208        ///
209        /// Parameter `sampleBuffer`: CMSampleBuffer object which contains either video or audio data.
210        ///
211        /// Parameter `sampleBufferType`: Determine's the type of the sample buffer defined by the RPSampleBufferType enum.
212        #[unsafe(method(processSampleBuffer:withType:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn processSampleBuffer_withType(
215            &self,
216            sample_buffer: &CMSampleBuffer,
217            sample_buffer_type: RPSampleBufferType,
218        );
219
220        /// Method that should be called when broadcasting can not proceed due to an error. Calling this method will stop the broadcast and deliver the error back to the broadcasting app through RPBroadcastController's delegate.
221        ///
222        /// Parameter `error`: NSError object that will be passed back to the broadcasting app through RPBroadcastControllerDelegate's broadcastController:didFinishWithError: method.
223        #[unsafe(method(finishBroadcastWithError:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn finishBroadcastWithError(&self, error: &NSError);
226    );
227}
228
229/// Methods declared on superclass `NSObject`.
230impl RPBroadcastSampleHandler {
231    extern_methods!(
232        #[unsafe(method(init))]
233        #[unsafe(method_family = init)]
234        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
235
236        #[unsafe(method(new))]
237        #[unsafe(method_family = new)]
238        pub unsafe fn new() -> Retained<Self>;
239    );
240}