mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-20 00:56:30 +00:00
net: Update to 2018 edition
This commit is contained in:
parent
1c9c22df0c
commit
3c9f1c0d1d
14 changed files with 50 additions and 52 deletions
|
@ -14,10 +14,10 @@ reqwest = { version = "0.10", features = ["cookies", "gzip"] }
|
|||
futures = "0.3"
|
||||
hyperx = "1.0"
|
||||
mime = "0.3"
|
||||
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_10"] }
|
||||
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
||||
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_10"] }
|
||||
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
||||
tokio = { version = "0.2", features = ["time", "rt-threaded"] }
|
||||
lazy_static = "1.0"
|
||||
once_cell = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
hyper = "0.13"
|
||||
|
|
|
@ -6,21 +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;
|
||||
extern crate gstreamer_base as gst_base;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
mod reqwesthttpsrc;
|
||||
|
||||
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
reqwesthttpsrc::register(plugin)
|
||||
}
|
||||
|
||||
gst_plugin_define!(
|
||||
gst::gst_plugin_define!(
|
||||
reqwest,
|
||||
env!("CARGO_PKG_DESCRIPTION"),
|
||||
plugin_init,
|
||||
|
|
|
@ -15,10 +15,13 @@ use reqwest::{Client, Response, StatusCode};
|
|||
use tokio::runtime;
|
||||
use url::Url;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use glib::subclass;
|
||||
use glib::subclass::prelude::*;
|
||||
use gst::prelude::*;
|
||||
use gst::subclass::prelude::*;
|
||||
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_trace, gst_warning};
|
||||
use gst_base::prelude::*;
|
||||
use gst_base::subclass::prelude::*;
|
||||
|
||||
|
@ -172,7 +175,7 @@ static PROPERTIES: [subclass::Property; 11] = [
|
|||
|
||||
const REQWEST_CLIENT_CONTEXT: &str = "gst.reqwest.client";
|
||||
|
||||
#[derive(Clone, Debug, GBoxed)]
|
||||
#[derive(Clone, Debug, glib::GBoxed)]
|
||||
#[gboxed(type_name = "ReqwestClientContext")]
|
||||
struct ClientContext(Arc<ClientContextInner>);
|
||||
|
||||
|
@ -213,19 +216,22 @@ pub struct ReqwestHttpSrc {
|
|||
canceller: Mutex<Option<future::AbortHandle>>,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
|
||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
"reqwesthttpsrc",
|
||||
gst::DebugColorFlags::empty(),
|
||||
Some("Rust HTTP source"),
|
||||
);
|
||||
static ref RUNTIME: runtime::Runtime = runtime::Builder::new()
|
||||
)
|
||||
});
|
||||
|
||||
static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
|
||||
runtime::Builder::new()
|
||||
.threaded_scheduler()
|
||||
.enable_all()
|
||||
.core_threads(1)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
impl ReqwestHttpSrc {
|
||||
fn set_location(
|
||||
|
@ -1095,7 +1101,7 @@ impl ObjectSubclass for ReqwestHttpSrc {
|
|||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::glib_object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
|
|
@ -10,7 +10,7 @@ use glib::prelude::*;
|
|||
|
||||
mod imp;
|
||||
|
||||
glib_wrapper! {
|
||||
glib::glib_wrapper! {
|
||||
pub struct ReqwestHttpSrc(ObjectSubclass<imp::ReqwestHttpSrc>) @extends gst_base::PushSrc, gst_base::BaseSrc, gst::Element, gst::Object, @implements gst::URIHandler;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
use gst::prelude::*;
|
||||
use gstreamer as gst;
|
||||
|
||||
use std::sync::mpsc;
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ edition = "2018"
|
|||
bytes = "0.5"
|
||||
futures = "0.3"
|
||||
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
||||
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||
rusoto_core = "0.45"
|
||||
rusoto_s3 = "0.45"
|
||||
rusoto_credential = "0.45"
|
||||
|
@ -22,7 +22,6 @@ rusoto_signature = "0.45"
|
|||
url = "2"
|
||||
percent-encoding = "2"
|
||||
tokio = { version = "0.2", features = [ "rt-threaded" ] }
|
||||
lazy_static = "1.0"
|
||||
async-tungstenite = { version = "0.9", features = ["tokio", "tokio-runtime", "tokio-native-tls"] }
|
||||
nom = "5.1.1"
|
||||
crc = "1.8.1"
|
||||
|
|
|
@ -20,6 +20,10 @@ use glib::subclass;
|
|||
use glib::subclass::prelude::*;
|
||||
use gst::prelude::*;
|
||||
use gst::subclass::prelude::*;
|
||||
use gst::{
|
||||
gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_log, gst_loggable_error,
|
||||
gst_warning,
|
||||
};
|
||||
|
||||
use std::default::Default;
|
||||
|
||||
|
@ -997,7 +1001,7 @@ impl ObjectSubclass for Transcriber {
|
|||
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();
|
||||
|
|
|
@ -20,7 +20,7 @@ use glib::prelude::*;
|
|||
mod imp;
|
||||
mod packet;
|
||||
|
||||
glib_wrapper! {
|
||||
glib::glib_wrapper! {
|
||||
pub struct Transcriber(ObjectSubclass<imp::Transcriber>) @extends gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +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 aws_transcriber;
|
||||
mod s3sink;
|
||||
mod s3src;
|
||||
|
@ -28,7 +20,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
gst_plugin_define!(
|
||||
gst::gst_plugin_define!(
|
||||
rusoto,
|
||||
env!("CARGO_PKG_DESCRIPTION"),
|
||||
plugin_init,
|
||||
|
|
|
@ -12,6 +12,7 @@ use glib::subclass::prelude::*;
|
|||
|
||||
use gst::prelude::*;
|
||||
use gst::subclass::prelude::*;
|
||||
use gst::{gst_element_error, gst_error, gst_error_msg, gst_info, gst_trace};
|
||||
|
||||
use gst_base::subclass::prelude::*;
|
||||
|
||||
|
@ -22,6 +23,8 @@ use rusoto_s3::{
|
|||
CreateMultipartUploadRequest, S3Client, UploadPartRequest, S3,
|
||||
};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::convert::From;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Mutex;
|
||||
|
@ -93,13 +96,13 @@ pub struct S3Sink {
|
|||
canceller: Mutex<Option<future::AbortHandle>>,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
|
||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
"rusotos3sink",
|
||||
gst::DebugColorFlags::empty(),
|
||||
Some("Amazon S3 Sink"),
|
||||
);
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
|
@ -386,7 +389,7 @@ impl ObjectSubclass for S3Sink {
|
|||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::glib_object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
|
|
@ -10,7 +10,7 @@ use glib::prelude::*;
|
|||
|
||||
mod imp;
|
||||
|
||||
glib_wrapper! {
|
||||
glib::glib_wrapper! {
|
||||
pub struct S3Sink(ObjectSubclass<imp::S3Sink>) @extends gst_base::BaseSink, gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use std::sync::Mutex;
|
|||
|
||||
use bytes::Bytes;
|
||||
use futures::future;
|
||||
use once_cell::sync::Lazy;
|
||||
use rusoto_s3::*;
|
||||
|
||||
use glib::prelude::*;
|
||||
|
@ -17,6 +18,7 @@ use glib::subclass;
|
|||
use glib::subclass::prelude::*;
|
||||
|
||||
use gst::subclass::prelude::*;
|
||||
use gst::{gst_debug, gst_error, gst_error_msg, gst_info};
|
||||
|
||||
use gst_base::prelude::*;
|
||||
use gst_base::subclass::base_src::CreateSuccess;
|
||||
|
@ -41,13 +43,13 @@ pub struct S3Src {
|
|||
canceller: Mutex<Option<future::AbortHandle>>,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
|
||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
"rusotos3src",
|
||||
gst::DebugColorFlags::empty(),
|
||||
Some("Amazon S3 Source"),
|
||||
);
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
static PROPERTIES: [subclass::Property; 1] = [subclass::Property("uri", |name| {
|
||||
glib::ParamSpec::string(
|
||||
|
@ -211,7 +213,7 @@ impl ObjectSubclass for S3Src {
|
|||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::glib_object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
|
|
@ -10,7 +10,7 @@ use glib::prelude::*;
|
|||
|
||||
mod imp;
|
||||
|
||||
glib_wrapper! {
|
||||
glib::glib_wrapper! {
|
||||
pub struct S3Src(ObjectSubclass<imp::S3Src>) @extends gst_base::BaseSrc, gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,19 +9,20 @@
|
|||
use bytes::{buf::BufMut, Bytes, BytesMut};
|
||||
use futures::stream::TryStreamExt;
|
||||
use futures::{future, Future};
|
||||
use once_cell::sync::Lazy;
|
||||
use rusoto_core::ByteStream;
|
||||
use std::sync::Mutex;
|
||||
use tokio::runtime;
|
||||
|
||||
lazy_static! {
|
||||
static ref RUNTIME: runtime::Runtime = runtime::Builder::new()
|
||||
static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
|
||||
runtime::Builder::new()
|
||||
.threaded_scheduler()
|
||||
.enable_all()
|
||||
.core_threads(2)
|
||||
.thread_name("gst-rusoto-runtime")
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
pub enum WaitError<E> {
|
||||
Cancelled,
|
||||
|
|
Loading…
Reference in a new issue