objc2_cinematic/generated/
CNRenderingSession.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-av-foundation")]
7use objc2_av_foundation::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-media")]
11use objc2_core_media::*;
12#[cfg(feature = "objc2-core-video")]
13use objc2_core_video::*;
14use objc2_foundation::*;
15#[cfg(feature = "objc2-metal")]
16use objc2_metal::*;
17
18use crate::*;
19
20#[repr(transparent)]
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
24pub struct CNRenderingQuality(pub NSInteger);
25impl CNRenderingQuality {
26 #[doc(alias = "CNRenderingQualityThumbnail")]
27 pub const Thumbnail: Self = Self(0);
28 #[doc(alias = "CNRenderingQualityPreview")]
29 pub const Preview: Self = Self(1);
30 #[doc(alias = "CNRenderingQualityExport")]
31 pub const Export: Self = Self(2);
32 #[doc(alias = "CNRenderingQualityExportHigh")]
33 pub const ExportHigh: Self = Self(3);
34}
35
36unsafe impl Encode for CNRenderingQuality {
37 const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for CNRenderingQuality {
41 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45 #[unsafe(super(NSObject))]
49 #[derive(Debug, PartialEq, Eq, Hash)]
50 pub struct CNRenderingSessionAttributes;
51);
52
53extern_conformance!(
54 unsafe impl NSObjectProtocol for CNRenderingSessionAttributes {}
55);
56
57impl CNRenderingSessionAttributes {
58 extern_methods!(
59 #[cfg(all(feature = "block2", feature = "objc2-av-foundation"))]
60 #[unsafe(method(loadFromAsset:completionHandler:))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn loadFromAsset_completionHandler(
64 asset: &AVAsset,
65 completion_handler: &block2::DynBlock<
66 dyn Fn(*mut CNRenderingSessionAttributes, *mut NSError),
67 >,
68 );
69
70 #[unsafe(method(renderingVersion))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn renderingVersion(&self) -> NSInteger;
74
75 #[unsafe(method(init))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79 #[unsafe(method(new))]
80 #[unsafe(method_family = new)]
81 pub unsafe fn new() -> Retained<Self>;
82 );
83}
84
85extern_class!(
86 #[unsafe(super(NSObject))]
90 #[derive(Debug, PartialEq, Eq, Hash)]
91 pub struct CNRenderingSessionFrameAttributes;
92);
93
94extern_conformance!(
95 unsafe impl NSCopying for CNRenderingSessionFrameAttributes {}
96);
97
98unsafe impl CopyingHelper for CNRenderingSessionFrameAttributes {
99 type Result = Self;
100}
101
102extern_conformance!(
103 unsafe impl NSObjectProtocol for CNRenderingSessionFrameAttributes {}
104);
105
106impl CNRenderingSessionFrameAttributes {
107 extern_methods!(
108 #[cfg(feature = "objc2-core-media")]
109 #[unsafe(method(initWithSampleBuffer:sessionAttributes:))]
114 #[unsafe(method_family = init)]
115 pub unsafe fn initWithSampleBuffer_sessionAttributes(
116 this: Allocated<Self>,
117 sample_buffer: &CMSampleBuffer,
118 session_attributes: &CNRenderingSessionAttributes,
119 ) -> Option<Retained<Self>>;
120
121 #[cfg(feature = "objc2-av-foundation")]
122 #[unsafe(method(initWithTimedMetadataGroup:sessionAttributes:))]
127 #[unsafe(method_family = init)]
128 pub unsafe fn initWithTimedMetadataGroup_sessionAttributes(
129 this: Allocated<Self>,
130 metadata_group: &AVTimedMetadataGroup,
131 session_attributes: &CNRenderingSessionAttributes,
132 ) -> Option<Retained<Self>>;
133
134 #[unsafe(method(focusDisparity))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn focusDisparity(&self) -> c_float;
141
142 #[unsafe(method(setFocusDisparity:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setFocusDisparity(&self, focus_disparity: c_float);
146
147 #[unsafe(method(fNumber))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn fNumber(&self) -> c_float;
153
154 #[unsafe(method(setFNumber:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn setFNumber(&self, f_number: c_float);
158
159 #[unsafe(method(init))]
160 #[unsafe(method_family = init)]
161 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
162
163 #[unsafe(method(new))]
164 #[unsafe(method_family = new)]
165 pub unsafe fn new() -> Retained<Self>;
166 );
167}
168
169extern_class!(
170 #[unsafe(super(NSObject))]
172 #[derive(Debug, PartialEq, Eq, Hash)]
173 pub struct CNRenderingSession;
174);
175
176extern_conformance!(
177 unsafe impl NSObjectProtocol for CNRenderingSession {}
178);
179
180impl CNRenderingSession {
181 extern_methods!(
182 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
183 #[unsafe(method(initWithCommandQueue:sessionAttributes:preferredTransform:quality:))]
184 #[unsafe(method_family = init)]
185 pub unsafe fn initWithCommandQueue_sessionAttributes_preferredTransform_quality(
186 this: Allocated<Self>,
187 command_queue: &ProtocolObject<dyn MTLCommandQueue>,
188 session_attributes: &CNRenderingSessionAttributes,
189 preferred_transform: CGAffineTransform,
190 quality: CNRenderingQuality,
191 ) -> Retained<Self>;
192
193 #[cfg(feature = "objc2-metal")]
194 #[unsafe(method(commandQueue))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn commandQueue(&self) -> Retained<ProtocolObject<dyn MTLCommandQueue>>;
197
198 #[unsafe(method(sessionAttributes))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn sessionAttributes(&self) -> Retained<CNRenderingSessionAttributes>;
201
202 #[cfg(feature = "objc2-core-foundation")]
203 #[unsafe(method(preferredTransform))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn preferredTransform(&self) -> CGAffineTransform;
206
207 #[unsafe(method(quality))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn quality(&self) -> CNRenderingQuality;
210
211 #[cfg(all(feature = "objc2-core-video", feature = "objc2-metal"))]
212 #[unsafe(method(encodeRenderToCommandBuffer:frameAttributes:sourceImage:sourceDisparity:destinationImage:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn encodeRenderToCommandBuffer_frameAttributes_sourceImage_sourceDisparity_destinationImage(
223 &self,
224 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
225 frame_attributes: &CNRenderingSessionFrameAttributes,
226 source_image: &CVPixelBuffer,
227 source_disparity: &CVPixelBuffer,
228 destination_image: &CVPixelBuffer,
229 ) -> bool;
230
231 #[cfg(all(feature = "objc2-core-video", feature = "objc2-metal"))]
232 #[unsafe(method(encodeRenderToCommandBuffer:frameAttributes:sourceImage:sourceDisparity:destinationRGBA:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn encodeRenderToCommandBuffer_frameAttributes_sourceImage_sourceDisparity_destinationRGBA(
248 &self,
249 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
250 frame_attributes: &CNRenderingSessionFrameAttributes,
251 source_image: &CVPixelBuffer,
252 source_disparity: &CVPixelBuffer,
253 destination_rgba: &ProtocolObject<dyn MTLTexture>,
254 ) -> bool;
255
256 #[cfg(all(feature = "objc2-core-video", feature = "objc2-metal"))]
257 #[unsafe(method(encodeRenderToCommandBuffer:frameAttributes:sourceImage:sourceDisparity:destinationLuma:destinationChroma:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn encodeRenderToCommandBuffer_frameAttributes_sourceImage_sourceDisparity_destinationLuma_destinationChroma(
276 &self,
277 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
278 frame_attributes: &CNRenderingSessionFrameAttributes,
279 source_image: &CVPixelBuffer,
280 source_disparity: &CVPixelBuffer,
281 destination_luma: &ProtocolObject<dyn MTLTexture>,
282 destination_chroma: &ProtocolObject<dyn MTLTexture>,
283 ) -> bool;
284
285 #[unsafe(method(sourcePixelFormatTypes))]
289 #[unsafe(method_family = none)]
290 pub unsafe fn sourcePixelFormatTypes() -> Retained<NSArray<NSNumber>>;
291
292 #[unsafe(method(destinationPixelFormatTypes))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn destinationPixelFormatTypes() -> Retained<NSArray<NSNumber>>;
298
299 #[unsafe(method(init))]
300 #[unsafe(method_family = init)]
301 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
302
303 #[unsafe(method(new))]
304 #[unsafe(method_family = new)]
305 pub unsafe fn new() -> Retained<Self>;
306 );
307}