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