Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Dec 18, 2023
1 parent 50b3668 commit dfa779e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 11 additions & 9 deletions cidre/src/cm/block_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ impl BlockBuf {
flags: Flags,
structure_allocator: Option<&cf::Allocator>,
) -> Result<arc::R<BlockBuf>, os::Status> {
let mut block_buf_out = None;
unsafe {
let mut block_buf_out = None;
CMBlockBufferCreateEmpty(
structure_allocator,
sub_block_capacity,
Expand All @@ -99,20 +99,20 @@ impl BlockBuf {
/// ```
/// use cidre::cm;
///
/// let b = cm::BlockBuf::with_memory_block(10, None)
/// let b = cm::BlockBuf::with_mem_block(10, None)
/// .expect("empty block buffer");
///
/// assert_eq!(false, b.is_empty());
/// assert_eq!(10, b.data_len());
///
/// ```
#[inline]
pub fn with_memory_block(
pub fn with_mem_block(
len: usize,
block_allocator: Option<&cf::Allocator>,
) -> Result<arc::R<BlockBuf>, os::Status> {
unsafe {
Self::create_with_memory_block_in(
Self::create_with_mem_block_in(
std::ptr::null_mut(),
len,
block_allocator,
Expand All @@ -124,8 +124,9 @@ impl BlockBuf {
}
}

#[doc(alias = "CMBlockBufferCreateWithMemoryBlock")]
#[inline]
pub unsafe fn create_with_memory_block_in(
pub unsafe fn create_with_mem_block_in(
memory_block: *mut c_void,
block_length: usize,
block_allocator: Option<&cf::Allocator>,
Expand Down Expand Up @@ -180,6 +181,7 @@ impl BlockBuf {
/// blocks (a noncontiguous cm::BlockBuf). The data pointer returned will remain valid as long as the
/// original cm::BlockBuf is referenced - once the cm::BlockBuf is released for the last time, any pointers
/// into it will be invalid.
#[doc(alias = "CMBlockBufferGetDataPointer")]
#[inline]
pub unsafe fn get_data_ptr(
&self,
Expand Down Expand Up @@ -260,15 +262,15 @@ impl BlockBuf {
}

#[inline]
pub fn with_buf_reference(
pub fn with_buf_ref(
buf_reference: &BlockBuf,
offset_to_data: usize,
data_length: usize,
flags: Flags,
) -> Result<arc::R<BlockBuf>, os::Status> {
unsafe {
let mut block_buf_out = None;
Self::create_with_buf_reference(
Self::create_with_buf_ref(
None,
buf_reference,
offset_to_data,
Expand All @@ -281,7 +283,7 @@ impl BlockBuf {
}

#[inline]
pub unsafe fn create_with_buf_reference(
pub unsafe fn create_with_buf_ref(
structure_allocator: Option<&cf::Allocator>,
buf_reference: &BlockBuf,
offset_to_data: usize,
Expand All @@ -306,7 +308,7 @@ impl BlockBuf {
/// for any constituent memory blocks that are not yet allocated.
#[doc(alias = "CMBlockBufferAssureBlockMemory")]
#[inline]
pub fn assure_block_memory(&mut self) -> Result<(), os::Status> {
pub fn assure_block_mem(&mut self) -> Result<(), os::Status> {
unsafe { CMBlockBufferAssureBlockMemory(self).result() }
}
}
Expand Down
3 changes: 1 addition & 2 deletions cidre/src/cv/image_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{arc, cf, cg, cv};
pub type ImageBuf = cv::Buf;

impl ImageBuf {
/// Returns the full encoded dimensions of a cv::ImageBuf. For example, for an NTSC DV frame this would be 720x480
/// Returns the full encoded dimensions of a ['cv::ImageBuf']. For example, for an NTSC DV frame this would be 720x480
///
/// Example:
/// ```
Expand Down Expand Up @@ -445,7 +445,6 @@ pub mod attachment {
}

#[doc(alias = "kCVImageBufferTransferFunction_Linear")]
#[inline]
pub fn linear() -> &'static cf::String {
unsafe { kCVImageBufferTransferFunction_Linear }
}
Expand Down

0 comments on commit dfa779e

Please # to comment.