Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-12-20 22:53:43 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-12-20 22:53:43 +0300
commitbda421d218af3fa12c6f1c54534a124af123cfdd (patch)
tree5ed4b42b1dd58343376e1f92fa8915a008a76103
parent22c5f93d3b2ded6089fdebd3224c8119053533f5 (diff)
Move more things into gst-plugin-simple
-rw-r--r--gst-plugin-file/src/filesink.rs2
-rw-r--r--gst-plugin-file/src/filesrc.rs2
-rw-r--r--gst-plugin-flv/src/flvdemux.rs2
-rw-r--r--gst-plugin-http/src/httpsrc.rs2
-rw-r--r--gst-plugin-simple/src/demuxer.rs3
-rw-r--r--gst-plugin-simple/src/error.rs115
-rw-r--r--gst-plugin-simple/src/lib.rs6
-rw-r--r--gst-plugin-simple/src/sink.rs2
-rw-r--r--gst-plugin-simple/src/source.rs2
-rw-r--r--gst-plugin/src/error.rs108
10 files changed, 125 insertions, 119 deletions
diff --git a/gst-plugin-file/src/filesink.rs b/gst-plugin-file/src/filesink.rs
index 6e107a67d..9f02fa17a 100644
--- a/gst-plugin-file/src/filesink.rs
+++ b/gst-plugin-file/src/filesink.rs
@@ -12,7 +12,7 @@ use url::Url;
use std::io::Write;
-use gst_plugin::error::*;
+use gst_plugin_simple::error::*;
use gst_plugin_simple::sink::*;
use gst_plugin_simple::UriValidator;
diff --git a/gst-plugin-file/src/filesrc.rs b/gst-plugin-file/src/filesrc.rs
index b75711d6e..5c849e849 100644
--- a/gst-plugin-file/src/filesrc.rs
+++ b/gst-plugin-file/src/filesrc.rs
@@ -11,7 +11,7 @@ use std::io::{Read, Seek, SeekFrom};
use std::fs::File;
use url::Url;
-use gst_plugin::error::*;
+use gst_plugin_simple::error::*;
use gst_plugin_simple::source::*;
use gst_plugin_simple::UriValidator;
diff --git a/gst-plugin-flv/src/flvdemux.rs b/gst-plugin-flv/src/flvdemux.rs
index e1cdf213a..f604421c6 100644
--- a/gst-plugin-flv/src/flvdemux.rs
+++ b/gst-plugin-flv/src/flvdemux.rs
@@ -14,11 +14,11 @@ use nom::IResult;
use flavors::parser as flavors;
-use gst_plugin::error::*;
use gst_plugin::adapter::*;
use gst_plugin::bytes::*;
use gst_plugin::element::*;
use gst_plugin_simple::demuxer::*;
+use gst_plugin_simple::error::*;
use gst;
diff --git a/gst-plugin-http/src/httpsrc.rs b/gst-plugin-http/src/httpsrc.rs
index 729e5e1bd..f647130ee 100644
--- a/gst-plugin-http/src/httpsrc.rs
+++ b/gst-plugin-http/src/httpsrc.rs
@@ -13,7 +13,7 @@ use reqwest::{Client, Response};
use reqwest::header::{AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec,
Range, RangeUnit};
-use gst_plugin::error::*;
+use gst_plugin_simple::error::*;
use gst_plugin_simple::source::*;
use gst_plugin_simple::UriValidator;
diff --git a/gst-plugin-simple/src/demuxer.rs b/gst-plugin-simple/src/demuxer.rs
index fff18e7c4..27faecdbb 100644
--- a/gst-plugin-simple/src/demuxer.rs
+++ b/gst-plugin-simple/src/demuxer.rs
@@ -12,10 +12,11 @@ use std::u32;
use std::u64;
use std::collections::BTreeMap;
-use gst_plugin::error::*;
use gst_plugin::object::*;
use gst_plugin::element::*;
+use error::*;
+
use gst;
use gst::prelude::*;
use gst_base;
diff --git a/gst-plugin-simple/src/error.rs b/gst-plugin-simple/src/error.rs
new file mode 100644
index 000000000..d7adb40ba
--- /dev/null
+++ b/gst-plugin-simple/src/error.rs
@@ -0,0 +1,115 @@
+// Copyright (C) 2016-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.
+
+use std::error::Error;
+use std::fmt::{Display, Formatter};
+use std::fmt::Error as FmtError;
+
+use glib;
+use gst;
+
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum FlowError {
+ Flushing,
+ Eos,
+ NotNegotiated(gst::ErrorMessage),
+ Error(gst::ErrorMessage),
+}
+
+impl Into<gst::FlowReturn> for FlowError {
+ fn into(self) -> gst::FlowReturn {
+ (&self).into()
+ }
+}
+
+impl<'a> Into<gst::FlowReturn> for &'a FlowError {
+ fn into(self) -> gst::FlowReturn {
+ match *self {
+ FlowError::Flushing => gst::FlowReturn::Flushing,
+ FlowError::Eos => gst::FlowReturn::Eos,
+ FlowError::NotNegotiated(..) => gst::FlowReturn::NotNegotiated,
+ FlowError::Error(..) => gst::FlowReturn::Error,
+ }
+ }
+}
+
+impl Display for FlowError {
+ fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
+ match *self {
+ FlowError::Flushing | FlowError::Eos => f.write_str(self.description()),
+ FlowError::NotNegotiated(ref m) => {
+ f.write_fmt(format_args!("{}: {}", self.description(), m))
+ }
+ FlowError::Error(ref m) => f.write_fmt(format_args!("{}: {}", self.description(), m)),
+ }
+ }
+}
+
+impl Error for FlowError {
+ fn description(&self) -> &str {
+ match *self {
+ FlowError::Flushing => "Flushing",
+ FlowError::Eos => "Eos",
+ FlowError::NotNegotiated(..) => "Not Negotiated",
+ FlowError::Error(..) => "Error",
+ }
+ }
+}
+
+#[derive(Debug, PartialEq, Eq)]
+pub struct UriError {
+ error: gst::URIError,
+ message: String,
+}
+
+impl UriError {
+ pub fn new<T: Into<String>>(error: gst::URIError, message: T) -> UriError {
+ UriError {
+ error: error,
+ message: message.into(),
+ }
+ }
+
+ pub fn message(&self) -> &str {
+ &self.message
+ }
+
+ pub fn error(&self) -> gst::URIError {
+ self.error
+ }
+}
+
+impl Into<glib::Error> for UriError {
+ fn into(self) -> glib::Error {
+ (&self).into()
+ }
+}
+
+impl<'a> Into<glib::Error> for &'a UriError {
+ fn into(self) -> glib::Error {
+ glib::Error::new(self.error, &self.message)
+ }
+}
+
+impl Display for UriError {
+ fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
+ f.write_fmt(format_args!("{}: {}", self.description(), self.message))
+ }
+}
+
+impl Error for UriError {
+ fn description(&self) -> &str {
+ match self.error {
+ gst::URIError::UnsupportedProtocol => "Unsupported protocol",
+ gst::URIError::BadUri => "Bad URI",
+ gst::URIError::BadState => "Bad State",
+ gst::URIError::BadReference => "Bad Reference",
+ _ => "Unknown",
+ }
+ }
+}
diff --git a/gst-plugin-simple/src/lib.rs b/gst-plugin-simple/src/lib.rs
index 7c3c4a4b6..d97985f46 100644
--- a/gst-plugin-simple/src/lib.rs
+++ b/gst-plugin-simple/src/lib.rs
@@ -17,8 +17,6 @@ extern crate url;
pub mod source;
pub mod sink;
pub mod demuxer;
+pub mod error;
-pub type UriValidator = Fn(&url::Url) -> Result<(), gst_plugin::error::UriError>
- + Send
- + Sync
- + 'static;
+pub type UriValidator = Fn(&url::Url) -> Result<(), error::UriError> + Send + Sync + 'static;
diff --git a/gst-plugin-simple/src/sink.rs b/gst-plugin-simple/src/sink.rs
index 8884452f2..dbce67284 100644
--- a/gst-plugin-simple/src/sink.rs
+++ b/gst-plugin-simple/src/sink.rs
@@ -20,7 +20,7 @@ use gst_plugin::properties::*;
use gst_plugin::element::*;
use gst_plugin::base_sink::*;
use gst_plugin::uri_handler::*;
-use gst_plugin::error::*;
+use error::*;
pub use gst_plugin::base_sink::BaseSink;
diff --git a/gst-plugin-simple/src/source.rs b/gst-plugin-simple/src/source.rs
index 056817c77..92984361c 100644
--- a/gst-plugin-simple/src/source.rs
+++ b/gst-plugin-simple/src/source.rs
@@ -22,7 +22,7 @@ use gst_plugin::properties::*;
use gst_plugin::element::*;
use gst_plugin::base_src::*;
use gst_plugin::uri_handler::*;
-use gst_plugin::error::*;
+use error::*;
pub use gst_plugin::base_src::BaseSrc;
diff --git a/gst-plugin/src/error.rs b/gst-plugin/src/error.rs
index f98b22572..19a8533ef 100644
--- a/gst-plugin/src/error.rs
+++ b/gst-plugin/src/error.rs
@@ -6,114 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::error::Error;
-use std::fmt::{Display, Formatter};
-use std::fmt::Error as FmtError;
-
-use glib;
-use gst;
-
-#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum FlowError {
- Flushing,
- Eos,
- NotNegotiated(gst::ErrorMessage),
- Error(gst::ErrorMessage),
-}
-
-impl Into<gst::FlowReturn> for FlowError {
- fn into(self) -> gst::FlowReturn {
- (&self).into()
- }
-}
-
-impl<'a> Into<gst::FlowReturn> for &'a FlowError {
- fn into(self) -> gst::FlowReturn {
- match *self {
- FlowError::Flushing => gst::FlowReturn::Flushing,
- FlowError::Eos => gst::FlowReturn::Eos,
- FlowError::NotNegotiated(..) => gst::FlowReturn::NotNegotiated,
- FlowError::Error(..) => gst::FlowReturn::Error,
- }
- }
-}
-
-impl Display for FlowError {
- fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
- match *self {
- FlowError::Flushing | FlowError::Eos => f.write_str(self.description()),
- FlowError::NotNegotiated(ref m) => {
- f.write_fmt(format_args!("{}: {}", self.description(), m))
- }
- FlowError::Error(ref m) => f.write_fmt(format_args!("{}: {}", self.description(), m)),
- }
- }
-}
-
-impl Error for FlowError {
- fn description(&self) -> &str {
- match *self {
- FlowError::Flushing => "Flushing",
- FlowError::Eos => "Eos",
- FlowError::NotNegotiated(..) => "Not Negotiated",
- FlowError::Error(..) => "Error",
- }
- }
-}
-
-#[derive(Debug, PartialEq, Eq)]
-pub struct UriError {
- error: gst::URIError,
- message: String,
-}
-
-impl UriError {
- pub fn new<T: Into<String>>(error: gst::URIError, message: T) -> UriError {
- UriError {
- error: error,
- message: message.into(),
- }
- }
-
- pub fn message(&self) -> &str {
- &self.message
- }
-
- pub fn error(&self) -> gst::URIError {
- self.error
- }
-}
-
-impl Into<glib::Error> for UriError {
- fn into(self) -> glib::Error {
- (&self).into()
- }
-}
-
-impl<'a> Into<glib::Error> for &'a UriError {
- fn into(self) -> glib::Error {
- glib::Error::new(self.error, &self.message)
- }
-}
-
-impl Display for UriError {
- fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
- f.write_fmt(format_args!("{}: {}", self.description(), self.message))
- }
-}
-
-impl Error for UriError {
- fn description(&self) -> &str {
- match self.error {
- gst::URIError::UnsupportedProtocol => "Unsupported protocol",
- gst::URIError::BadUri => "Bad URI",
- gst::URIError::BadState => "Bad State",
- gst::URIError::BadReference => "Bad Reference",
- _ => "Unknown",
- }
- }
-}
-
#[macro_export]
macro_rules! panic_to_error(
($element:expr, $panicked:expr, $ret:expr, $code:block) => {{