diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2018-12-19 15:31:42 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-12-19 15:32:03 +0300 |
commit | 04955f61d79e6e4f23fcf8531a0589e43baa0a93 (patch) | |
tree | acce7ec4c8d9de9837f63212c696c2143b69b57c | |
parent | f374d7fedf5429b330b7a0f69e652098faf67732 (diff) |
Update to reqwest 0.9, rand 0.6 and parking_lot 0.7
-rw-r--r-- | gst-plugin-http/Cargo.toml | 3 | ||||
-rw-r--r-- | gst-plugin-http/src/httpsrc.rs | 26 | ||||
-rw-r--r-- | gst-plugin-http/src/lib.rs | 1 | ||||
-rw-r--r-- | gst-plugin-threadshare/Cargo.toml | 2 | ||||
-rw-r--r-- | gst-plugin-togglerecord/Cargo.toml | 2 |
5 files changed, 20 insertions, 14 deletions
diff --git a/gst-plugin-http/Cargo.toml b/gst-plugin-http/Cargo.toml index 4ac78ccfb..45e7795c9 100644 --- a/gst-plugin-http/Cargo.toml +++ b/gst-plugin-http/Cargo.toml @@ -10,7 +10,8 @@ url = "1.1" glib = { git = "https://github.com/gtk-rs/glib" } gst-plugin = { path="../gst-plugin" } gst-plugin-simple = { path="../gst-plugin-simple" } -reqwest = "0.8" +reqwest = "0.9" +hyperx = "0.13" gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } [lib] diff --git a/gst-plugin-http/src/httpsrc.rs b/gst-plugin-http/src/httpsrc.rs index 6a85b6a49..0b5461f4a 100644 --- a/gst-plugin-http/src/httpsrc.rs +++ b/gst-plugin-http/src/httpsrc.rs @@ -6,8 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use reqwest::header::{ - AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec, Range, RangeUnit, +use hyperx::header::{ + AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec, Headers, Range, + RangeUnit, }; use reqwest::{Client, Response}; use std::io::Read; @@ -68,18 +69,23 @@ impl HttpSrc { stop: Option<u64>, ) -> Result<StreamingState, gst::ErrorMessage> { let cat = self.cat; - let mut req = self.client.get(uri.clone()); + let req = self.client.get(uri.clone()); + + let mut headers = Headers::new(); match (start != 0, stop) { (false, None) => (), (true, None) => { - req.header(Range::Bytes(vec![ByteRangeSpec::AllFrom(start)])); + headers.set(Range::Bytes(vec![ByteRangeSpec::AllFrom(start)])); } (_, Some(stop)) => { - req.header(Range::Bytes(vec![ByteRangeSpec::FromTo(start, stop - 1)])); + headers.set(Range::Bytes(vec![ByteRangeSpec::FromTo(start, stop - 1)])); } } + // Add all headers for the request here + let req = req.headers(headers.into()); + gst_debug!(cat, obj: src, "Doing new request {:?}", req); let response = try!(req.send().or_else(|err| { @@ -98,12 +104,10 @@ impl HttpSrc { )); } - let size = response - .headers() - .get() - .map(|&ContentLength(cl)| cl + start); + let headers = Headers::from(response.headers()); + let size = headers.get().map(|&ContentLength(cl)| cl + start); - let accept_byte_ranges = if let Some(&AcceptRanges(ref ranges)) = response.headers().get() { + let accept_byte_ranges = if let Some(&AcceptRanges(ref ranges)) = headers.get() { ranges.iter().any(|u| *u == RangeUnit::Bytes) } else { false @@ -114,7 +118,7 @@ impl HttpSrc { let position = if let Some(&ContentRange(ContentRangeSpec::Bytes { range: Some((range_start, _)), .. - })) = response.headers().get() + })) = headers.get() { range_start } else { diff --git a/gst-plugin-http/src/lib.rs b/gst-plugin-http/src/lib.rs index 719365360..bf541b3c0 100644 --- a/gst-plugin-http/src/lib.rs +++ b/gst-plugin-http/src/lib.rs @@ -14,6 +14,7 @@ extern crate gst_plugin; extern crate gst_plugin_simple; #[macro_use] extern crate gstreamer as gst; +extern crate hyperx; extern crate reqwest; extern crate url; diff --git a/gst-plugin-threadshare/Cargo.toml b/gst-plugin-threadshare/Cargo.toml index 967c1b823..211adeaf5 100644 --- a/gst-plugin-threadshare/Cargo.toml +++ b/gst-plugin-threadshare/Cargo.toml @@ -22,7 +22,7 @@ tokio-current-thread = "0.1" futures = "0.1" lazy_static = "1.0" either = "1.0" -rand = "0.5" +rand = "0.6" net2 = "0.2" [target.'cfg(windows)'.dependencies] diff --git a/gst-plugin-togglerecord/Cargo.toml b/gst-plugin-togglerecord/Cargo.toml index b015cefd4..c1c6873e1 100644 --- a/gst-plugin-togglerecord/Cargo.toml +++ b/gst-plugin-togglerecord/Cargo.toml @@ -10,7 +10,7 @@ gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", fea gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = true } gio = { git = "https://github.com/gtk-rs/gio", optional = true } -parking_lot = "0.6" +parking_lot = "0.7" [dev-dependencies] either = "1.0" |