mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 13:31:00 +00:00
Move simple Source/Sink/Demuxer traits to a separate crate
Fixes https://github.com/sdroege/gst-plugin-rs/issues/20
This commit is contained in:
parent
89b44e6081
commit
393cd6236a
20 changed files with 83 additions and 42 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
"gst-plugin",
|
"gst-plugin",
|
||||||
|
"gst-plugin-simple",
|
||||||
"gst-plugin-file",
|
"gst-plugin-file",
|
||||||
"gst-plugin-http",
|
"gst-plugin-http",
|
||||||
"gst-plugin-flv",
|
"gst-plugin-flv",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "gst-plugin-audiofx"
|
name = "gst-plugin-audiofx"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||||
repository = "https://github.com/sdroege/rsplugin"
|
repository = "https://github.com/sdroege/gst-plugin-rs"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
name = "gst-plugin-file"
|
name = "gst-plugin-file"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||||
repository = "https://github.com/sdroege/rsplugin"
|
repository = "https://github.com/sdroege/gst-plugin-rs"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "1.1"
|
url = "1.1"
|
||||||
gst-plugin = { path="../gst-plugin" }
|
gst-plugin = { path="../gst-plugin" }
|
||||||
|
gst-plugin-simple = { path="../gst-plugin-simple" }
|
||||||
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -14,7 +14,8 @@ use std::io::Write;
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
|
|
||||||
use gst_plugin::error::*;
|
use gst_plugin::error::*;
|
||||||
use gst_plugin::sink::*;
|
use gst_plugin_simple::sink::*;
|
||||||
|
use gst_plugin_simple::UriValidator;
|
||||||
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
|
|
@ -12,7 +12,8 @@ use std::fs::File;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use gst_plugin::error::*;
|
use gst_plugin::error::*;
|
||||||
use gst_plugin::source::*;
|
use gst_plugin_simple::source::*;
|
||||||
|
use gst_plugin_simple::UriValidator;
|
||||||
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gst_plugin;
|
extern crate gst_plugin;
|
||||||
|
extern crate gst_plugin_simple;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
use gst_plugin::source::*;
|
use gst_plugin_simple::source::*;
|
||||||
use gst_plugin::sink::*;
|
use gst_plugin_simple::sink::*;
|
||||||
|
|
||||||
mod filesrc;
|
mod filesrc;
|
||||||
mod filesink;
|
mod filesink;
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
name = "gst-plugin-flv"
|
name = "gst-plugin-flv"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||||
repository = "https://github.com/sdroege/rsplugin"
|
repository = "https://github.com/sdroege/gst-plugin-rs"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "1.1"
|
url = "1.1"
|
||||||
gst-plugin = { path="../gst-plugin" }
|
gst-plugin = { path="../gst-plugin" }
|
||||||
|
gst-plugin-simple = { path="../gst-plugin-simple" }
|
||||||
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
||||||
num-rational = { version = "0.1", default-features = false, features = [] }
|
num-rational = { version = "0.1", default-features = false, features = [] }
|
||||||
nom = "3.0"
|
nom = "3.0"
|
||||||
|
|
|
@ -15,9 +15,9 @@ use nom::IResult;
|
||||||
use flavors::parser as flavors;
|
use flavors::parser as flavors;
|
||||||
|
|
||||||
use gst_plugin::error::*;
|
use gst_plugin::error::*;
|
||||||
use gst_plugin::demuxer::*;
|
|
||||||
use gst_plugin::adapter::*;
|
use gst_plugin::adapter::*;
|
||||||
use gst_plugin::bytes::*;
|
use gst_plugin::bytes::*;
|
||||||
|
use gst_plugin_simple::demuxer::*;
|
||||||
|
|
||||||
use muldiv::*;
|
use muldiv::*;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
extern crate flavors;
|
extern crate flavors;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gst_plugin;
|
extern crate gst_plugin;
|
||||||
|
extern crate gst_plugin_simple;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate muldiv;
|
extern crate muldiv;
|
||||||
|
@ -18,7 +19,7 @@ extern crate nom;
|
||||||
extern crate num_rational;
|
extern crate num_rational;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
use gst_plugin::demuxer::*;
|
use gst_plugin_simple::demuxer::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
|
||||||
mod flvdemux;
|
mod flvdemux;
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
name = "gst-plugin-http"
|
name = "gst-plugin-http"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||||
repository = "https://github.com/sdroege/rsplugin"
|
repository = "https://github.com/sdroege/gst-plugin-rs"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "1.1"
|
url = "1.1"
|
||||||
gst-plugin = { path="../gst-plugin" }
|
gst-plugin = { path="../gst-plugin" }
|
||||||
|
gst-plugin-simple = { path="../gst-plugin-simple" }
|
||||||
reqwest = "0.7"
|
reqwest = "0.7"
|
||||||
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ use reqwest::header::{AcceptRanges, ByteRangeSpec, ContentLength, ContentRange,
|
||||||
Range, RangeUnit};
|
Range, RangeUnit};
|
||||||
|
|
||||||
use gst_plugin::error::*;
|
use gst_plugin::error::*;
|
||||||
use gst_plugin::source::*;
|
use gst_plugin_simple::source::*;
|
||||||
|
use gst_plugin_simple::UriValidator;
|
||||||
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gst_plugin;
|
extern crate gst_plugin;
|
||||||
|
extern crate gst_plugin_simple;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
use gst_plugin::source::*;
|
use gst_plugin_simple::source::*;
|
||||||
|
|
||||||
mod httpsrc;
|
mod httpsrc;
|
||||||
|
|
||||||
|
|
17
gst-plugin-simple/Cargo.toml
Normal file
17
gst-plugin-simple/Cargo.toml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[package]
|
||||||
|
name = "gst-plugin-simple"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||||
|
repository = "https://github.com/sdroege/gst-plugin-rs"
|
||||||
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
url = "1.1"
|
||||||
|
glib = { git = "https://github.com/gtk-rs/glib" }
|
||||||
|
gst-plugin = { path="../gst-plugin" }
|
||||||
|
gstreamer = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
||||||
|
gstreamer-base = { git = "https://github.com/sdroege/gstreamer-rs", features = ["v1_10"] }
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "gst_plugin_simple"
|
||||||
|
path = "src/lib.rs"
|
|
@ -12,11 +12,10 @@ use std::u32;
|
||||||
use std::u64;
|
use std::u64;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use error::*;
|
use gst_plugin::error::*;
|
||||||
use object::*;
|
use gst_plugin::object::*;
|
||||||
use element::*;
|
use gst_plugin::element::*;
|
||||||
|
|
||||||
use glib;
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst_base;
|
use gst_base;
|
||||||
|
@ -274,7 +273,7 @@ impl Demuxer {
|
||||||
|
|
||||||
fn sink_activate(pad: &gst::Pad, _parent: &Option<gst::Object>) -> bool {
|
fn sink_activate(pad: &gst::Pad, _parent: &Option<gst::Object>) -> bool {
|
||||||
let mode = {
|
let mode = {
|
||||||
let mut query = gst::Query::new_scheduling();
|
let query = gst::Query::new_scheduling();
|
||||||
if !pad.peer_query(query.get_mut().unwrap()) {
|
if !pad.peer_query(query.get_mut().unwrap()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +351,7 @@ impl Demuxer {
|
||||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
||||||
|
|
||||||
if active {
|
if active {
|
||||||
let mut query = gst::Query::new_duration(gst::Format::Bytes);
|
let query = gst::Query::new_duration(gst::Format::Bytes);
|
||||||
let upstream_size = if demuxer.sinkpad.peer_query(query.get_mut().unwrap()) {
|
let upstream_size = if demuxer.sinkpad.peer_query(query.get_mut().unwrap()) {
|
||||||
use gst::QueryView;
|
use gst::QueryView;
|
||||||
|
|
22
gst-plugin-simple/src/lib.rs
Normal file
22
gst-plugin-simple/src/lib.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
extern crate glib;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate gstreamer as gst;
|
||||||
|
extern crate gstreamer_base as gst_base;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate gst_plugin;
|
||||||
|
|
||||||
|
extern crate url;
|
||||||
|
|
||||||
|
pub mod source;
|
||||||
|
pub mod sink;
|
||||||
|
pub mod demuxer;
|
||||||
|
|
||||||
|
pub type UriValidator = Fn(&url::Url) -> Result<(), gst_plugin::error::UriError> + Send + Sync + 'static;
|
|
@ -10,20 +10,21 @@ use std::sync::Mutex;
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use error::*;
|
|
||||||
|
|
||||||
use glib;
|
use glib;
|
||||||
use gst;
|
use gst;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst_base;
|
use gst_base;
|
||||||
use gst_base::prelude::*;
|
use gst_base::prelude::*;
|
||||||
|
|
||||||
use object::*;
|
use gst_plugin::object::*;
|
||||||
use element::*;
|
use gst_plugin::element::*;
|
||||||
use base_sink::*;
|
use gst_plugin::base_sink::*;
|
||||||
use uri_handler::*;
|
use gst_plugin::uri_handler::*;
|
||||||
|
use gst_plugin::error::*;
|
||||||
|
|
||||||
pub use base_sink::RsBaseSink;
|
pub use gst_plugin::base_sink::RsBaseSink;
|
||||||
|
|
||||||
|
use UriValidator;
|
||||||
|
|
||||||
pub trait SinkImpl: Send + 'static {
|
pub trait SinkImpl: Send + 'static {
|
||||||
fn uri_validator(&self) -> Box<UriValidator>;
|
fn uri_validator(&self) -> Box<UriValidator>;
|
|
@ -12,20 +12,21 @@ use std::sync::Mutex;
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use error::*;
|
|
||||||
|
|
||||||
use glib;
|
use glib;
|
||||||
use gst;
|
use gst;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst_base;
|
use gst_base;
|
||||||
use gst_base::prelude::*;
|
use gst_base::prelude::*;
|
||||||
|
|
||||||
use object::*;
|
use gst_plugin::object::*;
|
||||||
use element::*;
|
use gst_plugin::element::*;
|
||||||
use base_src::*;
|
use gst_plugin::base_src::*;
|
||||||
use uri_handler::*;
|
use gst_plugin::uri_handler::*;
|
||||||
|
use gst_plugin::error::*;
|
||||||
|
|
||||||
pub use base_src::RsBaseSrc;
|
pub use gst_plugin::base_src::RsBaseSrc;
|
||||||
|
|
||||||
|
use UriValidator;
|
||||||
|
|
||||||
pub trait SourceImpl: Send + 'static {
|
pub trait SourceImpl: Send + 'static {
|
||||||
fn uri_validator(&self) -> Box<UriValidator>;
|
fn uri_validator(&self) -> Box<UriValidator>;
|
|
@ -2,12 +2,11 @@
|
||||||
name = "gst-plugin"
|
name = "gst-plugin"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
|
||||||
repository = "https://github.com/sdroege/rsplugin/gst-plugin"
|
repository = "https://github.com/sdroege/gst-plugin-rs/gst-plugin"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
url = "1.1"
|
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
glib-sys = { git = "https://github.com/gtk-rs/sys" }
|
glib-sys = { git = "https://github.com/gtk-rs/sys" }
|
||||||
|
|
|
@ -11,8 +11,6 @@ use std::fmt::{Display, Formatter};
|
||||||
use std::fmt::Error as FmtError;
|
use std::fmt::Error as FmtError;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use url::Url;
|
|
||||||
|
|
||||||
use glib_ffi;
|
use glib_ffi;
|
||||||
use gst_ffi;
|
use gst_ffi;
|
||||||
|
|
||||||
|
@ -215,8 +213,6 @@ impl Error for UriError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type UriValidator = Fn(&Url) -> Result<(), UriError> + Send + Sync + 'static;
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! panic_to_error(
|
macro_rules! panic_to_error(
|
||||||
($element:expr, $panicked:expr, $ret:expr, $code:block) => {{
|
($element:expr, $panicked:expr, $ret:expr, $code:block) => {{
|
||||||
|
|
|
@ -12,7 +12,6 @@ extern crate gstreamer_base_sys as gst_base_ffi;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate url;
|
|
||||||
pub extern crate glib_sys as glib_ffi;
|
pub extern crate glib_sys as glib_ffi;
|
||||||
pub extern crate gobject_sys as gobject_ffi;
|
pub extern crate gobject_sys as gobject_ffi;
|
||||||
pub extern crate gstreamer_sys as gst_ffi;
|
pub extern crate gstreamer_sys as gst_ffi;
|
||||||
|
@ -66,9 +65,6 @@ pub mod error;
|
||||||
pub mod adapter;
|
pub mod adapter;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod plugin;
|
pub mod plugin;
|
||||||
pub mod source;
|
|
||||||
pub mod sink;
|
|
||||||
pub mod demuxer;
|
|
||||||
pub mod bytes;
|
pub mod bytes;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
Loading…
Reference in a new issue