forked from svtlabs/screencapturekit-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
use crate::macros::declare_object; | ||
use crate::{ | ||
macros::declare_ref_type, | ||
os_types::base::{Boolean, CVPixelBufferLockFlags, CVReturn, SizeT, VoidPtr}, | ||
}; | ||
|
||
declare_object!(CVPixelBufferRef); | ||
declare_ref_type!(CVPixelBufferRef); | ||
|
||
impl CVPixelBufferRef { | ||
pub fn is_planar(&self) -> bool { | ||
unsafe { CVPixelBufferIsPlanar(self) == 1 } | ||
} | ||
pub fn get_base_address(&self) -> VoidPtr { | ||
unsafe { CVPixelBufferGetBaseAddress(self) } | ||
} | ||
pub fn get_base_address_of_plane(&self, plane_index: SizeT) -> VoidPtr { | ||
unsafe { CVPixelBufferGetBaseAddressOfPlane(self, plane_index) } | ||
} | ||
pub fn lock_base_address(&self, lock_flags: CVPixelBufferLockFlags) -> CVReturn { | ||
unsafe { CVPixelBufferLockBaseAddress(self, lock_flags) } | ||
} | ||
pub fn unlock_base_address(&self, lock_flags: CVPixelBufferLockFlags) -> CVReturn { | ||
unsafe { CVPixelBufferUnlockBaseAddress(self, lock_flags) } | ||
} | ||
} | ||
|
||
extern "C" { | ||
pub static kCVPixelBufferLock_ReadOnly: CVPixelBufferLockFlags; | ||
fn CVPixelBufferGetBaseAddress(pixel_buf: *const CVPixelBufferRef) -> VoidPtr; | ||
fn CVPixelBufferGetBaseAddressOfPlane( | ||
pixel_buf: *const CVPixelBufferRef, | ||
plane_index: SizeT, | ||
) -> VoidPtr; | ||
fn CVPixelBufferIsPlanar(pixel_buf: *const CVPixelBufferRef) -> Boolean; | ||
fn CVPixelBufferLockBaseAddress( | ||
pixel_buf: *const CVPixelBufferRef, | ||
lock_flags: CVPixelBufferLockFlags, | ||
) -> CVReturn; | ||
fn CVPixelBufferUnlockBaseAddress( | ||
pixel_buf: *const CVPixelBufferRef, | ||
lock_flags: CVPixelBufferLockFlags, | ||
) -> CVReturn; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use screencapturekit_sys::{cv_pixel_buffer_ref::CVPixelBufferRef, os_types::rc::ShareId}; | ||
|
||
struct CVPixelBuffer { | ||
pub is_planar: bool, | ||
pub num_planes: usize, | ||
unsafe_ref: ShareId<CVPixelBufferRef>, | ||
} | ||
|
||
impl CVPixelBuffer { | ||
pub fn new(unsafe_ref: ShareId<CVPixelBufferRef>) -> Self { | ||
let is_planar = unsafe_ref.is_planar(); | ||
Self { | ||
unsafe_ref, | ||
num_planes: 0, //unsafe_ref.num_planes(), | ||
is_planar, | ||
} | ||
} | ||
pub fn lock() -> bool { | ||
false | ||
} | ||
pub fn unlock() -> bool { | ||
false | ||
} | ||
pub fn get_base_adress() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters