From 3c22b3e3e2e39a2375da7723e898211c485219b5 Mon Sep 17 00:00:00 2001 From: Pranav2612000 Date: Sat, 11 Jan 2025 19:43:28 +0530 Subject: [PATCH] feat cv: add pixelbuffer api to get bytesPerRowOfPlane --- cidre/src/cv/pixel_buffer.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cidre/src/cv/pixel_buffer.rs b/cidre/src/cv/pixel_buffer.rs index ce14b38e..feddf685 100644 --- a/cidre/src/cv/pixel_buffer.rs +++ b/cidre/src/cv/pixel_buffer.rs @@ -61,6 +61,12 @@ impl PixelBuf { unsafe { CVPixelBufferGetBaseAddressOfPlane(self, plane_index) } } + #[doc(alias = "CVPixelBufferGetBytesPerRowOfPlane")] + #[inline] + pub fn plane_bytes_per_row(&self, plane_index: usize) -> usize { + unsafe { CVPixelBufferGetBytesPerRowOfPlane(self, plane_index) } + } + /// ``` /// use cidre::{cv, cg}; /// @@ -666,6 +672,7 @@ extern "C-unwind" { fn CVPixelBufferGetWidthOfPlane(pixel_buffer: &PixelBuf, plane_index: usize) -> usize; fn CVPixelBufferGetHeightOfPlane(pixel_buffer: &PixelBuf, plane_index: usize) -> usize; fn CVPixelBufferGetBaseAddressOfPlane(pixel_buffer: &PixelBuf, plane_index: usize) -> *const u8; + fn CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer: &PixelBuf, plane_index: usize) -> usize; fn CVPixelBufferLockBaseAddress(pixel_buffer: &PixelBuf, lock_flags: LockFlags) -> cv::Return; fn CVPixelBufferUnlockBaseAddress(pixel_buffer: &PixelBuf, lock_flags: LockFlags)