rshttpsrc: rename to reqwesthttpsrc

This commit is contained in:
ahamedsajeer.15 2019-06-26 10:10:21 +05:30
parent 7679becc66
commit 42d4d10b43
5 changed files with 19 additions and 19 deletions

View file

@ -2,7 +2,7 @@
members = [ members = [
"gst-plugin-file", "gst-plugin-file",
"gst-plugin-http", "gst-plugin-reqwest",
"gst-plugin-flv", "gst-plugin-flv",
"gst-plugin-audiofx", "gst-plugin-audiofx",
"gst-plugin-togglerecord", "gst-plugin-togglerecord",

View file

@ -1,5 +1,5 @@
[package] [package]
name = "gst-plugin-http" name = "gst-plugin-reqwest"
version = "0.5.0" version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"] authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"

View file

@ -20,10 +20,10 @@ extern crate reqwest;
extern crate tokio; extern crate tokio;
extern crate url; extern crate url;
mod httpsrc; mod reqwesthttpsrc;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
httpsrc::register(plugin) reqwesthttpsrc::register(plugin)
} }
gst_plugin_define!( gst_plugin_define!(

View file

@ -76,7 +76,7 @@ impl Default for State {
} }
#[derive(Debug)] #[derive(Debug)]
pub struct HttpSrc { pub struct ReqwestHttpSrc {
cat: gst::DebugCategory, cat: gst::DebugCategory,
client: Client, client: Client,
settings: Mutex<Settings>, settings: Mutex<Settings>,
@ -85,13 +85,13 @@ pub struct HttpSrc {
canceller: Mutex<Option<oneshot::Sender<Bytes>>>, canceller: Mutex<Option<oneshot::Sender<Bytes>>>,
} }
impl HttpSrc { impl ReqwestHttpSrc {
fn set_location(&self, _element: &gst_base::BaseSrc, uri: &str) -> Result<(), glib::Error> { fn set_location(&self, _element: &gst_base::BaseSrc, uri: &str) -> Result<(), glib::Error> {
let state = self.state.lock().unwrap(); let state = self.state.lock().unwrap();
if let State::Started { .. } = *state { if let State::Started { .. } = *state {
return Err(glib::Error::new( return Err(glib::Error::new(
gst::URIError::BadState, 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); gst_debug!(cat, obj: src, "Doing new request {:?}", req);
let response_fut = req.send().and_then(|res| { let src_clone = src.clone();
// gst_debug!(cat, obj: src, "Response received: {:?}", res); let response_fut = req.send().and_then(move |res| {
gst_debug!(cat, obj: &src_clone, "Response received: {:?}", res);
Ok(res) Ok(res)
}); });
@ -245,7 +246,7 @@ impl HttpSrc {
} }
} }
impl ObjectImpl for HttpSrc { impl ObjectImpl for ReqwestHttpSrc {
glib_object_impl!(); glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) { 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 { fn is_seekable(&self, _src: &gst_base::BaseSrc) -> bool {
match *self.state.lock().unwrap() { match *self.state.lock().unwrap() {
State::Started { seekable, .. } => seekable, State::Started { seekable, .. } => seekable,
@ -462,7 +463,6 @@ impl BaseSrcImpl for HttpSrc {
/* No further data, end of stream */ /* No further data, end of stream */
gst_debug!(cat, obj: src, "End of stream"); gst_debug!(cat, obj: src, "End of stream");
*body = Some(current_body); *body = Some(current_body);
// src.set_automatic_eos(false);
return Err(gst::FlowError::Eos); return Err(gst::FlowError::Eos);
} }
Err(err) => { 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<String> { fn get_uri(&self, _element: &gst::URIHandler) -> Option<String> {
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();
@ -503,8 +503,8 @@ impl URIHandlerImpl for HttpSrc {
} }
} }
impl ObjectSubclass for HttpSrc { impl ObjectSubclass for ReqwestHttpSrc {
const NAME: &'static str = "RsHttpSrc"; const NAME: &'static str = "ReqwestHttpSrc";
type ParentType = gst_base::BaseSrc; type ParentType = gst_base::BaseSrc;
type Instance = gst::subclass::ElementInstanceStruct<Self>; type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>; type Class = subclass::simple::ClassStruct<Self>;
@ -514,7 +514,7 @@ impl ObjectSubclass for HttpSrc {
fn new() -> Self { fn new() -> Self {
Self { Self {
cat: gst::DebugCategory::new( cat: gst::DebugCategory::new(
"rshttpsrc", "reqwesthttpsrc",
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
Some("Rust HTTP source"), Some("Rust HTTP source"),
), ),
@ -559,8 +559,8 @@ impl ObjectSubclass for HttpSrc {
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register( gst::Element::register(
Some(plugin), Some(plugin),
"rshttpsrc", "reqwesthttpsrc",
gst::Rank::Primary + 100, gst::Rank::Primary + 100,
HttpSrc::get_type(), ReqwestHttpSrc::get_type(),
) )
} }