audio: Update to 2018 edition

This commit is contained in:
Sebastian Dröge 2020-11-22 13:16:10 +02:00
parent 5f11c0d603
commit 684f52b7d4
21 changed files with 62 additions and 95 deletions

View file

@ -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" }

View file

@ -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 {

View file

@ -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;
}

View file

@ -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();

View file

@ -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;
}

View file

@ -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 {

View file

@ -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;
}

View file

@ -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,

View file

@ -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::*;

View file

@ -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() {

View file

@ -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"]

View file

@ -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 {

View file

@ -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;
}

View file

@ -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,

View file

@ -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;

View file

@ -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"]

View file

@ -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"

View file

@ -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 {

View file

@ -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;
}

View file

@ -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,

View file

@ -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;