mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
gstreamer-audio: Add Debug and Clone impls for AudioRingBufferSpec
This commit is contained in:
parent
df251de2a1
commit
9657f4ce78
1 changed files with 36 additions and 0 deletions
|
@ -5,6 +5,8 @@ use gst_audio_sys::GstAudioRingBufferSpec;
|
|||
use AudioInfo;
|
||||
use AudioRingBufferFormatType;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct AudioRingBufferSpec(pub(crate) GstAudioRingBufferSpec);
|
||||
|
||||
|
@ -65,3 +67,37 @@ impl AudioRingBufferSpec {
|
|||
self.0.seglatency = value;
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for AudioRingBufferSpec {
|
||||
fn clone(&self) -> Self {
|
||||
unsafe {
|
||||
let spec = self.0;
|
||||
gst_sys::gst_mini_object_ref(spec.caps as *mut gst_sys::GstMiniObject);
|
||||
|
||||
AudioRingBufferSpec(spec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for AudioRingBufferSpec {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
gst_sys::gst_mini_object_unref(self.0.caps as *mut gst_sys::GstMiniObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for AudioRingBufferSpec {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
f.debug_struct("AudioRingBufferSpec")
|
||||
.field("type", &self.get_type())
|
||||
.field("caps", &self.get_caps())
|
||||
.field("audio_info", &self.get_audio_info())
|
||||
.field("latency_time", &self.get_latency_time())
|
||||
.field("buffer_time", &self.get_buffer_time())
|
||||
.field("segsize", &self.get_segsize())
|
||||
.field("segtotal", &self.get_segtotal())
|
||||
.field("seglatency", &self.get_seglatency())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue