Commit 5ad45cef authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

examples: Rename crates in Cargo.toml and get rid of `extern crate`

parent ad1d78b5
......@@ -7,19 +7,19 @@ edition = "2018"
[dependencies]
glib = { git = "https://github.com/gtk-rs/glib" }
gstreamer = { path = "../gstreamer" }
gstreamer-gl = { path = "../gstreamer-gl", optional = true }
gstreamer-app = { path = "../gstreamer-app" }
gstreamer-audio = { path = "../gstreamer-audio" }
gstreamer-base = { path = "../gstreamer-base" }
gstreamer-video = { path = "../gstreamer-video" }
gstreamer-pbutils = { path = "../gstreamer-pbutils" }
gstreamer-player = { path = "../gstreamer-player", optional = true }
gstreamer-editing-services = { path = "../gstreamer-editing-services", optional = true }
gstreamer-sdp = { path = "../gstreamer-sdp", optional = true }
gstreamer-rtsp = { path = "../gstreamer-rtsp", optional = true }
gstreamer-rtsp-server = { path = "../gstreamer-rtsp-server", optional = true }
gstreamer-rtsp-server-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"], optional = true }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-gl = { package = "gstreamer-gl", path = "../gstreamer-gl", optional = true }
gst-app = { package = "gstreamer-app", path = "../gstreamer-app" }
gst-audio = { package = "gstreamer-audio", path = "../gstreamer-audio" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
gst-video = { package = "gstreamer-video", path = "../gstreamer-video" }
gst-pbutils = { package = "gstreamer-pbutils", path = "../gstreamer-pbutils" }
gst-player = { package = "gstreamer-player", path = "../gstreamer-player", optional = true }
ges = { package = "gstreamer-editing-services", path = "../gstreamer-editing-services", optional = true }
gst-sdp = { package = "gstreamer-sdp", path = "../gstreamer-sdp", optional = true }
gst-rtsp = { package = "gstreamer-rtsp", path = "../gstreamer-rtsp", optional = true }
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "../gstreamer-rtsp-server", optional = true }
gst-rtsp-server-sys = { package = "gstreamer-rtsp-server-sys", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"], optional = true }
gtk = { git = "https://github.com/gtk-rs/gtk", optional = true }
gdk = { git = "https://github.com/gtk-rs/gdk", optional = true }
gio = { git = "https://github.com/gtk-rs/gio", optional = true }
......@@ -41,21 +41,19 @@ gl_generator = { version = "0.14", optional = true }
[features]
default = []
gst-player = ["gstreamer-player"]
ges = ["gstreamer-editing-services"]
gtksink = ["gtk", "gio"]
gtkvideooverlay = ["gtk", "gdk", "gio"]
gtkvideooverlay-x11 = ["gtkvideooverlay"]
gtkvideooverlay-quartz = ["gtkvideooverlay"]
gst-rtsp-server = ["gstreamer-rtsp-server", "gstreamer-rtsp", "gstreamer-sdp"]
gst-rtsp-server-record = ["gstreamer-rtsp-server-sys", "gstreamer-rtsp-server", "gstreamer-rtsp", "gio"]
v1_10 = ["gstreamer/v1_10"]
rtsp-server = ["gst-rtsp-server", "gst-rtsp", "gst-sdp"]
rtsp-server-record = ["gst-rtsp-server-sys", "gst-rtsp-server", "gst-rtsp", "gio"]
v1_10 = ["gst/v1_10"]
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
overlay-composition = ["pango", "pangocairo", "cairo-rs", "cairo-sys-rs" ]
gl = ["gstreamer-gl", "gl_generator", "glutin"]
gl-egl = ["gstreamer-gl/egl"]
gl-x11 = ["gstreamer-gl/x11"]
gl-wayland = ["gstreamer-gl/wayland"]
gl = ["gst-gl", "gl_generator", "glutin"]
gl-egl = ["gst-gl/egl"]
gl-x11 = ["gst-gl/x11"]
gl-wayland = ["gst-gl/wayland"]
[[bin]]
name = "appsink"
......@@ -124,11 +122,11 @@ name = "rtpfecserver"
[[bin]]
name = "rtsp-server"
required-features = ["gst-rtsp-server"]
required-features = ["rtsp-server"]
[[bin]]
name = "rtsp-server-subclass"
required-features = ["gst-rtsp-server"]
required-features = ["rtsp-server"]
[[bin]]
name = "tagsetter"
......@@ -144,7 +142,7 @@ name = "glib-futures"
[[bin]]
name = "rtsp-server-record"
required-features = ["gst-rtsp-server-record"]
required-features = ["rtsp-server-record"]
[[bin]]
name = "discoverer"
......
#[cfg(feature = "gl")]
extern crate gl_generator;
#[cfg(feature = "gl")]
fn generate_gl_bindings() {
let dest = std::path::PathBuf::from(&std::env::var("OUT_DIR").unwrap());
......
......@@ -10,11 +10,8 @@
// This is the format we request:
// Audio / Signed 16bit / 1 channel / arbitrary sample rate
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;
use byte_slice_cast::*;
......
......@@ -10,10 +10,7 @@
// The application provides data of the following format:
// Video / BGRx (4 bytes) / 2 fps
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_app as gst_app;
extern crate gstreamer_video as gst_video;
use anyhow::Error;
use derive_more::{Display, Error};
......
......@@ -5,7 +5,6 @@
// is sent on the sink pad, we expect to see it emerge on the other side when
// the data in front of it has exited.
extern crate gstreamer as gst;
use gst::prelude::*;
#[path = "../examples-common.rs"]
......
......@@ -3,12 +3,9 @@
// It simply attaches a GstMeta with a Rust String to buffers that are passed into
// an appsrc and retrieves them again from an appsink.
#[macro_use]
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::prelude::*;
extern crate gstreamer_app as gst_app;
#[path = "../examples-common.rs"]
mod examples_common;
......
......@@ -5,7 +5,6 @@
//
// It's possible to dump the logs at any time in an application,
// not just on exit like is done here.
extern crate gstreamer as gst;
use gst::prelude::*;
use std::process;
......
......@@ -29,7 +29,6 @@
// Especially Windows APIs tend to be quite picky about samplerate and sample-format.
// The same applies to videostreams.
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::gst_element_warning;
use gst::prelude::*;
......
......@@ -8,13 +8,10 @@
// Discovered information could for example contain the stream's duration or whether it is
// seekable (filesystem) or not (some http servers).
extern crate gstreamer as gst;
use gst_pbutils::prelude::*;
extern crate gstreamer_pbutils as pbutils;
use crate::pbutils::prelude::*;
use crate::pbutils::DiscovererInfo;
use crate::pbutils::DiscovererStreamInfo;
use gst_pbutils::DiscovererInfo;
use gst_pbutils::DiscovererStreamInfo;
use anyhow::Error;
use derive_more::{Display, Error};
......@@ -88,7 +85,7 @@ fn run_discoverer() -> Result<(), Error> {
};
let timeout: gst::ClockTime = gst::ClockTime::from_seconds(15);
let discoverer = pbutils::Discoverer::new(timeout)?;
let discoverer = gst_pbutils::Discoverer::new(timeout)?;
let info = discoverer.discover_uri(uri)?;
print_discoverer_info(&info)?;
Ok(())
......
......@@ -12,12 +12,10 @@
// {uridecodebin} -| {encodebin}-{filesink}
// \-{queue}-{videoconvert}-{videoscale}----/
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(feature = "v1_10")]
......
......@@ -19,7 +19,6 @@
// This makes it possible, e.g., to schedule an arbitrary piece of code
// to run in the main loop thread - avoiding potential threading issues.
extern crate gstreamer as gst;
use gst::prelude::*;
#[path = "../examples-common.rs"]
......
......@@ -3,7 +3,6 @@
// or for an EOS message. When a message notifying about either of both
// is received, the future is resolved.
extern crate gstreamer as gst;
use gst::prelude::*;
use futures::executor::LocalPool;
......
......@@ -35,10 +35,8 @@
// those with lowers (higher number). Thus, Layers with higher priority are "in the front".
// - The timeline is the enclosing element, grouping all layers and providing a timeframe.
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_editing_services as ges;
use ges::prelude::*;
use std::env;
......
extern crate gstreamer as gst;
use gst::prelude::*;
use futures::prelude::*;
......
......@@ -4,14 +4,10 @@
// {videotestsrc} - { glsinkbin }
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::prelude::*;
extern crate gstreamer_app as gst_app;
extern crate gstreamer_gl as gst_gl;
use gst_gl::prelude::*;
extern crate gstreamer_video as gst_video;
use std::ffi::CStr;
use std::mem;
......
......@@ -10,7 +10,6 @@
// (|)
// {videotestsrc} - {glsinkbin}
extern crate gstreamer as gst;
use gst::prelude::*;
use gio::prelude::*;
......
......@@ -17,14 +17,10 @@
// {videotestsrc} - {xvimagesink(on linux)}
// {videotestsrc} - {glimagesink(on mac)}
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_video as gst_video;
use gst_video::prelude::*;
use glib::object::ObjectType;
use gio::prelude::*;
use gtk::prelude::*;
......
......@@ -2,7 +2,6 @@
// This is used at multiple occassions - for example to iterate an
// element's pads.
extern crate gstreamer as gst;
use gst::prelude::*;
#[path = "../examples-common.rs"]
......
......@@ -3,7 +3,6 @@
// as launch syntax.
// When the parsing succeeded, the pipeline is run until the stream ends or an error happens.
extern crate gstreamer as gst;
use gst::prelude::*;
use std::env;
......
......@@ -7,7 +7,6 @@
// things from the main loop (timeouts, UI events, socket events, ...) instead
// of just handling messages from GStreamer's bus.
extern crate gstreamer as gst;
use gst::prelude::*;
use std::env;
......
......@@ -11,10 +11,8 @@
// There is a small amount of unsafe code that demonstrates how to work around
// Cairo's internal refcounting of the target buffer surface
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_video as gst_video;
use pango::prelude::*;
use std::ops;
......
......@@ -7,9 +7,7 @@
// /
// {audiotestsrc} - {fakesink}
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_audio as gst_audio;
use byte_slice_cast::*;
......
......@@ -11,10 +11,8 @@
// The capsfilter element allows us to dictate the video resolution we want for the
// videotestsrc and the cairooverlay element.
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_video as gst_video;
use pango::prelude::*;
use std::ops;
......
......@@ -9,7 +9,6 @@
// Much of the playbin's behavior can be controlled by so-called flags, as well
// as the playbin's properties and signals.
extern crate gstreamer as gst;
use gst::prelude::*;
use std::env;
......
......@@ -5,11 +5,8 @@
// audio / subtitle streams or changing the volume) are all supported by simple
// one-line function calls on the GstPlayer.
extern crate gstreamer as gst;
use gst::prelude::*;
extern crate gstreamer_player as gst_player;
use std::env;
use std::sync::{Arc, Mutex};
......
......@@ -12,7 +12,6 @@
// For convenience, the API has a set of pre-defined queries, but also
// allows custom queries (which can be defined and used by your own elements).
extern crate gstreamer as gst;
use gst::prelude::*;
use std::convert::TryInto;
......
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::prelude::*;
......
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::prelude::*;
......
......@@ -4,18 +4,11 @@
// 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 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 std::env;
use std::ptr;
use glib::translate::*;
use gst_rtsp::*;
use gst_rtsp_server::prelude::*;
use gst_rtsp_server::*;
use anyhow::Error;
use derive_more::{Display, Error};
......@@ -41,7 +34,7 @@ fn main_loop() -> Result<(), Error> {
// Mostly analog to the rtsp-server example, the server is created
// and the factory for our test mount is configured.
let main_loop = glib::MainLoop::new(None, false);
let server = RTSPServer::new();
let server = gst_rtsp_server::RTSPServer::new();
// Much like HTTP servers, RTSP servers have multiple endpoints that
// provide or take different streams. Here, we ask our server to give
// us a reference to its list of endpoints, so we can add our
......@@ -50,12 +43,15 @@ fn main_loop() -> Result<(), Error> {
// Next, we create a factory for the endpoint we want to create.
// The job of the factory is to create a new pipeline for each client that
// connects, or (if configured to do so) to reuse an existing pipeline.
let factory = RTSPMediaFactory::new();
let factory = gst_rtsp_server::RTSPMediaFactory::new();
// Here we configure a method of authentication that we want the
// server to require from clients.
let auth = RTSPAuth::new();
let token = RTSPToken::new(&[(*RTSP_TOKEN_MEDIA_FACTORY_ROLE, &"user")]);
let basic = RTSPAuth::make_basic("user", "password");
let auth = gst_rtsp_server::RTSPAuth::new();
let token = gst_rtsp_server::RTSPToken::new(&[(
*gst_rtsp_server::RTSP_TOKEN_MEDIA_FACTORY_ROLE,
&"user",
)]);
let basic = gst_rtsp_server::RTSPAuth::make_basic("user", "password");
// For propery authentication, we want to use encryption. And there's no
// encryption without a certificate!
let cert = gio::TlsCertificate::from_pem(
......@@ -91,10 +87,12 @@ fn main_loop() -> Result<(), Error> {
gst_rtsp_server_sys::gst_rtsp_media_factory_add_role(
factory.to_glib_none().0,
"user".to_glib_none().0,
RTSP_PERM_MEDIA_FACTORY_ACCESS.to_glib_none().0,
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS
.to_glib_none()
.0,
<bool as StaticType>::static_type().to_glib() as *const u8,
true.to_glib() as *const u8,
RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8,
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8,
<bool as StaticType>::static_type().to_glib() as *const u8,
true.to_glib() as *const u8,
ptr::null_mut::<u8>(),
......@@ -110,7 +108,7 @@ fn main_loop() -> Result<(), Error> {
factory.set_launch(args[1].as_str());
// Tell the RTSP server that we want to work in RECORD mode (clients send)
// data to us.
factory.set_transport_mode(RTSPTransportMode::RECORD);
factory.set_transport_mode(gst_rtsp_server::RTSPTransportMode::RECORD);
// The RTSP protocol allows a couple of different profiles for the actually
// used protocol of data-transmission. With this, we can limit the selection
// from which connecting clients have to choose.
......@@ -118,7 +116,7 @@ fn main_loop() -> Result<(), Error> {
// The F in the end is for feedback (an extension that allows more bidirectional
// feedback between sender and receiver). AV is just Audio/Video, P is Profile :)
// The default, old RTP profile is AVP
factory.set_profiles(RTSPProfile::SAVP | RTSPProfile::SAVPF);
factory.set_profiles(gst_rtsp::RTSPProfile::SAVP | gst_rtsp::RTSPProfile::SAVPF);
// Now we add a new mount-point and tell the RTSP server to use the factory
// we configured beforehand. This factory will take on the job of creating
......
......@@ -7,11 +7,6 @@
// It also comes with a custom RTSP server/client subclass for hooking into
// 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::*;
use glib::glib_object_subclass;
......@@ -90,7 +85,6 @@ mod media_factory {
use glib::subclass::prelude::*;
use glib::translate::*;
extern crate gstreamer_rtsp_server as gst_rtsp_server;
use gst_rtsp_server::subclass::prelude::*;
// In the imp submodule we include the actual implementation
......@@ -203,7 +197,6 @@ mod media {
use glib::subclass::prelude::*;
use glib::translate::*;
extern crate gstreamer_rtsp_server as gst_rtsp_server;
use gst_rtsp_server::subclass::prelude::*;
// In the imp submodule we include the actual implementation
......@@ -282,7 +275,6 @@ mod server {
use glib::subclass::prelude::*;
use glib::translate::*;
extern crate gstreamer_rtsp_server as gst_rtsp_server;
use gst_rtsp_server::subclass::prelude::*;
// In the imp submodule we include the actual implementation
......@@ -381,7 +373,6 @@ mod client {
use glib::subclass::prelude::*;
use glib::translate::*;
extern crate gstreamer_rtsp_server as gst_rtsp_server;
use gst_rtsp_server::subclass::prelude::*;
// In the imp submodule we include the actual implementation
......
......@@ -5,9 +5,6 @@
use std::env;
extern crate gstreamer as gst;
extern crate gstreamer_rtsp_server as gst_rtsp_server;
use gst_rtsp_server::prelude::*;
use anyhow::Error;
......
......@@ -9,7 +9,6 @@
use glib::glib_object_subclass;
use glib::glib_wrapper;
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::gst_info;
use gst::gst_trace;
......@@ -31,11 +30,8 @@ mod fir_filter {
use gst::subclass::prelude::*;
extern crate gstreamer_base as gst_base;
use gst_base::subclass::prelude::*;
extern crate gstreamer_audio as gst_audio;
use byte_slice_cast::*;
use once_cell::sync::Lazy;
......
......@@ -18,7 +18,6 @@
// (More modes of operation are possible, see: gst::TagMergeMode)
// This merge-mode can also be supplied to any method that adds new tags.
extern crate gstreamer as gst;
use gst::prelude::*;
use anyhow::anyhow;
......
......@@ -6,13 +6,8 @@
// The appsink enforces RGBA so that the image crate can use it. The image crate also requires
// tightly packed pixels, which is the case for RGBA by default in GStreamer.
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::prelude::*;
extern crate gstreamer_app as gst_app;
extern crate gstreamer_video as gst_video;
extern crate image;
use anyhow::Error;
use derive_more::{Display, Error};
......
......@@ -9,7 +9,6 @@
// {filesrc} - {decodebin} - {queue} - {fakesink}
// \- ...
extern crate gstreamer as gst;
use gst::prelude::*;
use std::env;
......
......@@ -17,7 +17,6 @@
// {src} - {typefind} - {demuxer} -| {multiqueue} - {matroskamux} - {filesink}
// \-[video]-/
extern crate gstreamer as gst;
use gst::gst_element_error;
use gst::prelude::*;
......
......@@ -2,8 +2,6 @@
// API to configure the compositor element to do specific
// formatting of an input video.
//
extern crate gstreamer as gst;
extern crate gstreamer_video as gst_video;
use gst::prelude::*;
#[path = "../examples-common.rs"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment