From 86ae2bae9c3b2b73627c8a97cb846fbbf2058d2b Mon Sep 17 00:00:00 2001 From: Pranav2612000 Date: Sat, 11 Jan 2025 19:39:17 +0530 Subject: [PATCH 1/3] feat av: add AVAssetTrack temporal api to get timeRange --- cidre/src/av/asset/track.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cidre/src/av/asset/track.rs b/cidre/src/av/asset/track.rs index 12451ed7..7833a4c8 100644 --- a/cidre/src/av/asset/track.rs +++ b/cidre/src/av/asset/track.rs @@ -48,6 +48,12 @@ impl Track { pub fn has_media_characterisitc(&self, val: av::MediaCharacteristic) -> bool; } +/// AVAssetTrackPropertiesForTemporalInformation +impl Track { + #[objc::msg_send(timeRange)] + pub fn time_range(&self) -> cm::TimeRange; +} + /// AVAssetTrackPropertiesForVisualCharacteristic impl Track { #[objc::msg_send(naturalSize)] From 4132aaff6fd45d129d9bf7ea540e638b852a475c Mon Sep 17 00:00:00 2001 From: Pranav2612000 Date: Sat, 11 Jan 2025 19:42:43 +0530 Subject: [PATCH 2/3] feat cv: add pixelbuffer api to get plane base address --- 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 811f844d..ce14b38e 100644 --- a/cidre/src/cv/pixel_buffer.rs +++ b/cidre/src/cv/pixel_buffer.rs @@ -55,6 +55,12 @@ impl PixelBuf { unsafe { CVPixelBufferGetHeightOfPlane(self, plane_index) } } + #[doc(alias = "CVPixelBufferGetBaseAddressOfPlane")] + #[inline] + pub fn plane_base_address(&self, plane_index: usize) -> *const u8 { + unsafe { CVPixelBufferGetBaseAddressOfPlane(self, plane_index) } + } + /// ``` /// use cidre::{cv, cg}; /// @@ -659,6 +665,7 @@ extern "C-unwind" { fn CVPixelBufferGetPlaneCount(pixel_buffer: &PixelBuf) -> usize; 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 CVPixelBufferLockBaseAddress(pixel_buffer: &PixelBuf, lock_flags: LockFlags) -> cv::Return; fn CVPixelBufferUnlockBaseAddress(pixel_buffer: &PixelBuf, lock_flags: LockFlags) From 3c22b3e3e2e39a2375da7723e898211c485219b5 Mon Sep 17 00:00:00 2001 From: Pranav2612000 Date: Sat, 11 Jan 2025 19:43:28 +0530 Subject: [PATCH 3/3] 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)