Skip to main content

apple_cf/ffi/
mod.rs

1//! Raw FFI declarations for the Swift bridge.
2//!
3//! These are intentionally low-level (`*mut c_void` + scalar arguments) and
4//! `unsafe`; safe wrappers live in [`crate::iosurface`], [`crate::dispatch_queue`],
5//! etc.
6//!
7//! Currently exposes:
8//! * `acf_free_string` — heap-string deallocator used by every bridge fn that
9//!   returns an owned C string back to Rust.
10//! * `dispatch_queue_*` — Grand Central Dispatch queue lifetime + creation.
11//! * `io_surface_*` — `IOSurface` accessors and lifetime control.
12//!
13//! Future framework additions (`CoreMedia`, `CoreVideo`, Metal, ...) extend this
14//! module and gain matching `@_cdecl` exports under
15//! `swift-bridge/Sources/<Framework>Bridge/`.
16
17#![allow(missing_docs)]
18
19mod core_foundation;
20mod core_video_extras;
21mod dispatch_extras;
22
23pub use core_foundation::*;
24pub use core_video_extras::*;
25pub use dispatch_extras::*;
26
27use core::ffi::{c_char, c_void};
28
29extern "C" {
30    /// Free a heap-allocated C string previously returned by any bridge fn.
31    /// Centralised in `AppleCFBridge.swift`.
32    pub fn acf_free_string(s: *mut c_char);
33
34    // ---- dispatch ----
35    /// Swift bridge function `acf_dispatch_queue_create` for the corresponding Apple API.
36    pub fn acf_dispatch_queue_create(label: *const c_char, qos: i32) -> *const c_void;
37    /// Swift bridge function `dispatch_queue_release` for the corresponding Apple API.
38    pub fn dispatch_queue_release(queue: *const c_void);
39    /// Swift bridge function `dispatch_queue_retain` for the corresponding Apple API.
40    pub fn dispatch_queue_retain(queue: *const c_void) -> *const c_void;
41
42    // ---- CoreGraphics bridge helpers ----
43    /// Swift bridge function `cgimage_save_png` for the corresponding Apple API.
44    pub fn cgimage_save_png(image: *mut c_void, path: *const c_char) -> bool;
45
46    // ---- IOSurface ----
47    /// Swift bridge function `io_surface_create` for the corresponding Apple API.
48    pub fn io_surface_create(
49        width: usize,
50        height: usize,
51        pixel_format: u32,
52        bytes_per_element: usize,
53        out_surface: *mut *mut c_void,
54    ) -> i32;
55    /// Swift bridge function `io_surface_create_with_properties` for the corresponding Apple API.
56    pub fn io_surface_create_with_properties(
57        width: usize,
58        height: usize,
59        pixel_format: u32,
60        bytes_per_element: usize,
61        bytes_per_row: usize,
62        alloc_size: usize,
63        plane_count: usize,
64        plane_widths: *const usize,
65        plane_heights: *const usize,
66        plane_bytes_per_row: *const usize,
67        plane_bytes_per_element: *const usize,
68        plane_offsets: *const usize,
69        plane_sizes: *const usize,
70        surface_out: *mut *mut c_void,
71    ) -> i32;
72    /// Swift bridge function `io_surface_release` for the corresponding Apple API.
73    pub fn io_surface_release(surface: *mut c_void);
74    /// Swift bridge function `io_surface_retain` for the corresponding Apple API.
75    pub fn io_surface_retain(surface: *mut c_void) -> *mut c_void;
76    /// Swift bridge function `io_surface_hash` for the corresponding Apple API.
77    pub fn io_surface_hash(surface: *mut c_void) -> usize;
78    /// Swift bridge function `io_surface_get_width` for the corresponding Apple API.
79    pub fn io_surface_get_width(surface: *mut c_void) -> usize;
80    /// Swift bridge function `io_surface_get_height` for the corresponding Apple API.
81    pub fn io_surface_get_height(surface: *mut c_void) -> usize;
82    /// Swift bridge function `io_surface_get_bytes_per_row` for the corresponding Apple API.
83    pub fn io_surface_get_bytes_per_row(surface: *mut c_void) -> usize;
84    /// Swift bridge function `io_surface_get_alloc_size` for the corresponding Apple API.
85    pub fn io_surface_get_alloc_size(surface: *mut c_void) -> usize;
86    /// Swift bridge function `io_surface_get_pixel_format` for the corresponding Apple API.
87    pub fn io_surface_get_pixel_format(surface: *mut c_void) -> u32;
88    /// Swift bridge function `io_surface_get_id` for the corresponding Apple API.
89    pub fn io_surface_get_id(surface: *mut c_void) -> u32;
90    /// Swift bridge function `io_surface_get_seed` for the corresponding Apple API.
91    pub fn io_surface_get_seed(surface: *mut c_void) -> u32;
92    /// Swift bridge function `io_surface_get_plane_count` for the corresponding Apple API.
93    pub fn io_surface_get_plane_count(surface: *mut c_void) -> usize;
94    /// Swift bridge function `io_surface_get_width_of_plane` for the corresponding Apple API.
95    pub fn io_surface_get_width_of_plane(surface: *mut c_void, plane_index: usize) -> usize;
96    /// Swift bridge function `io_surface_get_height_of_plane` for the corresponding Apple API.
97    pub fn io_surface_get_height_of_plane(surface: *mut c_void, plane_index: usize) -> usize;
98    /// Swift bridge function `io_surface_get_bytes_per_row_of_plane` for the corresponding Apple API.
99    pub fn io_surface_get_bytes_per_row_of_plane(surface: *mut c_void, plane_index: usize)
100        -> usize;
101    /// Swift bridge function `io_surface_get_base_address_of_plane` for the corresponding Apple API.
102    pub fn io_surface_get_base_address_of_plane(
103        surface: *mut c_void,
104        plane_index: usize,
105    ) -> *mut c_void;
106    /// Swift bridge function `io_surface_get_base_address` for the corresponding Apple API.
107    pub fn io_surface_get_base_address(surface: *mut c_void) -> *mut c_void;
108    /// Swift bridge function `io_surface_get_bytes_per_element` for the corresponding Apple API.
109    pub fn io_surface_get_bytes_per_element(surface: *mut c_void) -> usize;
110    /// Swift bridge function `io_surface_get_element_width` for the corresponding Apple API.
111    pub fn io_surface_get_element_width(surface: *mut c_void) -> usize;
112    /// Swift bridge function `io_surface_get_element_height` for the corresponding Apple API.
113    pub fn io_surface_get_element_height(surface: *mut c_void) -> usize;
114    /// Swift bridge function `io_surface_is_in_use` for the corresponding Apple API.
115    pub fn io_surface_is_in_use(surface: *mut c_void) -> bool;
116    /// Swift bridge function `io_surface_increment_use_count` for the corresponding Apple API.
117    pub fn io_surface_increment_use_count(surface: *mut c_void);
118    /// Swift bridge function `io_surface_decrement_use_count` for the corresponding Apple API.
119    pub fn io_surface_decrement_use_count(surface: *mut c_void);
120    /// Swift bridge function `io_surface_lock` for the corresponding Apple API.
121    pub fn io_surface_lock(surface: *mut c_void, options: u32, seed: *mut u32) -> i32;
122    /// Swift bridge function `io_surface_unlock` for the corresponding Apple API.
123    pub fn io_surface_unlock(surface: *mut c_void, options: u32, seed: *mut u32) -> i32;
124
125    // ---- CMSampleBuffer ----
126    /// Swift bridge function `cm_sample_buffer_release` for the corresponding Apple API.
127    pub fn cm_sample_buffer_release(sample_buffer: *mut c_void);
128    /// Swift bridge function `cm_sample_buffer_retain` for the corresponding Apple API.
129    pub fn cm_sample_buffer_retain(sample_buffer: *mut c_void) -> *mut c_void;
130    /// Swift bridge function `cm_sample_buffer_hash` for the corresponding Apple API.
131    pub fn cm_sample_buffer_hash(sample_buffer: *mut c_void) -> usize;
132    /// Swift bridge function `cm_sample_buffer_get_data_buffer` for the corresponding Apple API.
133    pub fn cm_sample_buffer_get_data_buffer(sample_buffer: *mut c_void) -> *mut c_void;
134    /// Swift bridge function `cm_sample_buffer_get_format_description` for the corresponding Apple API.
135    pub fn cm_sample_buffer_get_format_description(sample_buffer: *mut c_void) -> *mut c_void;
136    /// Swift bridge function `cm_sample_buffer_get_image_buffer` for the corresponding Apple API.
137    pub fn cm_sample_buffer_get_image_buffer(sample_buffer: *mut c_void) -> *mut c_void;
138    /// Swift bridge function `cm_sample_buffer_get_presentation_timestamp` for the corresponding Apple API.
139    pub fn cm_sample_buffer_get_presentation_timestamp(
140        sample_buffer: *mut c_void,
141        out_value: *mut i64,
142        out_timescale: *mut i32,
143        out_flags: *mut u32,
144        out_epoch: *mut i64,
145    );
146    /// Swift bridge function `cm_sample_buffer_get_decode_timestamp` for the corresponding Apple API.
147    pub fn cm_sample_buffer_get_decode_timestamp(
148        sample_buffer: *mut c_void,
149        out_value: *mut i64,
150        out_timescale: *mut i32,
151        out_flags: *mut u32,
152        out_epoch: *mut i64,
153    );
154    /// Swift bridge function `cm_sample_buffer_get_duration` for the corresponding Apple API.
155    pub fn cm_sample_buffer_get_duration(
156        sample_buffer: *mut c_void,
157        out_value: *mut i64,
158        out_timescale: *mut i32,
159        out_flags: *mut u32,
160        out_epoch: *mut i64,
161    );
162    /// Swift bridge function `cm_sample_buffer_get_num_samples` for the corresponding Apple API.
163    pub fn cm_sample_buffer_get_num_samples(sample_buffer: *mut c_void) -> i64;
164    /// Swift bridge function `cm_sample_buffer_is_valid` for the corresponding Apple API.
165    pub fn cm_sample_buffer_is_valid(sample_buffer: *mut c_void) -> bool;
166    /// Swift bridge function `cm_sample_buffer_data_is_ready` for the corresponding Apple API.
167    pub fn cm_sample_buffer_data_is_ready(sample_buffer: *mut c_void) -> bool;
168
169    // ---- CMBlockBuffer ----
170    /// Swift bridge function `cm_block_buffer_release` for the corresponding Apple API.
171    pub fn cm_block_buffer_release(block_buffer: *mut c_void);
172    /// Swift bridge function `cm_block_buffer_retain` for the corresponding Apple API.
173    pub fn cm_block_buffer_retain(block_buffer: *mut c_void) -> *mut c_void;
174    /// Swift bridge function `cm_block_buffer_hash` for the corresponding Apple API.
175    pub fn cm_block_buffer_hash(block_buffer: *mut c_void) -> usize;
176    /// Swift bridge function `cm_block_buffer_get_data_length` for the corresponding Apple API.
177    pub fn cm_block_buffer_get_data_length(block_buffer: *mut c_void) -> usize;
178    /// Swift bridge function `cm_block_buffer_is_empty` for the corresponding Apple API.
179    pub fn cm_block_buffer_is_empty(block_buffer: *mut c_void) -> bool;
180    /// Swift bridge function `cm_block_buffer_is_range_contiguous` for the corresponding Apple API.
181    pub fn cm_block_buffer_is_range_contiguous(
182        block_buffer: *mut c_void,
183        offset: usize,
184        length: usize,
185    ) -> bool;
186    /// Swift bridge function `cm_block_buffer_get_data_pointer` for the corresponding Apple API.
187    pub fn cm_block_buffer_get_data_pointer(
188        block_buffer: *mut c_void,
189        offset: usize,
190        out_length_at_offset: *mut usize,
191        out_total_length: *mut usize,
192        out_data_pointer: *mut *mut c_void,
193    ) -> i32;
194    /// Swift bridge function `cm_block_buffer_copy_data_bytes` for the corresponding Apple API.
195    pub fn cm_block_buffer_copy_data_bytes(
196        block_buffer: *mut c_void,
197        offset_to_data: usize,
198        data_length: usize,
199        destination: *mut c_void,
200    ) -> i32;
201    /// Swift bridge function `cm_block_buffer_create_with_data` for the corresponding Apple API.
202    pub fn cm_block_buffer_create_with_data(
203        data: *const c_void,
204        data_length: usize,
205        block_buffer_out: *mut *mut c_void,
206    ) -> i32;
207    /// Swift bridge function `cm_block_buffer_create_empty` for the corresponding Apple API.
208    pub fn cm_block_buffer_create_empty(block_buffer_out: *mut *mut c_void) -> i32;
209
210    // ---- CMFormatDescription ----
211    /// Swift bridge function `cm_format_description_release` for the corresponding Apple API.
212    pub fn cm_format_description_release(format_description: *mut c_void);
213    /// Swift bridge function `cm_format_description_retain` for the corresponding Apple API.
214    pub fn cm_format_description_retain(format_description: *mut c_void) -> *mut c_void;
215    /// Swift bridge function `cm_format_description_hash` for the corresponding Apple API.
216    pub fn cm_format_description_hash(format_description: *mut c_void) -> usize;
217    /// Swift bridge function `cm_format_description_get_media_type` for the corresponding Apple API.
218    pub fn cm_format_description_get_media_type(format_description: *mut c_void) -> u32;
219    /// Swift bridge function `cm_format_description_get_media_subtype` for the corresponding Apple API.
220    pub fn cm_format_description_get_media_subtype(format_description: *mut c_void) -> u32;
221    /// Swift bridge function `cm_format_description_get_extensions` for the corresponding Apple API.
222    pub fn cm_format_description_get_extensions(format_description: *mut c_void) -> *const c_void;
223    /// Swift bridge function `cm_format_description_get_audio_sample_rate` for the corresponding Apple API.
224    pub fn cm_format_description_get_audio_sample_rate(format_description: *mut c_void) -> f64;
225    /// Swift bridge function `cm_format_description_get_audio_channel_count` for the corresponding Apple API.
226    pub fn cm_format_description_get_audio_channel_count(format_description: *mut c_void) -> u32;
227    /// Swift bridge function `cm_format_description_get_audio_bits_per_channel` for the corresponding Apple API.
228    pub fn cm_format_description_get_audio_bits_per_channel(format_description: *mut c_void)
229        -> u32;
230    /// Swift bridge function `cm_format_description_get_audio_bytes_per_frame` for the corresponding Apple API.
231    pub fn cm_format_description_get_audio_bytes_per_frame(format_description: *mut c_void) -> u32;
232    /// Swift bridge function `cm_format_description_get_audio_format_flags` for the corresponding Apple API.
233    pub fn cm_format_description_get_audio_format_flags(format_description: *mut c_void) -> u32;
234    /// Swift bridge function `cm_metadata_format_description_create_with_keys` for the corresponding Apple API.
235    pub fn cm_metadata_format_description_create_with_keys(
236        metadata_type: u32,
237        keys: *mut c_void,
238        format_description_out: *mut *mut c_void,
239    ) -> i32;
240    /// Swift bridge function `cm_metadata_format_description_create_with_metadata_specifications` for the corresponding Apple API.
241    pub fn cm_metadata_format_description_create_with_metadata_specifications(
242        metadata_type: u32,
243        metadata_specifications: *mut c_void,
244        format_description_out: *mut *mut c_void,
245    ) -> i32;
246    /// Swift bridge function `cm_metadata_format_description_create_with_description_and_metadata_specifications` for the corresponding Apple API.
247    pub fn cm_metadata_format_description_create_with_description_and_metadata_specifications(
248        source_description: *mut c_void,
249        metadata_specifications: *mut c_void,
250        format_description_out: *mut *mut c_void,
251    ) -> i32;
252    /// Swift bridge function `cm_metadata_format_description_create_by_merging_descriptions` for the corresponding Apple API.
253    pub fn cm_metadata_format_description_create_by_merging_descriptions(
254        source_description: *mut c_void,
255        other_source_description: *mut c_void,
256        format_description_out: *mut *mut c_void,
257    ) -> i32;
258    /// Swift bridge function `cm_metadata_format_description_get_identifiers` for the corresponding Apple API.
259    pub fn cm_metadata_format_description_get_identifiers(
260        format_description: *mut c_void,
261    ) -> *mut c_void;
262    /// Swift bridge function `cm_metadata_format_description_get_key_with_local_id` for the corresponding Apple API.
263    pub fn cm_metadata_format_description_get_key_with_local_id(
264        format_description: *mut c_void,
265        local_id: u32,
266    ) -> *mut c_void;
267    /// Swift bridge function `cm_metadata_format_description_extension_key_metadata_key_table` for the corresponding Apple API.
268    pub fn cm_metadata_format_description_extension_key_metadata_key_table() -> *mut c_void;
269    /// Swift bridge function `cm_metadata_format_description_key_conforming_data_types` for the corresponding Apple API.
270    pub fn cm_metadata_format_description_key_conforming_data_types() -> *mut c_void;
271    /// Swift bridge function `cm_metadata_format_description_key_data_type` for the corresponding Apple API.
272    pub fn cm_metadata_format_description_key_data_type() -> *mut c_void;
273    /// Swift bridge function `cm_metadata_format_description_key_data_type_namespace` for the corresponding Apple API.
274    pub fn cm_metadata_format_description_key_data_type_namespace() -> *mut c_void;
275    /// Swift bridge function `cm_metadata_format_description_key_language_tag` for the corresponding Apple API.
276    pub fn cm_metadata_format_description_key_language_tag() -> *mut c_void;
277    /// Swift bridge function `cm_metadata_format_description_key_local_id` for the corresponding Apple API.
278    pub fn cm_metadata_format_description_key_local_id() -> *mut c_void;
279    /// Swift bridge function `cm_metadata_format_description_key_namespace` for the corresponding Apple API.
280    pub fn cm_metadata_format_description_key_namespace() -> *mut c_void;
281    /// Swift bridge function `cm_metadata_format_description_key_setup_data` for the corresponding Apple API.
282    pub fn cm_metadata_format_description_key_setup_data() -> *mut c_void;
283    /// Swift bridge function `cm_metadata_format_description_key_structural_dependency` for the corresponding Apple API.
284    pub fn cm_metadata_format_description_key_structural_dependency() -> *mut c_void;
285    /// Swift bridge function `cm_metadata_format_description_key_value` for the corresponding Apple API.
286    pub fn cm_metadata_format_description_key_value() -> *mut c_void;
287    /// Swift bridge function `cm_metadata_format_description_metadata_specification_key_data_type` for the corresponding Apple API.
288    pub fn cm_metadata_format_description_metadata_specification_key_data_type() -> *mut c_void;
289    /// Swift bridge function `cm_metadata_format_description_metadata_specification_key_extended_language_tag` for the corresponding Apple API.
290    pub fn cm_metadata_format_description_metadata_specification_key_extended_language_tag(
291    ) -> *mut c_void;
292    /// Swift bridge function `cm_metadata_format_description_metadata_specification_key_identifier` for the corresponding Apple API.
293    pub fn cm_metadata_format_description_metadata_specification_key_identifier() -> *mut c_void;
294    /// Swift bridge function `cm_metadata_format_description_metadata_specification_key_setup_data` for the corresponding Apple API.
295    pub fn cm_metadata_format_description_metadata_specification_key_setup_data() -> *mut c_void;
296    /// Swift bridge function `cm_metadata_format_description_metadata_specification_key_structural_dependency` for the corresponding Apple API.
297    pub fn cm_metadata_format_description_metadata_specification_key_structural_dependency(
298    ) -> *mut c_void;
299    /// Swift bridge function `cm_metadata_format_description_structural_dependency_key_dependency_is_invalid_flag` for the corresponding Apple API.
300    pub fn cm_metadata_format_description_structural_dependency_key_dependency_is_invalid_flag(
301    ) -> *mut c_void;
302
303    // ---- CVPixelBuffer ----
304    /// Swift bridge function `cv_pixel_buffer_release` for the corresponding Apple API.
305    pub fn cv_pixel_buffer_release(pixel_buffer: *mut c_void);
306    /// Swift bridge function `cv_pixel_buffer_retain` for the corresponding Apple API.
307    pub fn cv_pixel_buffer_retain(pixel_buffer: *mut c_void) -> *mut c_void;
308    /// Swift bridge function `cv_pixel_buffer_hash` for the corresponding Apple API.
309    pub fn cv_pixel_buffer_hash(pixel_buffer: *mut c_void) -> usize;
310    /// Swift bridge function `cv_pixel_buffer_get_type_id` for the corresponding Apple API.
311    pub fn cv_pixel_buffer_get_type_id() -> usize;
312    /// Swift bridge function `cv_pixel_buffer_get_width` for the corresponding Apple API.
313    pub fn cv_pixel_buffer_get_width(pixel_buffer: *mut c_void) -> usize;
314    /// Swift bridge function `cv_pixel_buffer_get_height` for the corresponding Apple API.
315    pub fn cv_pixel_buffer_get_height(pixel_buffer: *mut c_void) -> usize;
316    /// Swift bridge function `cv_pixel_buffer_get_pixel_format_type` for the corresponding Apple API.
317    pub fn cv_pixel_buffer_get_pixel_format_type(pixel_buffer: *mut c_void) -> u32;
318    /// Swift bridge function `cv_pixel_buffer_get_bytes_per_row` for the corresponding Apple API.
319    pub fn cv_pixel_buffer_get_bytes_per_row(pixel_buffer: *mut c_void) -> usize;
320    /// Swift bridge function `cv_pixel_buffer_get_data_size` for the corresponding Apple API.
321    pub fn cv_pixel_buffer_get_data_size(pixel_buffer: *mut c_void) -> usize;
322    /// Swift bridge function `cv_pixel_buffer_is_planar` for the corresponding Apple API.
323    pub fn cv_pixel_buffer_is_planar(pixel_buffer: *mut c_void) -> bool;
324    /// Swift bridge function `cv_pixel_buffer_get_plane_count` for the corresponding Apple API.
325    pub fn cv_pixel_buffer_get_plane_count(pixel_buffer: *mut c_void) -> usize;
326    /// Swift bridge function `cv_pixel_buffer_get_width_of_plane` for the corresponding Apple API.
327    pub fn cv_pixel_buffer_get_width_of_plane(
328        pixel_buffer: *mut c_void,
329        plane_index: usize,
330    ) -> usize;
331    /// Swift bridge function `cv_pixel_buffer_get_height_of_plane` for the corresponding Apple API.
332    pub fn cv_pixel_buffer_get_height_of_plane(
333        pixel_buffer: *mut c_void,
334        plane_index: usize,
335    ) -> usize;
336    /// Swift bridge function `cv_pixel_buffer_get_bytes_per_row_of_plane` for the corresponding Apple API.
337    pub fn cv_pixel_buffer_get_bytes_per_row_of_plane(
338        pixel_buffer: *mut c_void,
339        plane_index: usize,
340    ) -> usize;
341    /// Swift bridge function `cv_pixel_buffer_get_base_address_of_plane` for the corresponding Apple API.
342    pub fn cv_pixel_buffer_get_base_address_of_plane(
343        pixel_buffer: *mut c_void,
344        plane_index: usize,
345    ) -> *mut c_void;
346    /// Swift bridge function `cv_pixel_buffer_get_base_address` for the corresponding Apple API.
347    pub fn cv_pixel_buffer_get_base_address(pixel_buffer: *mut c_void) -> *mut c_void;
348    /// Swift bridge function `cv_pixel_buffer_lock_base_address` for the corresponding Apple API.
349    pub fn cv_pixel_buffer_lock_base_address(pixel_buffer: *mut c_void, flags: u32) -> i32;
350    /// Swift bridge function `cv_pixel_buffer_unlock_base_address` for the corresponding Apple API.
351    pub fn cv_pixel_buffer_unlock_base_address(pixel_buffer: *mut c_void, flags: u32) -> i32;
352    /// Swift bridge function `cv_pixel_buffer_get_io_surface` for the corresponding Apple API.
353    pub fn cv_pixel_buffer_get_io_surface(pixel_buffer: *mut c_void) -> *mut c_void;
354    /// Swift bridge function `cv_pixel_buffer_get_extended_pixels` for the corresponding Apple API.
355    pub fn cv_pixel_buffer_get_extended_pixels(
356        pixel_buffer: *mut c_void,
357        extra_columns_on_left: *mut usize,
358        extra_columns_on_right: *mut usize,
359        extra_rows_on_top: *mut usize,
360        extra_rows_on_bottom: *mut usize,
361    );
362    /// Swift bridge function `cv_pixel_buffer_fill_extended_pixels` for the corresponding Apple API.
363    pub fn cv_pixel_buffer_fill_extended_pixels(pixel_buffer: *mut c_void) -> i32;
364    /// Swift bridge function `cv_pixel_buffer_create` for the corresponding Apple API.
365    pub fn cv_pixel_buffer_create(
366        width: usize,
367        height: usize,
368        pixel_format_type: u32,
369        pixel_buffer_out: *mut *mut c_void,
370    ) -> i32;
371    /// Swift bridge function `cv_pixel_buffer_create_with_bytes` for the corresponding Apple API.
372    pub fn cv_pixel_buffer_create_with_bytes(
373        width: usize,
374        height: usize,
375        pixel_format_type: u32,
376        base_address: *mut c_void,
377        bytes_per_row: usize,
378        pixel_buffer_out: *mut *mut c_void,
379    ) -> i32;
380    /// Swift bridge function `cv_pixel_buffer_create_with_planar_bytes` for the corresponding Apple API.
381    pub fn cv_pixel_buffer_create_with_planar_bytes(
382        width: usize,
383        height: usize,
384        pixel_format_type: u32,
385        num_planes: usize,
386        plane_base_addresses: *const *mut c_void,
387        plane_widths: *const usize,
388        plane_heights: *const usize,
389        plane_bytes_per_row: *const usize,
390        pixel_buffer_out: *mut *mut c_void,
391    ) -> i32;
392    /// Swift bridge function `cv_pixel_buffer_create_with_io_surface` for the corresponding Apple API.
393    pub fn cv_pixel_buffer_create_with_io_surface(
394        io_surface: *mut c_void,
395        pixel_buffer_out: *mut *mut c_void,
396    ) -> i32;
397
398    // ---- CVPixelBufferPool ----
399    /// Swift bridge function `cv_pixel_buffer_pool_release` for the corresponding Apple API.
400    pub fn cv_pixel_buffer_pool_release(pool: *mut c_void);
401    /// Swift bridge function `cv_pixel_buffer_pool_retain` for the corresponding Apple API.
402    pub fn cv_pixel_buffer_pool_retain(pool: *mut c_void) -> *mut c_void;
403    /// Swift bridge function `cv_pixel_buffer_pool_hash` for the corresponding Apple API.
404    pub fn cv_pixel_buffer_pool_hash(pool: *mut c_void) -> usize;
405    /// Swift bridge function `cv_pixel_buffer_pool_get_type_id` for the corresponding Apple API.
406    pub fn cv_pixel_buffer_pool_get_type_id() -> usize;
407    /// Swift bridge function `cv_pixel_buffer_pool_create` for the corresponding Apple API.
408    pub fn cv_pixel_buffer_pool_create(
409        width: usize,
410        height: usize,
411        pixel_format_type: u32,
412        max_buffers: usize,
413        pool_out: *mut *mut c_void,
414    ) -> i32;
415    /// Swift bridge function `cv_pixel_buffer_pool_create_pixel_buffer` for the corresponding Apple API.
416    pub fn cv_pixel_buffer_pool_create_pixel_buffer(
417        pool: *mut c_void,
418        pixel_buffer_out: *mut *mut c_void,
419    ) -> i32;
420    /// Swift bridge function `cv_pixel_buffer_pool_flush` for the corresponding Apple API.
421    pub fn cv_pixel_buffer_pool_flush(pool: *mut c_void);
422    /// Swift bridge function `cv_pixel_buffer_pool_get_attributes` for the corresponding Apple API.
423    pub fn cv_pixel_buffer_pool_get_attributes(pool: *mut c_void) -> *const c_void;
424    /// Swift bridge function `cv_pixel_buffer_pool_get_pixel_buffer_attributes` for the corresponding Apple API.
425    pub fn cv_pixel_buffer_pool_get_pixel_buffer_attributes(pool: *mut c_void) -> *const c_void;
426}