pub struct IOSurface(/* private fields */);Expand description
Wrapper around IOSurface
IOSurface is a framebuffer object suitable for sharing across process boundaries.
ScreenCaptureKit uses IOSurface-backed CVPixelBuffers for efficient frame delivery.
Implementations§
Source§impl IOSurface
impl IOSurface
Sourcepub fn bytes_per_row(&self) -> usize
pub fn bytes_per_row(&self) -> usize
Get the number of bytes per row
Sourcepub fn pixel_format(&self) -> u32
pub fn pixel_format(&self) -> u32
Get the pixel format (OSType/FourCC)
Sourcepub unsafe fn base_address(&self) -> *mut u8
pub unsafe fn base_address(&self) -> *mut u8
Get the base address of the IOSurface buffer
Important: You must lock the IOSurface before accessing memory!
§Safety
The returned pointer is only valid while the IOSurface is locked.
Accessing unlocked memory or after unlock is undefined behavior.
Sourcepub fn lock(
&self,
options: IOSurfaceLockOptions,
) -> Result<IOSurfaceLockGuard<'_>, i32>
pub fn lock( &self, options: IOSurfaceLockOptions, ) -> Result<IOSurfaceLockGuard<'_>, i32>
Lock the IOSurface and get a guard for safe access
The surface will be automatically unlocked when the guard is dropped.
§Errors
Returns an IOSurface error code if the lock operation fails.
§Example
let guard = surface.lock(IOSurfaceLockOptions::ReadOnly)?;
let data = guard.as_slice();
// Use data...
// Surface is automatically unlocked when guard goes out of scopeTrait Implementations§
impl Eq for IOSurface
impl Send for IOSurface
impl Sync for IOSurface
Auto Trait Implementations§
impl Freeze for IOSurface
impl RefUnwindSafe for IOSurface
impl Unpin for IOSurface
impl UnwindSafe for IOSurface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more