forked from mirrors/gstreamer-rs
gstreamer-audio: Add bindings for AudioRingBufferSpec
Includes auto generated AudioRingBufferFormatType
This commit is contained in:
parent
da848d2946
commit
d3577ab2ae
5 changed files with 189 additions and 0 deletions
|
@ -27,6 +27,7 @@ generate = [
|
|||
"GstAudio.StreamVolumeFormat",
|
||||
"GstAudio.AudioSink",
|
||||
"GstAudio.AudioBaseSink",
|
||||
"GstAudio.AudioRingBufferFormatType",
|
||||
]
|
||||
|
||||
manual = [
|
||||
|
|
67
gstreamer-audio/src/audio_ring_buffer_spec.rs
Normal file
67
gstreamer-audio/src/audio_ring_buffer_spec.rs
Normal file
|
@ -0,0 +1,67 @@
|
|||
use glib::translate::*;
|
||||
use gst::Caps;
|
||||
use gst_audio_sys::GstAudioRingBufferSpec;
|
||||
|
||||
use AudioInfo;
|
||||
use AudioRingBufferFormatType;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct AudioRingBufferSpec(pub(crate) GstAudioRingBufferSpec);
|
||||
|
||||
impl AudioRingBufferSpec {
|
||||
pub fn get_type(&self) -> AudioRingBufferFormatType {
|
||||
AudioRingBufferFormatType::from_glib(self.0.type_)
|
||||
}
|
||||
|
||||
pub fn set_type(&mut self, value: AudioRingBufferFormatType) {
|
||||
self.0.type_ = value.to_glib();
|
||||
}
|
||||
|
||||
pub fn get_caps(&mut self) -> Caps {
|
||||
unsafe { Caps::from_glib_none(self.0.caps) }
|
||||
}
|
||||
|
||||
pub fn get_audio_info(&mut self) -> AudioInfo {
|
||||
unsafe { AudioInfo::from_glib_none(&mut self.0.info) }
|
||||
}
|
||||
|
||||
pub fn get_latency_time(&self) -> u64 {
|
||||
self.0.latency_time
|
||||
}
|
||||
|
||||
pub fn set_latency_time(&mut self, value: u64) {
|
||||
self.0.latency_time = value;
|
||||
}
|
||||
|
||||
pub fn get_buffer_time(&self) -> u64 {
|
||||
self.0.buffer_time
|
||||
}
|
||||
|
||||
pub fn set_buffer_time(&mut self, value: u64) {
|
||||
self.0.buffer_time = value;
|
||||
}
|
||||
|
||||
pub fn get_segsize(&self) -> i32 {
|
||||
self.0.segsize
|
||||
}
|
||||
|
||||
pub fn set_segsize(&mut self, value: i32) {
|
||||
self.0.segsize = value;
|
||||
}
|
||||
|
||||
pub fn get_segtotal(&self) -> i32 {
|
||||
self.0.segtotal
|
||||
}
|
||||
|
||||
pub fn set_segtotal(&mut self, value: i32) {
|
||||
self.0.segtotal = value;
|
||||
}
|
||||
|
||||
pub fn get_seglatency(&self) -> i32 {
|
||||
self.0.seglatency
|
||||
}
|
||||
|
||||
pub fn set_seglatency(&mut self, value: i32) {
|
||||
self.0.seglatency = value;
|
||||
}
|
||||
}
|
|
@ -396,6 +396,124 @@ impl SetValue for AudioLayout {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
pub enum AudioRingBufferFormatType {
|
||||
Raw,
|
||||
MuLaw,
|
||||
ALaw,
|
||||
ImaAdpcm,
|
||||
Mpeg,
|
||||
Gsm,
|
||||
Iec958,
|
||||
Ac3,
|
||||
Eac3,
|
||||
Dts,
|
||||
Mpeg2Aac,
|
||||
Mpeg4Aac,
|
||||
Mpeg2AacRaw,
|
||||
Mpeg4AacRaw,
|
||||
Flac,
|
||||
#[doc(hidden)]
|
||||
__Unknown(i32),
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl ToGlib for AudioRingBufferFormatType {
|
||||
type GlibType = gst_audio_sys::GstAudioRingBufferFormatType;
|
||||
|
||||
fn to_glib(&self) -> gst_audio_sys::GstAudioRingBufferFormatType {
|
||||
match *self {
|
||||
AudioRingBufferFormatType::Raw => gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW,
|
||||
AudioRingBufferFormatType::MuLaw => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW
|
||||
}
|
||||
AudioRingBufferFormatType::ALaw => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW
|
||||
}
|
||||
AudioRingBufferFormatType::ImaAdpcm => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM
|
||||
}
|
||||
AudioRingBufferFormatType::Mpeg => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG
|
||||
}
|
||||
AudioRingBufferFormatType::Gsm => gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM,
|
||||
AudioRingBufferFormatType::Iec958 => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958
|
||||
}
|
||||
AudioRingBufferFormatType::Ac3 => gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3,
|
||||
AudioRingBufferFormatType::Eac3 => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3
|
||||
}
|
||||
AudioRingBufferFormatType::Dts => gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS,
|
||||
AudioRingBufferFormatType::Mpeg2Aac => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC
|
||||
}
|
||||
AudioRingBufferFormatType::Mpeg4Aac => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC
|
||||
}
|
||||
AudioRingBufferFormatType::Mpeg2AacRaw => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW
|
||||
}
|
||||
AudioRingBufferFormatType::Mpeg4AacRaw => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW
|
||||
}
|
||||
AudioRingBufferFormatType::Flac => {
|
||||
gst_audio_sys::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC
|
||||
}
|
||||
AudioRingBufferFormatType::__Unknown(value) => value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl FromGlib<gst_audio_sys::GstAudioRingBufferFormatType> for AudioRingBufferFormatType {
|
||||
fn from_glib(value: gst_audio_sys::GstAudioRingBufferFormatType) -> Self {
|
||||
skip_assert_initialized!();
|
||||
match value {
|
||||
0 => AudioRingBufferFormatType::Raw,
|
||||
1 => AudioRingBufferFormatType::MuLaw,
|
||||
2 => AudioRingBufferFormatType::ALaw,
|
||||
3 => AudioRingBufferFormatType::ImaAdpcm,
|
||||
4 => AudioRingBufferFormatType::Mpeg,
|
||||
5 => AudioRingBufferFormatType::Gsm,
|
||||
6 => AudioRingBufferFormatType::Iec958,
|
||||
7 => AudioRingBufferFormatType::Ac3,
|
||||
8 => AudioRingBufferFormatType::Eac3,
|
||||
9 => AudioRingBufferFormatType::Dts,
|
||||
10 => AudioRingBufferFormatType::Mpeg2Aac,
|
||||
11 => AudioRingBufferFormatType::Mpeg4Aac,
|
||||
12 => AudioRingBufferFormatType::Mpeg2AacRaw,
|
||||
13 => AudioRingBufferFormatType::Mpeg4AacRaw,
|
||||
14 => AudioRingBufferFormatType::Flac,
|
||||
value => AudioRingBufferFormatType::__Unknown(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StaticType for AudioRingBufferFormatType {
|
||||
fn static_type() -> Type {
|
||||
unsafe { from_glib(gst_audio_sys::gst_audio_ring_buffer_format_type_get_type()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValueOptional<'a> for AudioRingBufferFormatType {
|
||||
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
|
||||
Some(FromValue::from_value(value))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValue<'a> for AudioRingBufferFormatType {
|
||||
unsafe fn from_value(value: &Value) -> Self {
|
||||
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
impl SetValue for AudioRingBufferFormatType {
|
||||
unsafe fn set_value(value: &mut Value, this: &Self) {
|
||||
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
pub enum StreamVolumeFormat {
|
||||
Linear,
|
||||
|
|
|
@ -30,6 +30,7 @@ mod enums;
|
|||
pub use self::enums::AudioChannelPosition;
|
||||
pub use self::enums::AudioFormat;
|
||||
pub use self::enums::AudioLayout;
|
||||
pub use self::enums::AudioRingBufferFormatType;
|
||||
pub use self::enums::StreamVolumeFormat;
|
||||
|
||||
mod flags;
|
||||
|
|
|
@ -43,6 +43,8 @@ mod audio_format;
|
|||
pub use audio_format::*;
|
||||
mod audio_format_info;
|
||||
pub use audio_format_info::*;
|
||||
mod audio_ring_buffer_spec;
|
||||
pub use audio_ring_buffer_spec::*;
|
||||
mod audio_info;
|
||||
pub use audio_info::*;
|
||||
mod audio_channel_position;
|
||||
|
|
Loading…
Reference in a new issue