Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2020-10-13 12:38:02 +0300
committerSebastian Dröge <sebastian@centricular.com>2020-10-13 12:56:49 +0300
commit48b9a5400b8311215a8bb5010125f83d390ccd25 (patch)
tree91fb5ec5eb168e7b1f6e8d81c85471e295fcde92 /audio
parent1e661e6d5b1d7eefa46f9bdcc59791b818a2abfc (diff)
Update byte-slice-cast dependency to 1.0
Diffstat (limited to 'audio')
-rw-r--r--audio/audiofx/Cargo.toml2
-rw-r--r--audio/claxon/Cargo.toml2
-rw-r--r--audio/claxon/src/claxondec.rs46
-rw-r--r--audio/csound/Cargo.toml2
-rw-r--r--audio/lewton/Cargo.toml2
5 files changed, 37 insertions, 17 deletions
diff --git a/audio/audiofx/Cargo.toml b/audio/audiofx/Cargo.toml
index d1c8ae8e1..a289b5b75 100644
--- a/audio/audiofx/Cargo.toml
+++ b/audio/audiofx/Cargo.toml
@@ -12,7 +12,7 @@ glib = { git = "https://github.com/gtk-rs/glib" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
-byte-slice-cast = "0.3"
+byte-slice-cast = "1.0"
num-traits = "0.2"
lazy_static = "1.0"
ebur128 = "0.1"
diff --git a/audio/claxon/Cargo.toml b/audio/claxon/Cargo.toml
index c0443785d..4baf2ce85 100644
--- a/audio/claxon/Cargo.toml
+++ b/audio/claxon/Cargo.toml
@@ -13,7 +13,7 @@ gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
claxon = { version = "0.4" }
-byte-slice-cast = "~0.3.4"
+byte-slice-cast = "1.0"
atomic_refcell = "0.1"
[lib]
diff --git a/audio/claxon/src/claxondec.rs b/audio/claxon/src/claxondec.rs
index 9ccfc25c8..34e1e99ea 100644
--- a/audio/claxon/src/claxondec.rs
+++ b/audio/claxon/src/claxondec.rs
@@ -301,7 +301,7 @@ impl ClaxonDec {
};
let depth_adjusted = depth.adjust_samples(v);
- let outbuf = gst::Buffer::from_slice(depth_adjusted);
+ let outbuf = gst::Buffer::from_mut_slice(depth_adjusted);
element.finish_frame(Some(outbuf), 1)
}
}
@@ -318,6 +318,32 @@ enum AudioDepth {
I32,
}
+enum ByteVec {
+ I8(Vec<i8>),
+ I16(Vec<i16>),
+ I32(Vec<i32>),
+}
+
+impl AsRef<[u8]> for ByteVec {
+ fn as_ref(&self) -> &[u8] {
+ match self {
+ ByteVec::I8(ref vec) => vec.as_byte_slice(),
+ ByteVec::I16(ref vec) => vec.as_byte_slice(),
+ ByteVec::I32(ref vec) => vec.as_byte_slice(),
+ }
+ }
+}
+
+impl AsMut<[u8]> for ByteVec {
+ fn as_mut(&mut self) -> &mut [u8] {
+ match self {
+ ByteVec::I8(ref mut vec) => vec.as_mut_byte_slice(),
+ ByteVec::I16(ref mut vec) => vec.as_mut_byte_slice(),
+ ByteVec::I32(ref mut vec) => vec.as_mut_byte_slice(),
+ }
+ }
+}
+
impl AudioDepth {
/// Validate input audio depth.
fn validate(input: u32) -> Result<Self, gst::FlowError> {
@@ -335,19 +361,13 @@ impl AudioDepth {
///
/// This takes a vector of 32bits samples, adjusts the depth of each,
/// and returns the adjusted bytes stream.
- fn adjust_samples(&self, input: Vec<i32>) -> Vec<u8> {
+ fn adjust_samples(&self, input: Vec<i32>) -> ByteVec {
match *self {
- AudioDepth::I8 => input
- .into_iter()
- .map(|x| x as i8)
- .collect::<Vec<_>>()
- .into_byte_vec(),
- AudioDepth::I16 => input
- .into_iter()
- .map(|x| x as i16)
- .collect::<Vec<_>>()
- .into_byte_vec(),
- AudioDepth::I24 | AudioDepth::I32 => input.into_byte_vec(),
+ AudioDepth::I8 => ByteVec::I8(input.into_iter().map(|x| x as i8).collect::<Vec<_>>()),
+ AudioDepth::I16 => {
+ ByteVec::I16(input.into_iter().map(|x| x as i16).collect::<Vec<_>>())
+ }
+ AudioDepth::I24 | AudioDepth::I32 => ByteVec::I32(input),
}
}
}
diff --git a/audio/csound/Cargo.toml b/audio/csound/Cargo.toml
index 933a44724..4393f3e3b 100644
--- a/audio/csound/Cargo.toml
+++ b/audio/csound/Cargo.toml
@@ -15,7 +15,7 @@ gst_audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org
gst_check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
csound = "0.1.8"
once_cell = "1.0"
-byte-slice-cast = "0.3"
+byte-slice-cast = "1.0"
[lib]
name = "gstcsound"
diff --git a/audio/lewton/Cargo.toml b/audio/lewton/Cargo.toml
index 5c0859113..bab708c37 100644
--- a/audio/lewton/Cargo.toml
+++ b/audio/lewton/Cargo.toml
@@ -13,7 +13,7 @@ gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
lewton = { version = "0.10", default-features = false }
-byte-slice-cast = "0.3"
+byte-slice-cast = "1.0"
atomic_refcell = "0.1"
lazy_static = "1.0"