forked from mirrors/gstreamer-rs
examples: Move to 2018 edition
This code rework the examples to use the new 2018 edition and also rework the code to avoid using unnecessary 'extern crate' calls. The 'use extern crate gstreamer as gst', as well as the other gstramer related crates, were kept, otherwise we'd need to do it on 'Cargo.toml' but it would make it more difficult to figure out the respective crate name.
This commit is contained in:
parent
3c1304def5
commit
6fc70ee6b6
28 changed files with 44 additions and 144 deletions
|
@ -3,6 +3,7 @@ name = "examples"
|
|||
version = "0.16.0"
|
||||
license = "MIT"
|
||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
glib = { git = "https://github.com/gtk-rs/glib" }
|
||||
|
@ -123,11 +124,9 @@ name = "toc"
|
|||
|
||||
[[bin]]
|
||||
name = "futures"
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "glib-futures"
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "rtsp-server-record"
|
||||
|
@ -148,8 +147,6 @@ required-features = ["ges"]
|
|||
name = "glupload"
|
||||
required-features = ["gl"]
|
||||
features = ["gl-egl", "gl-x11", "gl-wayland"]
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "subclass"
|
||||
edition = "2018"
|
||||
|
|
|
@ -10,25 +10,19 @@
|
|||
// This is the format we request:
|
||||
// Audio / Signed 16bit / 1 channel / arbitrary sample rate
|
||||
|
||||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::prelude::*;
|
||||
extern crate gstreamer_app as gst_app;
|
||||
extern crate gstreamer_audio as gst_audio;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate byte_slice_cast;
|
||||
use byte_slice_cast::*;
|
||||
|
||||
use std::i16;
|
||||
use std::i32;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -15,13 +15,8 @@ use gst::prelude::*;
|
|||
extern crate gstreamer_app as gst_app;
|
||||
extern crate gstreamer_video as gst_video;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -29,24 +29,22 @@
|
|||
// Especially Windows APIs tend to be quite picky about samplerate and sample-format.
|
||||
// The same applies to videostreams.
|
||||
|
||||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::gst_element_warning;
|
||||
use gst::prelude::*;
|
||||
|
||||
#[cfg_attr(feature = "v1_10", macro_use)]
|
||||
extern crate glib;
|
||||
#[cfg(feature = "v1_10")]
|
||||
use glib::subclass::prelude::*;
|
||||
#[cfg(feature = "v1_10")]
|
||||
use glib::GBoxed;
|
||||
|
||||
use std::env;
|
||||
#[cfg(feature = "v1_10")]
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -11,18 +11,13 @@
|
|||
extern crate gstreamer as gst;
|
||||
|
||||
extern crate gstreamer_pbutils as pbutils;
|
||||
use pbutils::prelude::*;
|
||||
use crate::pbutils::prelude::*;
|
||||
|
||||
use pbutils::DiscovererInfo;
|
||||
use pbutils::DiscovererStreamInfo;
|
||||
use crate::pbutils::DiscovererInfo;
|
||||
use crate::pbutils::DiscovererStreamInfo;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
use std::env;
|
||||
|
||||
|
|
|
@ -12,27 +12,25 @@
|
|||
// {uridecodebin} -| {encodebin}-{filesink}
|
||||
// \-{queue}-{videoconvert}-{videoscale}----/
|
||||
|
||||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::gst_element_warning;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate gstreamer_pbutils as gst_pbutils;
|
||||
use gst_pbutils::prelude::*;
|
||||
|
||||
#[cfg_attr(feature = "v1_10", macro_use)]
|
||||
extern crate glib;
|
||||
#[cfg(feature = "v1_10")]
|
||||
use glib::subclass::prelude::*;
|
||||
#[cfg(feature = "v1_10")]
|
||||
use glib::GBoxed;
|
||||
|
||||
use std::env;
|
||||
#[cfg(feature = "v1_10")]
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate futures;
|
||||
use futures::executor::LocalPool;
|
||||
use futures::prelude::*;
|
||||
|
||||
|
|
|
@ -47,12 +47,9 @@ use std::env;
|
|||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
||||
extern crate failure;
|
||||
#[allow(unused_imports)]
|
||||
use failure::Error;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
fn main_loop(uri: &str) -> Result<(), glib::BoolError> {
|
||||
ges::init()?;
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate futures;
|
||||
use futures::prelude::*;
|
||||
|
||||
use std::env;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
// {videotestsrc} - { glsinkbin }
|
||||
|
||||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate gstreamer_app as gst_app;
|
||||
|
@ -13,20 +13,13 @@ extern crate gstreamer_gl as gst_gl;
|
|||
use gst_gl::prelude::*;
|
||||
extern crate gstreamer_video as gst_video;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::sync::mpsc;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
|
||||
extern crate glutin;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -13,12 +13,8 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate gio;
|
||||
use gio::prelude::*;
|
||||
|
||||
extern crate gtk;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
|
|
@ -23,16 +23,12 @@ use gst::prelude::*;
|
|||
extern crate gstreamer_video as gst_video;
|
||||
use gst_video::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
use glib::object::ObjectType;
|
||||
|
||||
extern crate gio;
|
||||
use gio::prelude::*;
|
||||
|
||||
extern crate gtk;
|
||||
use gtk::prelude::*;
|
||||
|
||||
extern crate gdk;
|
||||
use gdk::prelude::*;
|
||||
|
||||
use std::env;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
|
|
|
@ -11,7 +11,6 @@ extern crate gstreamer as gst;
|
|||
use gst::prelude::*;
|
||||
extern crate gstreamer_audio as gst_audio;
|
||||
|
||||
extern crate byte_slice_cast;
|
||||
use byte_slice_cast::*;
|
||||
|
||||
use std::i16;
|
||||
|
|
|
@ -11,25 +11,17 @@
|
|||
// The capsfilter element allows us to dictate the video resolution we want for the
|
||||
// videotestsrc and the cairooverlay element.
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate cairo;
|
||||
extern crate gstreamer_video as gst_video;
|
||||
extern crate pango;
|
||||
use pango::prelude::*;
|
||||
extern crate pangocairo;
|
||||
|
||||
use std::ops;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
|
|
|
@ -10,13 +10,9 @@ use gst::prelude::*;
|
|||
|
||||
extern crate gstreamer_player as gst_player;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
extern crate failure;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use failure::Error;
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::convert::TryInto;
|
||||
use std::env;
|
||||
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Missing element {}", _0)]
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
||||
use std::env;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Missing element {}", _0)]
|
||||
|
|
|
@ -4,19 +4,13 @@
|
|||
// send to the server. For this, the launch syntax pipeline, that is passed
|
||||
// to this example's cli is spawned and the client's media is streamed into it.
|
||||
|
||||
extern crate failure;
|
||||
extern crate gio;
|
||||
extern crate glib;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
|
||||
extern crate gstreamer as gst;
|
||||
extern crate gstreamer_rtsp as gst_rtsp;
|
||||
extern crate gstreamer_rtsp_server as gst_rtsp_server;
|
||||
extern crate gstreamer_rtsp_server_sys as gst_rtsp_server_sys;
|
||||
|
||||
use failure::Error;
|
||||
use failure::Fail;
|
||||
use std::env;
|
||||
use std::ptr;
|
||||
|
||||
|
|
|
@ -8,20 +8,19 @@
|
|||
// the client machinery and printing some status.
|
||||
|
||||
extern crate gstreamer as gst;
|
||||
|
||||
extern crate gstreamer_rtsp as gst_rtsp;
|
||||
extern crate gstreamer_rtsp_server as gst_rtsp_server;
|
||||
extern crate gstreamer_sdp as gst_sdp;
|
||||
|
||||
use gst_rtsp_server::prelude::*;
|
||||
|
||||
#[macro_use]
|
||||
extern crate glib;
|
||||
use glib::glib_object_impl;
|
||||
use glib::glib_object_subclass;
|
||||
use glib::glib_object_wrapper;
|
||||
use glib::glib_wrapper;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -10,13 +10,8 @@ extern crate gstreamer as gst;
|
|||
extern crate gstreamer_rtsp_server as gst_rtsp_server;
|
||||
use gst_rtsp_server::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -6,18 +6,19 @@
|
|||
// Our filter can only handle F32 mono and acts as a FIR filter. The filter impulse response /
|
||||
// coefficients are provided via Rust API on the filter as a Vec<f32>.
|
||||
|
||||
#[macro_use]
|
||||
extern crate glib;
|
||||
use glib::glib_object_impl;
|
||||
use glib::glib_object_subclass;
|
||||
use glib::glib_object_wrapper;
|
||||
use glib::glib_wrapper;
|
||||
|
||||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::gst_info;
|
||||
use gst::gst_trace;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
@ -37,7 +38,6 @@ mod fir_filter {
|
|||
|
||||
extern crate gstreamer_audio as gst_audio;
|
||||
|
||||
extern crate byte_slice_cast;
|
||||
use byte_slice_cast::*;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
|
|
@ -21,13 +21,8 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
|
|
|
@ -17,19 +17,14 @@
|
|||
// {src} - {typefind} - {demuxer} -| {multiqueue} - {matroskamux} - {filesink}
|
||||
// \-[video]-/
|
||||
|
||||
#[macro_use]
|
||||
extern crate gstreamer as gst;
|
||||
use gst::gst_element_error;
|
||||
use gst::prelude::*;
|
||||
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
||||
extern crate failure;
|
||||
use failure::Error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
use failure::Fail;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
mod examples_common;
|
||||
|
|
Loading…
Reference in a new issue