diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-11-22 14:16:10 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-11-22 20:34:25 +0300 |
commit | 684f52b7d4b262079d819bf61ddc287ae325151c (patch) | |
tree | 2d45650c14597a9e9ac735120519ee014d36153a | |
parent | 5f11c0d603bef970f6c206b6612aa3dc70f471d4 (diff) |
audio: Update to 2018 edition
-rw-r--r-- | audio/audiofx/Cargo.toml | 12 | ||||
-rw-r--r-- | audio/audiofx/src/audioecho/imp.rs | 12 | ||||
-rw-r--r-- | audio/audiofx/src/audioecho/mod.rs | 2 | ||||
-rw-r--r-- | audio/audiofx/src/audioloudnorm/imp.rs | 12 | ||||
-rw-r--r-- | audio/audiofx/src/audioloudnorm/mod.rs | 2 | ||||
-rw-r--r-- | audio/audiofx/src/audiornnoise/imp.rs | 12 | ||||
-rw-r--r-- | audio/audiofx/src/audiornnoise/mod.rs | 2 | ||||
-rw-r--r-- | audio/audiofx/src/lib.rs | 14 | ||||
-rw-r--r-- | audio/audiofx/tests/audioloudnorm.rs | 5 | ||||
-rw-r--r-- | audio/audiofx/tests/audiornnoise.rs | 5 | ||||
-rw-r--r-- | audio/claxon/Cargo.toml | 8 | ||||
-rw-r--r-- | audio/claxon/src/claxondec/imp.rs | 4 | ||||
-rw-r--r-- | audio/claxon/src/claxondec/mod.rs | 2 | ||||
-rw-r--r-- | audio/claxon/src/lib.rs | 9 | ||||
-rw-r--r-- | audio/claxon/tests/claxondec.rs | 6 | ||||
-rw-r--r-- | audio/csound/Cargo.toml | 8 | ||||
-rw-r--r-- | audio/lewton/Cargo.toml | 10 | ||||
-rw-r--r-- | audio/lewton/src/lewtondec/imp.rs | 13 | ||||
-rw-r--r-- | audio/lewton/src/lewtondec/mod.rs | 2 | ||||
-rw-r--r-- | audio/lewton/src/lib.rs | 11 | ||||
-rw-r--r-- | audio/lewton/tests/lewtondec.rs | 6 |
21 files changed, 62 insertions, 95 deletions
diff --git a/audio/audiofx/Cargo.toml b/audio/audiofx/Cargo.toml index 6a264e0f9..844607de7 100644 --- a/audio/audiofx/Cargo.toml +++ b/audio/audiofx/Cargo.toml @@ -9,12 +9,12 @@ edition = "2018" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -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" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } byte-slice-cast = "1.0" num-traits = "0.2" -lazy_static = "1.0" +once_cell = "1.0" ebur128 = "0.1" nnnoiseless = { version = "0.3", default-features = false } @@ -24,8 +24,8 @@ crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [dev-dependencies] -gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-app = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } [build-dependencies] gst-plugin-version-helper = { path="../../version-helper" } diff --git a/audio/audiofx/src/audioecho/imp.rs b/audio/audiofx/src/audioecho/imp.rs index e5ea51819..167c61aa1 100644 --- a/audio/audiofx/src/audioecho/imp.rs +++ b/audio/audiofx/src/audioecho/imp.rs @@ -8,6 +8,7 @@ use glib::subclass; use glib::subclass::prelude::*; +use gst::gst_loggable_error; use gst::prelude::*; use gst::subclass::prelude::*; use gst_base::subclass::prelude::*; @@ -20,13 +21,14 @@ use byte_slice_cast::*; use num_traits::cast::{FromPrimitive, ToPrimitive}; use num_traits::float::Float; -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +use once_cell::sync::Lazy; +static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new( "rsaudioecho", gst::DebugColorFlags::empty(), Some("Rust Audio Echo Filter"), - ); -} + ) +}); use super::ring_buffer::RingBuffer; @@ -136,7 +138,7 @@ impl ObjectSubclass for AudioEcho { type Instance = gst::subclass::ElementInstanceStruct<Self>; type Class = subclass::simple::ClassStruct<Self>; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/audio/audiofx/src/audioecho/mod.rs b/audio/audiofx/src/audioecho/mod.rs index 0b9eb7179..de1280724 100644 --- a/audio/audiofx/src/audioecho/mod.rs +++ b/audio/audiofx/src/audioecho/mod.rs @@ -11,7 +11,7 @@ use glib::prelude::*; mod imp; mod ring_buffer; -glib_wrapper! { +glib::glib_wrapper! { pub struct AudioEcho(ObjectSubclass<imp::AudioEcho>) @extends gst_base::BaseTransform, gst::Element, gst::Object; } diff --git a/audio/audiofx/src/audioloudnorm/imp.rs b/audio/audiofx/src/audioloudnorm/imp.rs index 04832ee0c..637828891 100644 --- a/audio/audiofx/src/audioloudnorm/imp.rs +++ b/audio/audiofx/src/audioloudnorm/imp.rs @@ -22,6 +22,7 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_error, gst_info, gst_log}; use std::mem; use std::sync::Mutex; @@ -29,13 +30,14 @@ use std::{i32, u64}; use byte_slice_cast::*; -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +use once_cell::sync::Lazy; +static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new( "rsaudioloudnorm", gst::DebugColorFlags::empty(), Some("Rust Audio Loudless Normalization Filter"), - ); -} + ) +}); const DEFAULT_LOUDNESS_TARGET: f64 = -24.0; const DEFAULT_LOUDNESS_RANGE_TARGET: f64 = 7.0; @@ -1753,7 +1755,7 @@ impl ObjectSubclass for AudioLoudNorm { type Instance = gst::subclass::ElementInstanceStruct<Self>; type Class = subclass::simple::ClassStruct<Self>; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/audio/audiofx/src/audioloudnorm/mod.rs b/audio/audiofx/src/audioloudnorm/mod.rs index 54d0819f4..d896035cf 100644 --- a/audio/audiofx/src/audioloudnorm/mod.rs +++ b/audio/audiofx/src/audioloudnorm/mod.rs @@ -22,7 +22,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct AudioLoudNorm(ObjectSubclass<imp::AudioLoudNorm>) @extends gst::Element, gst::Object; } diff --git a/audio/audiofx/src/audiornnoise/imp.rs b/audio/audiofx/src/audiornnoise/imp.rs index 521b7ba1e..5b40c3e7c 100644 --- a/audio/audiofx/src/audiornnoise/imp.rs +++ b/audio/audiofx/src/audiornnoise/imp.rs @@ -12,19 +12,21 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_error, gst_loggable_error}; use gst_base::subclass::base_transform::BaseTransformImplExt; use gst_base::subclass::base_transform::GenerateOutputSuccess; use gst_base::subclass::prelude::*; use nnnoiseless::DenoiseState; use std::sync::Mutex; -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +use once_cell::sync::Lazy; +static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new( "audiornnoise", gst::DebugColorFlags::empty(), Some("Rust Audio Denoise Filter"), - ); -} + ) +}); const FRAME_SIZE: usize = DenoiseState::FRAME_SIZE; @@ -194,7 +196,7 @@ impl ObjectSubclass for AudioRNNoise { type Instance = gst::subclass::ElementInstanceStruct<Self>; type Class = subclass::simple::ClassStruct<Self>; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/audio/audiofx/src/audiornnoise/mod.rs b/audio/audiofx/src/audiornnoise/mod.rs index a7281de5d..47ebe2cc3 100644 --- a/audio/audiofx/src/audiornnoise/mod.rs +++ b/audio/audiofx/src/audiornnoise/mod.rs @@ -11,7 +11,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct AudioRNNoise(ObjectSubclass<imp::AudioRNNoise>) @extends gst_base::BaseTransform, gst::Element, gst::Object; } diff --git a/audio/audiofx/src/lib.rs b/audio/audiofx/src/lib.rs index aee83f0d4..8b65e3c45 100644 --- a/audio/audiofx/src/lib.rs +++ b/audio/audiofx/src/lib.rs @@ -6,18 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate byte_slice_cast; -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -extern crate gstreamer_audio as gst_audio; -extern crate gstreamer_base as gst_base; -extern crate num_traits; - -#[macro_use] -extern crate lazy_static; - mod audioecho; mod audioloudnorm; mod audiornnoise; @@ -29,7 +17,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { Ok(()) } -gst_plugin_define!( +gst::gst_plugin_define!( rsaudiofx, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index 9498d3244..05dfce8b4 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -14,11 +14,6 @@ // License along with this library; if not, write to the // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -extern crate gstreamer as gst; -extern crate gstreamer_app as gst_app; -extern crate gstreamer_audio as gst_audio; -extern crate gstreamer_check as gst_check; - use glib::prelude::*; use gst::prelude::*; diff --git a/audio/audiofx/tests/audiornnoise.rs b/audio/audiofx/tests/audiornnoise.rs index 5ff287896..4f89bedcc 100644 --- a/audio/audiofx/tests/audiornnoise.rs +++ b/audio/audiofx/tests/audiornnoise.rs @@ -6,11 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate gstreamer as gst; -extern crate gstreamer_app as gst_app; -extern crate gstreamer_audio as gst_audio; -extern crate gstreamer_check as gst_check; - use byte_slice_cast::*; fn init() { diff --git a/audio/claxon/Cargo.toml b/audio/claxon/Cargo.toml index 2f8101c0d..bf2fb8e09 100644 --- a/audio/claxon/Cargo.toml +++ b/audio/claxon/Cargo.toml @@ -9,13 +9,15 @@ edition = "2018" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -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" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } claxon = { version = "0.4" } byte-slice-cast = "1.0" atomic_refcell = "0.1" +[dev-dependencies] +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } + [lib] name = "gstclaxon" crate-type = ["cdylib", "rlib", "staticlib"] diff --git a/audio/claxon/src/claxondec/imp.rs b/audio/claxon/src/claxondec/imp.rs index 6833b3ea0..79ca73595 100644 --- a/audio/claxon/src/claxondec/imp.rs +++ b/audio/claxon/src/claxondec/imp.rs @@ -9,6 +9,8 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_error}; +use gst_audio::gst_audio_decoder_error; use gst_audio::prelude::*; use gst_audio::subclass::prelude::*; @@ -35,7 +37,7 @@ impl ObjectSubclass for ClaxonDec { type Instance = gst::subclass::ElementInstanceStruct<Self>; type Class = subclass::simple::ClassStruct<Self>; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/audio/claxon/src/claxondec/mod.rs b/audio/claxon/src/claxondec/mod.rs index 018c4ae4d..3ceca8cab 100644 --- a/audio/claxon/src/claxondec/mod.rs +++ b/audio/claxon/src/claxondec/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct ClaxonDec(ObjectSubclass<imp::ClaxonDec>) @extends gst_audio::AudioDecoder, gst::Element, gst::Object; } diff --git a/audio/claxon/src/lib.rs b/audio/claxon/src/lib.rs index 7e9214916..6d9cd5c83 100644 --- a/audio/claxon/src/lib.rs +++ b/audio/claxon/src/lib.rs @@ -6,20 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -#[macro_use] -extern crate gstreamer_audio as gst_audio; - mod claxondec; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { claxondec::register(plugin) } -gst_plugin_define!( +gst::gst_plugin_define!( claxon, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/audio/claxon/tests/claxondec.rs b/audio/claxon/tests/claxondec.rs index 446587431..5a0bcc5e3 100644 --- a/audio/claxon/tests/claxondec.rs +++ b/audio/claxon/tests/claxondec.rs @@ -6,13 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate glib; -extern crate gstreamer as gst; use gst::prelude::*; -extern crate gstreamer_audio as gst_audio; -extern crate gstreamer_check as gst_check; - -extern crate gstclaxon; fn init() { use std::sync::Once; diff --git a/audio/csound/Cargo.toml b/audio/csound/Cargo.toml index 0ef87902b..f55ec236f 100644 --- a/audio/csound/Cargo.toml +++ b/audio/csound/Cargo.toml @@ -10,13 +10,15 @@ description = "An Audio filter plugin based on Csound" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst_base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst_audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst_check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } csound = "0.1.8" once_cell = "1.0" byte-slice-cast = "1.0" +[dev-dependencies] +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } + [lib] name = "gstcsound" crate-type = ["cdylib", "rlib", "staticlib"] diff --git a/audio/lewton/Cargo.toml b/audio/lewton/Cargo.toml index 444c9e7d3..59022f62d 100644 --- a/audio/lewton/Cargo.toml +++ b/audio/lewton/Cargo.toml @@ -9,13 +9,15 @@ edition = "2018" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -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" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } lewton = { version = "0.10", default-features = false } byte-slice-cast = "1.0" atomic_refcell = "0.1" -lazy_static = "1.0" +once_cell = "1.0" + +[dev-dependencies] +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } [lib] name = "gstlewton" diff --git a/audio/lewton/src/lewtondec/imp.rs b/audio/lewton/src/lewtondec/imp.rs index 6108f1f6c..5d6d5d9aa 100644 --- a/audio/lewton/src/lewtondec/imp.rs +++ b/audio/lewton/src/lewtondec/imp.rs @@ -9,6 +9,8 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_error, gst_warning}; +use gst_audio::gst_audio_decoder_error; use gst_audio::prelude::*; use gst_audio::subclass::prelude::*; @@ -32,13 +34,14 @@ pub struct LewtonDec { state: AtomicRefCell<Option<State>>, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +use once_cell::sync::Lazy; +static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new( "lewtondec", gst::DebugColorFlags::empty(), Some("lewton Vorbis decoder"), - ); -} + ) +}); impl ObjectSubclass for LewtonDec { const NAME: &'static str = "LewtonDec"; @@ -47,7 +50,7 @@ impl ObjectSubclass for LewtonDec { type Instance = gst::subclass::ElementInstanceStruct<Self>; type Class = subclass::simple::ClassStruct<Self>; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/audio/lewton/src/lewtondec/mod.rs b/audio/lewton/src/lewtondec/mod.rs index b98d8098c..7db96f51d 100644 --- a/audio/lewton/src/lewtondec/mod.rs +++ b/audio/lewton/src/lewtondec/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct LewtonDec(ObjectSubclass<imp::LewtonDec>) @extends gst_audio::AudioDecoder, gst::Element, gst::Object; } diff --git a/audio/lewton/src/lib.rs b/audio/lewton/src/lib.rs index 88a85cfe7..5b4166a5e 100644 --- a/audio/lewton/src/lib.rs +++ b/audio/lewton/src/lib.rs @@ -6,22 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -#[macro_use] -extern crate gstreamer_audio as gst_audio; -#[macro_use] -extern crate lazy_static; - mod lewtondec; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { lewtondec::register(plugin) } -gst_plugin_define!( +gst::gst_plugin_define!( lewton, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/audio/lewton/tests/lewtondec.rs b/audio/lewton/tests/lewtondec.rs index bc8667e47..59118f039 100644 --- a/audio/lewton/tests/lewtondec.rs +++ b/audio/lewton/tests/lewtondec.rs @@ -6,13 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate glib; -extern crate gstreamer as gst; use gst::prelude::*; -extern crate gstreamer_audio as gst_audio; -extern crate gstreamer_check as gst_check; - -extern crate gstlewton; fn init() { use std::sync::Once; |