forked from mirrors/gstreamer-rs
Add accessor for owned Buffer
to read-mapped AudioBuffer
/ MappedBuffer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1374>
This commit is contained in:
parent
92064a0c41
commit
e35782a3a4
3 changed files with 18 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use std::{fmt, marker::PhantomData, mem, ops, ptr, slice};
|
use std::{fmt, marker::PhantomData, mem, ops, ptr, slice};
|
||||||
|
|
||||||
use glib::translate::{from_glib, Borrowed, ToGlibPtr};
|
use glib::translate::*;
|
||||||
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
@ -200,6 +200,11 @@ impl AudioBuffer<Readable> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn buffer_owned(&self) -> gst::Buffer {
|
||||||
|
unsafe { from_glib_none(self.audio_buffer.buffer) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AudioBuffer<Writable> {
|
impl AudioBuffer<Writable> {
|
||||||
|
|
|
@ -1368,6 +1368,14 @@ impl<T> MappedBuffer<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl MappedBuffer<Readable> {
|
||||||
|
#[doc(alias = "get_buffer")]
|
||||||
|
#[inline]
|
||||||
|
pub fn buffer_owned(&self) -> Buffer {
|
||||||
|
self.buffer.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl MappedBuffer<Writable> {
|
impl MappedBuffer<Writable> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||||
|
|
|
@ -287,6 +287,10 @@ impl BufferCursor<Readable> {
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn buffer_owned(&self) -> Buffer {
|
||||||
|
self.buffer.as_ref().unwrap().clone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BufferCursor<Writable> {
|
impl BufferCursor<Writable> {
|
||||||
|
|
Loading…
Reference in a new issue