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 = [
"gst-plugin-file",
"gst-plugin-http",
"gst-plugin-reqwest",
"gst-plugin-flv",
"gst-plugin-audiofx",
"gst-plugin-togglerecord",

View file

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

View file

@ -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!(

View file

@ -76,7 +76,7 @@ impl Default for State {
}
#[derive(Debug)]
pub struct HttpSrc {
pub struct ReqwestHttpSrc {
cat: gst::DebugCategory,
client: Client,
settings: Mutex<Settings>,
@ -85,13 +85,13 @@ pub struct HttpSrc {
canceller: Mutex<Option<oneshot::Sender<Bytes>>>,
}
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<String> {
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<Self>;
type Class = subclass::simple::ClassStruct<Self>;
@ -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(),
)
}