diff --git a/utils/fallbackswitch/Cargo.toml b/utils/fallbackswitch/Cargo.toml index 83fb4435..dc781050 100644 --- a/utils/fallbackswitch/Cargo.toml +++ b/utils/fallbackswitch/Cargo.toml @@ -8,22 +8,22 @@ edition = "2018" description = "Fallback Switcher Plugin" [dependencies] -libc = "0.2" +libc = { version = "0.2", optional = true } glib = { git = "https://github.com/gtk-rs/glib" } -glib-sys = { git = "https://github.com/gtk-rs/sys" } -gobject-sys = { git = "https://github.com/gtk-rs/sys" } -gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } -gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_16"] } -gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" } -gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } -gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } +glib-sys = { git = "https://github.com/gtk-rs/sys", optional = true } +gobject-sys = { git = "https://github.com/gtk-rs/sys", optional = true } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_16"] } +gst-sys = { package = "gstreamer-sys", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", optional = true } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } +gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } gtk = { git = "https://github.com/gtk-rs/gtk", optional = true } gio = { git = "https://github.com/gtk-rs/gio", optional = true } once_cell = "1.0" [dev-dependencies] -gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"]} -gstreamer-app = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"]} +gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"]} +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"]} [lib] name = "gstfallbackswitch" @@ -41,5 +41,5 @@ cc = "1.0" pkg-config = "0.3" [features] -default = [] -#v1_18 = ["gstreamer/v1_18", "gstreamer-base"] +default = ["glib-sys", "gobject-sys", "gst-sys", "libc"] +#v1_18 = ["gstreamer-base/v1_18"] diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index ffb64542..7418a4bb 100644 --- a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs +++ b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs @@ -15,18 +15,12 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -extern crate glib; -use glib::prelude::*; -extern crate gio; use gio::prelude::*; -extern crate gstreamer as gst; use gst::prelude::*; -extern crate gstfallbackswitch; - -extern crate gtk; use gtk::prelude::*; + use std::cell::RefCell; use std::env; diff --git a/utils/fallbackswitch/src/base/sys.rs b/utils/fallbackswitch/src/base/sys.rs index ac3e8ffc..9901cc0a 100644 --- a/utils/fallbackswitch/src/base/sys.rs +++ b/utils/fallbackswitch/src/base/sys.rs @@ -5,7 +5,7 @@ clippy::unreadable_literal )] -extern crate gstreamer_sys as gst; +use gst_sys as gst; #[allow(unused_imports)] use libc::{ diff --git a/utils/fallbackswitch/src/fallbacksrc.rs b/utils/fallbackswitch/src/fallbacksrc.rs index 7217b3b4..ade237c7 100644 --- a/utils/fallbackswitch/src/fallbacksrc.rs +++ b/utils/fallbackswitch/src/fallbacksrc.rs @@ -15,14 +15,11 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -use glib; use glib::prelude::*; use glib::subclass; use glib::subclass::prelude::*; -use gst; use gst::prelude::*; use gst::subclass::prelude::*; -use gstreamer_base as gst_base; use std::mem; use std::sync::Mutex; diff --git a/utils/fallbackswitch/src/fallbackswitch.rs b/utils/fallbackswitch/src/fallbackswitch.rs index f38f7bc1..8934d6b8 100644 --- a/utils/fallbackswitch/src/fallbackswitch.rs +++ b/utils/fallbackswitch/src/fallbackswitch.rs @@ -16,14 +16,20 @@ // Boston, MA 02110-1335, USA. #[cfg(not(feature = "v1_18"))] -use super::base as gst_base; -use glib::prelude::*; +use self::gst_base::prelude::*; +#[cfg(not(feature = "v1_18"))] +use self::gst_base::subclass::prelude::*; +#[cfg(not(feature = "v1_18"))] +use super::gst_base_compat as gst_base; + +#[cfg(feature = "v1_18")] +use gst_base::prelude::*; +#[cfg(feature = "v1_18")] +use gst_base::subclass::prelude::*; + use glib::subclass; use glib::subclass::prelude::*; -use gst::prelude::*; use gst::subclass::prelude::*; -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; use once_cell::sync::Lazy; diff --git a/utils/fallbackswitch/src/lib.rs b/utils/fallbackswitch/src/lib.rs index 21df3ebb..370e9185 100644 --- a/utils/fallbackswitch/src/lib.rs +++ b/utils/fallbackswitch/src/lib.rs @@ -18,35 +18,18 @@ #[macro_use] extern crate glib; #[macro_use] -extern crate gstreamer as gst; - -extern crate gstreamer_audio as gst_audio; -extern crate gstreamer_video as gst_video; +extern crate gst; #[cfg(not(feature = "v1_18"))] -extern crate glib_sys; -#[cfg(not(feature = "v1_18"))] -extern crate gobject_sys; -#[cfg(feature = "v1_18")] -extern crate gstreamer_base as gst_base; -#[cfg(not(feature = "v1_18"))] -extern crate gstreamer_sys as gst_sys; -#[cfg(not(feature = "v1_18"))] -#[allow(dead_code)] -mod base; -#[cfg(not(feature = "v1_18"))] -mod gst_base { - pub use super::base::*; -} - -extern crate once_cell; +#[path = "base/mod.rs"] +pub mod gst_base_compat; mod fallbacksrc; mod fallbackswitch; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { - fallbackswitch::register(plugin)?; fallbacksrc::register(plugin)?; + fallbackswitch::register(plugin)?; Ok(()) } diff --git a/utils/fallbackswitch/tests/fallbackswitch.rs b/utils/fallbackswitch/tests/fallbackswitch.rs index e4726b91..7f6c9629 100644 --- a/utils/fallbackswitch/tests/fallbackswitch.rs +++ b/utils/fallbackswitch/tests/fallbackswitch.rs @@ -15,16 +15,11 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -extern crate glib; use glib::prelude::*; #[macro_use] -extern crate gstreamer as gst; +extern crate gst; use gst::prelude::*; -extern crate gstreamer_app as gst_app; -extern crate gstreamer_check as gst_check; - -extern crate gstfallbackswitch; use once_cell::sync::Lazy;