mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-20 17:16:39 +00:00
Some minor buffer changes
This commit is contained in:
parent
1751b5c400
commit
cef8d28974
1 changed files with 16 additions and 4 deletions
|
@ -264,8 +264,11 @@ impl Buffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn share(&self) -> Buffer {
|
pub fn copy(&self) -> Buffer {
|
||||||
unsafe { Buffer::new_from_ptr(self.raw) }
|
extern "C" {
|
||||||
|
fn gst_mini_object_copy(obj: *const c_void) -> *mut c_void;
|
||||||
|
}
|
||||||
|
unsafe { Buffer::new_from_ptr_owned(gst_mini_object_copy(self.raw)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn append(self, other: Buffer) -> Buffer {
|
pub fn append(self, other: Buffer) -> Buffer {
|
||||||
|
@ -583,13 +586,16 @@ impl Drop for Buffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl Sync for Buffer {}
|
||||||
|
unsafe impl Send for Buffer {}
|
||||||
|
|
||||||
impl Clone for Buffer {
|
impl Clone for Buffer {
|
||||||
fn clone(&self) -> Buffer {
|
fn clone(&self) -> Buffer {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn gst_mini_object_copy(obj: *const c_void) -> *mut c_void;
|
fn gst_mini_object_ref(obj: *mut c_void) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let raw = unsafe { gst_mini_object_copy(self.raw) };
|
let raw = unsafe { gst_mini_object_ref(self.raw) };
|
||||||
|
|
||||||
Buffer {
|
Buffer {
|
||||||
raw: raw,
|
raw: raw,
|
||||||
|
@ -672,6 +678,9 @@ impl Drop for ReadMappedBuffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl Sync for ReadMappedBuffer {}
|
||||||
|
unsafe impl Send for ReadMappedBuffer {}
|
||||||
|
|
||||||
impl ReadWriteMappedBuffer {
|
impl ReadWriteMappedBuffer {
|
||||||
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||||
unsafe { slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size) }
|
unsafe { slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size) }
|
||||||
|
@ -702,6 +711,9 @@ impl Drop for ReadWriteMappedBuffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl Sync for ReadWriteMappedBuffer {}
|
||||||
|
unsafe impl Send for ReadWriteMappedBuffer {}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct ScopedBufferPtr(*mut c_void);
|
pub struct ScopedBufferPtr(*mut c_void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue