From 42d4d10b43ee24a0b0b121749c3d48f6dcaac735 Mon Sep 17 00:00:00 2001 From: "ahamedsajeer.15" Date: Wed, 26 Jun 2019 10:10:21 +0530 Subject: [PATCH] rshttpsrc: rename to reqwesthttpsrc --- Cargo.toml | 2 +- .../Cargo.toml | 2 +- .../build.rs | 0 .../src/lib.rs | 4 +-- .../src/reqwesthttpsrc.rs | 30 +++++++++---------- 5 files changed, 19 insertions(+), 19 deletions(-) rename {gst-plugin-http => gst-plugin-reqwest}/Cargo.toml (96%) rename {gst-plugin-http => gst-plugin-reqwest}/build.rs (100%) rename {gst-plugin-http => gst-plugin-reqwest}/src/lib.rs (94%) rename gst-plugin-http/src/httpsrc.rs => gst-plugin-reqwest/src/reqwesthttpsrc.rs (96%) diff --git a/Cargo.toml b/Cargo.toml index eb2e15ad..2474d047 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = [ "gst-plugin-file", - "gst-plugin-http", + "gst-plugin-reqwest", "gst-plugin-flv", "gst-plugin-audiofx", "gst-plugin-togglerecord", diff --git a/gst-plugin-http/Cargo.toml b/gst-plugin-reqwest/Cargo.toml similarity index 96% rename from gst-plugin-http/Cargo.toml rename to gst-plugin-reqwest/Cargo.toml index 449bbbc8..aaf02e71 100644 --- a/gst-plugin-http/Cargo.toml +++ b/gst-plugin-reqwest/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "gst-plugin-http" +name = "gst-plugin-reqwest" version = "0.5.0" authors = ["Sebastian Dröge "] repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" diff --git a/gst-plugin-http/build.rs b/gst-plugin-reqwest/build.rs similarity index 100% rename from gst-plugin-http/build.rs rename to gst-plugin-reqwest/build.rs diff --git a/gst-plugin-http/src/lib.rs b/gst-plugin-reqwest/src/lib.rs similarity index 94% rename from gst-plugin-http/src/lib.rs rename to gst-plugin-reqwest/src/lib.rs index 37247683..70115799 100644 --- a/gst-plugin-http/src/lib.rs +++ b/gst-plugin-reqwest/src/lib.rs @@ -20,10 +20,10 @@ extern crate reqwest; extern crate tokio; extern crate url; -mod httpsrc; +mod reqwesthttpsrc; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { - httpsrc::register(plugin) + reqwesthttpsrc::register(plugin) } gst_plugin_define!( diff --git a/gst-plugin-http/src/httpsrc.rs b/gst-plugin-reqwest/src/reqwesthttpsrc.rs similarity index 96% rename from gst-plugin-http/src/httpsrc.rs rename to gst-plugin-reqwest/src/reqwesthttpsrc.rs index b9db0d73..31f8e789 100644 --- a/gst-plugin-http/src/httpsrc.rs +++ b/gst-plugin-reqwest/src/reqwesthttpsrc.rs @@ -76,7 +76,7 @@ impl Default for State { } #[derive(Debug)] -pub struct HttpSrc { +pub struct ReqwestHttpSrc { cat: gst::DebugCategory, client: Client, settings: Mutex, @@ -85,13 +85,13 @@ pub struct HttpSrc { canceller: Mutex>>, } -impl HttpSrc { +impl ReqwestHttpSrc { fn set_location(&self, _element: &gst_base::BaseSrc, uri: &str) -> Result<(), glib::Error> { let state = self.state.lock().unwrap(); if let State::Started { .. } = *state { return Err(glib::Error::new( gst::URIError::BadState, - "Changing the `location` property on a started `httpsrc` is not supported", + "Changing the `location` property on a started `reqwesthttpsrc` is not supported", )); } @@ -143,8 +143,9 @@ impl HttpSrc { gst_debug!(cat, obj: src, "Doing new request {:?}", req); - let response_fut = req.send().and_then(|res| { - // gst_debug!(cat, obj: src, "Response received: {:?}", res); + let src_clone = src.clone(); + let response_fut = req.send().and_then(move |res| { + gst_debug!(cat, obj: &src_clone, "Response received: {:?}", res); Ok(res) }); @@ -245,7 +246,7 @@ impl HttpSrc { } } -impl ObjectImpl for HttpSrc { +impl ObjectImpl for ReqwestHttpSrc { glib_object_impl!(); fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) { @@ -291,9 +292,9 @@ impl ObjectImpl for HttpSrc { } } -impl ElementImpl for HttpSrc {} +impl ElementImpl for ReqwestHttpSrc {} -impl BaseSrcImpl for HttpSrc { +impl BaseSrcImpl for ReqwestHttpSrc { fn is_seekable(&self, _src: &gst_base::BaseSrc) -> bool { match *self.state.lock().unwrap() { State::Started { seekable, .. } => seekable, @@ -462,7 +463,6 @@ impl BaseSrcImpl for HttpSrc { /* No further data, end of stream */ gst_debug!(cat, obj: src, "End of stream"); *body = Some(current_body); - // src.set_automatic_eos(false); return Err(gst::FlowError::Eos); } Err(err) => { @@ -481,7 +481,7 @@ impl BaseSrcImpl for HttpSrc { } } -impl URIHandlerImpl for HttpSrc { +impl URIHandlerImpl for ReqwestHttpSrc { fn get_uri(&self, _element: &gst::URIHandler) -> Option { let settings = self.settings.lock().unwrap(); @@ -503,8 +503,8 @@ impl URIHandlerImpl for HttpSrc { } } -impl ObjectSubclass for HttpSrc { - const NAME: &'static str = "RsHttpSrc"; +impl ObjectSubclass for ReqwestHttpSrc { + const NAME: &'static str = "ReqwestHttpSrc"; type ParentType = gst_base::BaseSrc; type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; @@ -514,7 +514,7 @@ impl ObjectSubclass for HttpSrc { fn new() -> Self { Self { cat: gst::DebugCategory::new( - "rshttpsrc", + "reqwesthttpsrc", gst::DebugColorFlags::empty(), Some("Rust HTTP source"), ), @@ -559,8 +559,8 @@ impl ObjectSubclass for HttpSrc { pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), - "rshttpsrc", + "reqwesthttpsrc", gst::Rank::Primary + 100, - HttpSrc::get_type(), + ReqwestHttpSrc::get_type(), ) }