diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-11-22 20:21:45 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-11-23 11:28:35 +0300 |
commit | f81d7b61b5923eea4247548c1778d1c71d94ed92 (patch) | |
tree | 16ba3459d302dff6435db34f5effbafe94568d20 /video/flavors | |
parent | 767ed3afaeab3a88255e6718c4ed008539438c41 (diff) |
video: Update to 2018 edition
Diffstat (limited to 'video/flavors')
-rw-r--r-- | video/flavors/Cargo.toml | 6 | ||||
-rw-r--r-- | video/flavors/src/flvdemux/imp.rs | 29 | ||||
-rw-r--r-- | video/flavors/src/flvdemux/mod.rs | 2 | ||||
-rw-r--r-- | video/flavors/src/lib.rs | 11 |
4 files changed, 21 insertions, 27 deletions
diff --git a/video/flavors/Cargo.toml b/video/flavors/Cargo.toml index bb5573ce1..aa2c6ddb4 100644 --- a/video/flavors/Cargo.toml +++ b/video/flavors/Cargo.toml @@ -9,14 +9,14 @@ description = "Rust FLV Plugin" [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" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } num-rational = { version = "0.3", default-features = false, features = [] } nom = "6" flavors = { git = "https://github.com/rust-av/flavors" } muldiv = "1.0" byteorder = "1.0" -lazy_static = "1.0" +once_cell = "1.0" smallvec = "1.0" [lib] diff --git a/video/flavors/src/flvdemux/imp.rs b/video/flavors/src/flvdemux/imp.rs index a4e541178..a907440f1 100644 --- a/video/flavors/src/flvdemux/imp.rs +++ b/video/flavors/src/flvdemux/imp.rs @@ -16,20 +16,23 @@ use ::flavors::parser as flavors; use glib::subclass; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{ + gst_debug, gst_error, gst_error_msg, gst_log, gst_loggable_error, gst_trace, gst_warning, +}; use num_rational::Rational32; +use once_cell::sync::Lazy; + use smallvec::SmallVec; -lazy_static! { - static ref CAT: gst::DebugCategory = { - gst::DebugCategory::new( - "rsflvdemux", - gst::DebugColorFlags::empty(), - Some("Rust FLV demuxer"), - ) - }; -} +static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new( + "rsflvdemux", + gst::DebugColorFlags::empty(), + Some("Rust FLV demuxer"), + ) +}); pub struct FlvDemux { sinkpad: gst::Pad, @@ -126,7 +129,7 @@ impl ObjectSubclass for FlvDemux { 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(); @@ -374,7 +377,7 @@ impl FlvDemux { } fn sink_event(&self, pad: &gst::Pad, element: &super::FlvDemux, event: gst::Event) -> bool { - use crate::gst::EventView; + use gst::EventView; gst_log!(CAT, obj: pad, "Handling event {:?}", event); match event.view() { @@ -404,7 +407,7 @@ impl FlvDemux { element: &super::FlvDemux, query: &mut gst::QueryRef, ) -> bool { - use crate::gst::QueryView; + use gst::QueryView; match query.view_mut() { QueryView::Position(ref mut q) => { @@ -452,7 +455,7 @@ impl FlvDemux { } fn src_event(&self, pad: &gst::Pad, element: &super::FlvDemux, event: gst::Event) -> bool { - use crate::gst::EventView; + use gst::EventView; match event.view() { EventView::Seek(..) => { diff --git a/video/flavors/src/flvdemux/mod.rs b/video/flavors/src/flvdemux/mod.rs index aca2b41a4..dc1e341d4 100644 --- a/video/flavors/src/flvdemux/mod.rs +++ b/video/flavors/src/flvdemux/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct FlvDemux(ObjectSubclass<imp::FlvDemux>) @extends gst::Element, gst::Object; } diff --git a/video/flavors/src/lib.rs b/video/flavors/src/lib.rs index 479716ed4..af01fceed 100644 --- a/video/flavors/src/lib.rs +++ b/video/flavors/src/lib.rs @@ -6,15 +6,6 @@ // 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; -extern crate gstreamer_base as gst_base; - -#[macro_use] -extern crate lazy_static; - mod bytes; mod flvdemux; @@ -22,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { flvdemux::register(plugin) } -gst_plugin_define!( +gst::gst_plugin_define!( rsflv, env!("CARGO_PKG_DESCRIPTION"), plugin_init, |