Skip to content

Commit

Permalink
Merge pull request #32 from Pranav2612000/feat/add-av-api-for-reading…
Browse files Browse the repository at this point in the history
…-videos

feat: add apis for reading videos
  • Loading branch information
yury authored Jan 11, 2025
2 parents 530e3d3 + 3c22b3e commit 7c09065
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cidre/src/av/asset/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
14 changes: 14 additions & 0 deletions cidre/src/cv/pixel_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ 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) }
}

#[doc(alias = "CVPixelBufferGetBytesPerRowOfPlane")]
#[inline]
pub fn plane_bytes_per_row(&self, plane_index: usize) -> usize {
unsafe { CVPixelBufferGetBytesPerRowOfPlane(self, plane_index) }
}

/// ```
/// use cidre::{cv, cg};
///
Expand Down Expand Up @@ -659,6 +671,8 @@ 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 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)
Expand Down

0 comments on commit 7c09065

Please # to comment.