Skip to main content

Module ffi

Module ffi 

Source
Expand description

Swift FFI bridge to ScreenCaptureKit

Structs§

FFIApplicationData
Packed application data for batch retrieval
FFIDisplayData
Packed display data for batch retrieval (48 bytes)
FFIRect
Packed CGRect for efficient FFI transfer (32 bytes)
FFIWindowData
Packed window data for batch retrieval

Functions§

cgimage_free_data⚠
cgimage_get_data⚠
cgimage_get_height⚠
cgimage_get_width⚠
cgimage_release⚠
cgimage_render_bgra_into⚠
Render the CGImage directly as BGRA (the source pixel layout for every ScreenCaptureKit-produced CGImage). Saves the per-pixel channel-swap that cgimage_render_rgba_into forces — measured at ~20 ms per 4K screenshot. Use when the consumer (Metal, wgpu, ffmpeg) accepts BGRA natively.
cgimage_render_bgra_into_strided⚠
Strided BGRA variant. See cgimage_render_bgra_into and cgimage_render_rgba_into_strided.
cgimage_render_rgba_into⚠
Render the CGImage’s RGBA bytes directly into a caller-owned buffer. Returns the number of bytes written (= widthheight4) on success, or 0 on failure. Replaces the legacy cgimage_get_data + cgimage_free_data pair which made an extra Swift-side malloc + memcpy before handing the buffer back; this single-call form lets Rust own the allocation and removes one full RGBA-sized memcpy from the screenshot decode path.
cgimage_render_rgba_into_strided⚠
Strided variant of cgimage_render_rgba_into: renders RGBA bytes using a caller-specified row stride (dest_bytes_per_row) instead of the tightly-packed width * 4. Lets consumers with row-aligned/padded buffers (GPU upload, wgpu) avoid an extra repack. Returns the number of bytes spanned (height * dest_bytes_per_row) on success, or 0 on failure (stride too small or buffer too small).
cgimage_save_png⚠
cgimage_save_to_file⚠
cv_pixel_buffer_get_iosurface⚠
cv_pixel_buffer_is_backed_by_iosurface⚠
dispatch_queue_release⚠
dispatch_queue_retain⚠
io_surface_create⚠
io_surface_create_with_properties⚠
iosurface_get_base_address⚠
iosurface_get_bytes_per_row⚠
iosurface_get_bytes_per_row_of_plane⚠
iosurface_get_height⚠
iosurface_get_height_of_plane⚠
iosurface_get_pixel_format⚠
iosurface_get_plane_count⚠
iosurface_get_width⚠
iosurface_get_width_of_plane⚠
iosurface_is_in_use⚠
iosurface_lock⚠
iosurface_release⚠
iosurface_unlock⚠
sc_audio_get_default_input_device_id⚠
Get the default audio input device ID into buffer
sc_audio_get_default_input_device_name⚠
Get the default audio input device name into buffer
sc_audio_get_input_device_count⚠
Get the count of available audio input devices
sc_audio_get_input_device_id⚠
Get audio input device ID at index into buffer
sc_audio_get_input_device_name⚠
Get audio input device name at index into buffer
sc_audio_input_devices_snapshot_count⚠
sc_audio_input_devices_snapshot_create⚠
sc_audio_input_devices_snapshot_default_index⚠
sc_audio_input_devices_snapshot_id_owned⚠
sc_audio_input_devices_snapshot_is_default⚠
sc_audio_input_devices_snapshot_name_owned⚠
sc_audio_input_devices_snapshot_release⚠
sc_audio_is_default_input_device⚠
Check if the device at index is the default audio input device
sc_content_filter_create_with_desktop_independent_window⚠
sc_content_filter_create_with_display_excluding_applications_excepting_windows⚠
sc_content_filter_create_with_display_excluding_windows⚠
sc_content_filter_create_with_display_including_applications_excepting_windows⚠
sc_content_filter_create_with_display_including_windows⚠
sc_content_filter_get_content_rect⚠
sc_content_filter_get_content_rect_packed⚠
Get content filter content rect (same as sc_content_filter_get_content_rect)
sc_content_filter_get_include_menu_bar⚠
sc_content_filter_get_included_application_at⚠
sc_content_filter_get_included_applications_count⚠
sc_content_filter_get_included_display_at⚠
sc_content_filter_get_included_displays_count⚠
sc_content_filter_get_included_window_at⚠
sc_content_filter_get_included_windows_count⚠
sc_content_filter_get_point_pixel_scale⚠
sc_content_filter_get_stream_type⚠
sc_content_filter_get_style⚠
sc_content_filter_release⚠
sc_content_filter_retain⚠
sc_content_filter_set_include_menu_bar⚠
sc_content_sharing_picker_add_observer⚠
Register a repeating observer. Returns a non-zero token, or 0 on failure.
sc_content_sharing_picker_configuration_copy⚠
sc_content_sharing_picker_configuration_create⚠
sc_content_sharing_picker_configuration_get_allowed_picker_modes_mask⚠
sc_content_sharing_picker_configuration_get_allows_changing_selected_content⚠
sc_content_sharing_picker_configuration_get_excluded_bundle_id_at⚠
sc_content_sharing_picker_configuration_get_excluded_bundle_ids_count⚠
sc_content_sharing_picker_configuration_get_excluded_window_id_at⚠
sc_content_sharing_picker_configuration_get_excluded_window_ids_count⚠
sc_content_sharing_picker_configuration_release⚠
sc_content_sharing_picker_configuration_retain⚠
sc_content_sharing_picker_configuration_set_allowed_picker_modes⚠
sc_content_sharing_picker_configuration_set_allows_changing_selected_content⚠
sc_content_sharing_picker_configuration_set_excluded_bundle_ids⚠
sc_content_sharing_picker_configuration_set_excluded_window_ids⚠
sc_content_sharing_picker_create_default_configuration⚠
Returns a fresh SCContentSharingPickerConfiguration initialised with the system’s defaultConfiguration baseline. Caller owns the returned configuration and must release it via the standard sc_content_sharing_picker_configuration_release.
sc_content_sharing_picker_deactivate⚠
Deactivate the picker and undo any activation-policy promotion.
sc_content_sharing_picker_get_active⚠
Read whether the shared content-sharing picker is currently active.
sc_content_sharing_picker_get_maximum_stream_count⚠
sc_content_sharing_picker_is_available⚠
sc_content_sharing_picker_present⚠
Present the picker. style < 0 presents without a content-style hint.
sc_content_sharing_picker_present_for_stream⚠
Present the picker targeting an existing stream.
sc_content_sharing_picker_remove_all_observers⚠
Remove every repeating observer; returns how many were removed.
sc_content_sharing_picker_remove_observer⚠
Remove a repeating observer by token. Returns true if it was live.
sc_content_sharing_picker_set_active⚠
Mark the shared content-sharing picker active or inactive.
sc_content_sharing_picker_set_configuration_for_stream⚠
Assign (or clear, when config is null) the per-stream configuration. Returns false without enqueueing work when called off the main thread.
sc_content_sharing_picker_set_default_configuration⚠
Assign the picker’s process-wide defaultConfiguration. Returns false without enqueueing work when called off the main thread.
sc_content_sharing_picker_set_maximum_stream_count⚠
sc_content_sharing_picker_show⚠
sc_content_sharing_picker_show_for_stream⚠
sc_content_sharing_picker_show_for_stream_using_style⚠
sc_content_sharing_picker_show_using_style⚠
sc_content_sharing_picker_show_with_result⚠
sc_display_get_display_id⚠
sc_display_get_frame⚠
sc_display_get_frame_packed⚠
Get display frame (same as sc_display_get_frame, kept for API compatibility)
sc_display_get_height⚠
sc_display_get_width⚠
sc_display_release⚠
sc_display_retain⚠
sc_free_string⚠
Free a string allocated by Swift (strdup)
sc_initialize_core_graphics⚠
Force CoreGraphics initialization by calling CGMainDisplayID This prevents CGS_REQUIRE_INIT crashes on headless systems
sc_picker_result_get_application_at⚠
sc_picker_result_get_applications_count⚠
sc_picker_result_get_content_rect⚠
sc_picker_result_get_display_at⚠
sc_picker_result_get_displays_count⚠
sc_picker_result_get_filter⚠
sc_picker_result_get_scale⚠
sc_picker_result_get_window_at⚠
sc_picker_result_get_windows_count⚠
sc_picker_result_release⚠
sc_recording_output_configuration_copy⚠
sc_recording_output_configuration_create⚠
sc_recording_output_configuration_get_available_output_file_type_at⚠
sc_recording_output_configuration_get_available_output_file_type_identifier_at_owned⚠
sc_recording_output_configuration_get_available_output_file_types_count⚠
sc_recording_output_configuration_get_available_video_codec_at⚠
sc_recording_output_configuration_get_available_video_codec_identifier_at_owned⚠
sc_recording_output_configuration_get_available_video_codecs_count⚠
sc_recording_output_configuration_get_output_file_type⚠
sc_recording_output_configuration_get_output_file_type_identifier_owned⚠
sc_recording_output_configuration_get_output_path_owned⚠
sc_recording_output_configuration_get_output_url⚠
sc_recording_output_configuration_get_video_codec⚠
sc_recording_output_configuration_get_video_codec_identifier_owned⚠
sc_recording_output_configuration_release⚠
sc_recording_output_configuration_retain⚠
sc_recording_output_configuration_set_output_file_type⚠
sc_recording_output_configuration_set_output_file_type_identifier⚠
sc_recording_output_configuration_set_output_url⚠
sc_recording_output_configuration_set_video_codec⚠
sc_recording_output_configuration_set_video_codec_identifier⚠
sc_recording_output_create⚠
sc_recording_output_create_with_delegate⚠
sc_recording_output_get_recorded_duration⚠
sc_recording_output_get_recorded_file_size⚠
sc_recording_output_is_available⚠
sc_recording_output_release⚠
sc_recording_output_retain⚠
sc_recording_output_wait_until_terminal⚠
sc_running_application_get_application_name⚠
sc_running_application_get_application_name_owned⚠
Get application name as owned string (caller must free with sc_free_string)
sc_running_application_get_bundle_identifier⚠
sc_running_application_get_bundle_identifier_owned⚠
Get bundle identifier as owned string (caller must free with sc_free_string)
sc_running_application_get_process_id⚠
sc_running_application_release⚠
sc_running_application_retain⚠
sc_screenshot_configuration_clear_file_url⚠
sc_screenshot_configuration_create⚠
sc_screenshot_configuration_get_content_type⚠
sc_screenshot_configuration_get_destination_rect⚠
sc_screenshot_configuration_get_display_intent⚠
sc_screenshot_configuration_get_dynamic_range⚠
sc_screenshot_configuration_get_file_path_owned⚠
sc_screenshot_configuration_get_height⚠
sc_screenshot_configuration_get_ignore_clipping⚠
sc_screenshot_configuration_get_ignore_shadows⚠
sc_screenshot_configuration_get_include_child_windows⚠
sc_screenshot_configuration_get_shows_cursor⚠
sc_screenshot_configuration_get_source_rect⚠
sc_screenshot_configuration_get_supported_content_type_at⚠
sc_screenshot_configuration_get_supported_content_types_count⚠
sc_screenshot_configuration_get_width⚠
sc_screenshot_configuration_release⚠
sc_screenshot_configuration_set_content_type⚠
sc_screenshot_configuration_set_destination_rect⚠
sc_screenshot_configuration_set_display_intent⚠
sc_screenshot_configuration_set_dynamic_range⚠
sc_screenshot_configuration_set_file_url⚠
sc_screenshot_configuration_set_height⚠
sc_screenshot_configuration_set_ignore_clipping⚠
sc_screenshot_configuration_set_ignore_shadows⚠
sc_screenshot_configuration_set_include_child_windows⚠
sc_screenshot_configuration_set_shows_cursor⚠
sc_screenshot_configuration_set_source_rect⚠
sc_screenshot_configuration_set_width⚠
sc_screenshot_manager_capture_image⚠
sc_screenshot_manager_capture_image_in_rect⚠
sc_screenshot_manager_capture_sample_buffer⚠
sc_screenshot_manager_capture_screenshot⚠
sc_screenshot_manager_capture_screenshot_in_rect⚠
sc_screenshot_output_get_file_path_owned⚠
sc_screenshot_output_get_file_url⚠
sc_screenshot_output_get_hdr_image⚠
sc_screenshot_output_get_sdr_image⚠
sc_screenshot_output_release⚠
sc_shareable_content_current_process_is_available⚠
sc_shareable_content_get⚠
sc_shareable_content_get_above_window⚠
sc_shareable_content_get_application_at⚠
sc_shareable_content_get_applications_batch⚠
sc_shareable_content_get_applications_count⚠
sc_shareable_content_get_below_window⚠
sc_shareable_content_get_current_process_displays⚠
sc_shareable_content_get_display_at⚠
sc_shareable_content_get_displays_batch⚠
sc_shareable_content_get_displays_count⚠
sc_shareable_content_get_window_at⚠
sc_shareable_content_get_windows_batch⚠
sc_shareable_content_get_windows_count⚠
sc_shareable_content_get_with_options⚠
Async callback-based shareable content retrieval with options
sc_shareable_content_info_for_filter⚠
sc_shareable_content_info_get_content_rect⚠
sc_shareable_content_info_get_content_rect_packed⚠
Get shareable content info rect (same as sc_shareable_content_info_get_content_rect)
sc_shareable_content_info_get_point_pixel_scale⚠
sc_shareable_content_info_get_style⚠
sc_shareable_content_info_release⚠
sc_shareable_content_info_retain⚠
sc_shareable_content_release⚠
sc_shareable_content_retain⚠
sc_stream_add_recording_output⚠
sc_stream_add_stream_output⚠
sc_stream_add_stream_output_with_queue⚠
sc_stream_configuration_copy⚠
sc_stream_configuration_create⚠
sc_stream_configuration_create_with_preset⚠
sc_stream_configuration_get_background_color⚠
sc_stream_configuration_get_capture_dynamic_range⚠
sc_stream_configuration_get_capture_resolution_type⚠
sc_stream_configuration_get_captures_audio⚠
sc_stream_configuration_get_captures_microphone⚠
sc_stream_configuration_get_captures_shadows_only⚠
sc_stream_configuration_get_channel_count⚠
sc_stream_configuration_get_color_matrix⚠
sc_stream_configuration_get_color_space_name⚠
sc_stream_configuration_get_destination_rect⚠
sc_stream_configuration_get_excludes_current_process_audio⚠
sc_stream_configuration_get_height⚠
sc_stream_configuration_get_ignore_global_clip_display⚠
sc_stream_configuration_get_ignore_global_clip_single_window⚠
sc_stream_configuration_get_ignores_shadow_display_configuration⚠
sc_stream_configuration_get_ignores_shadows_display⚠
sc_stream_configuration_get_ignores_shadows_single_window⚠
sc_stream_configuration_get_includes_child_windows⚠
sc_stream_configuration_get_microphone_capture_device_id⚠
sc_stream_configuration_get_minimum_frame_interval⚠
sc_stream_configuration_get_pixel_format⚠
sc_stream_configuration_get_presenter_overlay_privacy_alert_setting⚠
sc_stream_configuration_get_preserve_aspect_ratio⚠
sc_stream_configuration_get_preserves_aspect_ratio⚠
sc_stream_configuration_get_queue_depth⚠
sc_stream_configuration_get_sample_rate⚠
sc_stream_configuration_get_scales_to_fit⚠
sc_stream_configuration_get_should_be_opaque⚠
sc_stream_configuration_get_shows_cursor⚠
sc_stream_configuration_get_shows_mouse_clicks⚠
sc_stream_configuration_get_source_rect⚠
sc_stream_configuration_get_stream_name⚠
sc_stream_configuration_get_width⚠
sc_stream_configuration_release⚠
sc_stream_configuration_retain⚠
sc_stream_configuration_set_background_color⚠
sc_stream_configuration_set_capture_dynamic_range⚠
sc_stream_configuration_set_capture_resolution_type⚠
sc_stream_configuration_set_captures_audio⚠
sc_stream_configuration_set_captures_microphone⚠
sc_stream_configuration_set_captures_shadows_only⚠
sc_stream_configuration_set_channel_count⚠
sc_stream_configuration_set_color_matrix⚠
sc_stream_configuration_set_color_space_name⚠
sc_stream_configuration_set_destination_rect⚠
sc_stream_configuration_set_excludes_current_process_audio⚠
sc_stream_configuration_set_height⚠
sc_stream_configuration_set_ignore_global_clip_display⚠
sc_stream_configuration_set_ignore_global_clip_single_window⚠
sc_stream_configuration_set_ignores_shadow_display_configuration⚠
sc_stream_configuration_set_ignores_shadows_display⚠
sc_stream_configuration_set_ignores_shadows_single_window⚠
sc_stream_configuration_set_includes_child_windows⚠
sc_stream_configuration_set_microphone_capture_device_id⚠
sc_stream_configuration_set_minimum_frame_interval⚠
sc_stream_configuration_set_pixel_format⚠
sc_stream_configuration_set_presenter_overlay_privacy_alert_setting⚠
sc_stream_configuration_set_preserve_aspect_ratio⚠
sc_stream_configuration_set_preserves_aspect_ratio⚠
sc_stream_configuration_set_queue_depth⚠
sc_stream_configuration_set_sample_rate⚠
sc_stream_configuration_set_scales_to_fit⚠
sc_stream_configuration_set_should_be_opaque⚠
sc_stream_configuration_set_shows_cursor⚠
sc_stream_configuration_set_shows_mouse_clicks⚠
sc_stream_configuration_set_source_rect⚠
sc_stream_configuration_set_stream_name⚠
sc_stream_configuration_set_width⚠
sc_stream_create⚠
sc_stream_get_synchronization_clock⚠
sc_stream_release⚠
sc_stream_remove_recording_output⚠
sc_stream_remove_stream_output⚠
sc_stream_retain⚠
sc_stream_set_delegate_event_callback⚠
sc_stream_start_capture⚠
sc_stream_stop_capture⚠
sc_stream_update_configuration⚠
sc_stream_update_content_filter⚠
sc_verify_ffi_layout⚠
Cross-language ABI check implemented in the Swift bridge.
sc_window_get_frame⚠
sc_window_get_frame_packed⚠
Get window frame (same as sc_window_get_frame, kept for API compatibility)
sc_window_get_owning_application⚠
sc_window_get_title⚠
sc_window_get_title_owned⚠
Get window title as owned string (caller must free with sc_free_string)
sc_window_get_window_id⚠
sc_window_get_window_layer⚠
sc_window_is_active⚠
sc_window_is_on_screen⚠
sc_window_release⚠
sc_window_retain⚠