diff --git a/net/rusoto/Cargo.toml b/net/rusoto/Cargo.toml index 60722e89..7247a764 100644 --- a/net/rusoto/Cargo.toml +++ b/net/rusoto/Cargo.toml @@ -14,16 +14,16 @@ bytes = "1.0" futures = "0.3" gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -rusoto_core = "0.46" -rusoto_s3 = "0.46" -rusoto_credential = "0.46" -rusoto_signature = "0.46" +rusoto_core = "0.47" +rusoto_s3 = "0.47" +rusoto_credential = "0.47" +rusoto_signature = "0.47" url = "2" percent-encoding = "2" tokio = { version = "1.0", features = [ "rt-multi-thread" ] } -async-tungstenite = { version = "0.13", features = ["tokio", "tokio-runtime", "tokio-native-tls"] } -nom = "6" -crc = "1.8.1" +async-tungstenite = { version = "0.14", features = ["tokio", "tokio-runtime", "tokio-native-tls"] } +nom = "7" +crc = "2" byteorder = "1.3.4" once_cell = "1.0" serde = "1" diff --git a/net/rusoto/src/aws_transcriber/packet/mod.rs b/net/rusoto/src/aws_transcriber/packet/mod.rs index 01581f41..8bbbba43 100644 --- a/net/rusoto/src/aws_transcriber/packet/mod.rs +++ b/net/rusoto/src/aws_transcriber/packet/mod.rs @@ -16,7 +16,6 @@ // Boston, MA 02110-1335, USA. use byteorder::{BigEndian, WriteBytesExt}; -use crc::crc32; use nom::{ self, bytes::complete::take, combinator::map_res, multi::many0, number::complete::be_u16, number::complete::be_u32, number::complete::be_u8, sequence::tuple, IResult, @@ -24,6 +23,8 @@ use nom::{ use std::borrow::Cow; use std::io::{self, Write}; +const CRC: crc::Crc = crc::Crc::::new(&crc::CRC_32_BZIP2); + #[derive(Debug)] struct Prelude { total_bytes: u32, @@ -87,11 +88,11 @@ pub fn encode_packet(payload: &[u8], headers: &[Header]) -> Result, io:: (&mut res[0..4]).write_u32::(total_length as u32)?; // Rewrite the prelude crc since we replaced the lengths - let prelude_crc = crc32::checksum_ieee(&res[0..8]); + let prelude_crc = CRC.checksum(&res[0..8]); (&mut res[8..12]).write_u32::(prelude_crc)?; // Message CRC - let message_crc = crc32::checksum_ieee(&res); + let message_crc = CRC.checksum(&res); res.write_u32::(message_crc)?; Ok(res) @@ -101,7 +102,7 @@ fn parse_prelude(input: &[u8]) -> IResult<&[u8], Prelude> { map_res( tuple((be_u32, be_u32, be_u32)), |(total_bytes, header_bytes, prelude_crc)| { - let sum = crc32::checksum_ieee(&input[0..8]); + let sum = CRC.checksum(&input[0..8]); if prelude_crc != sum { return Err(nom::Err::Error(( "Prelude CRC doesn't match", @@ -148,7 +149,7 @@ pub fn parse_packet(input: &[u8]) -> IResult<&[u8], Packet> { let (remainder, prelude) = parse_prelude(input)?; // Check the crc of the whole input - let sum = crc32::checksum_ieee(&input[..input.len() - 4]); + let sum = CRC.checksum(&input[..input.len() - 4]); let (_, msg_crc) = be_u32(&input[input.len() - 4..])?; if msg_crc != sum { diff --git a/text/regex/Cargo.toml b/text/regex/Cargo.toml index 66c82ab5..8191646f 100644 --- a/text/regex/Cargo.toml +++ b/text/regex/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" [dependencies] once_cell = "1.0" -regex = "1" +regex = "1.5" [dependencies.gst] git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" diff --git a/text/wrap/Cargo.toml b/text/wrap/Cargo.toml index 303f4a85..0e6a7ef1 100644 --- a/text/wrap/Cargo.toml +++ b/text/wrap/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" [dependencies] once_cell = "1.0" -textwrap = { version = "0.13.2", features = ["hyphenation"] } +textwrap = { version = "0.14", features = ["hyphenation"] } hyphenation = "0.8" [dependencies.gst] diff --git a/text/wrap/src/gsttextwrap/imp.rs b/text/wrap/src/gsttextwrap/imp.rs index 293c884b..7fef1f06 100644 --- a/text/wrap/src/gsttextwrap/imp.rs +++ b/text/wrap/src/gsttextwrap/imp.rs @@ -62,8 +62,36 @@ impl Default for Settings { } } +// FIXME: https://github.com/mgeisler/textwrap/issues/412 +#[derive(Debug)] +struct WrappedWordSplitter(Box); + +impl textwrap::word_splitters::WordSplitter for WrappedWordSplitter { + fn split_points(&self, word: &str) -> Vec { + self.0.split_points(word) + } +} + +impl Clone for WrappedWordSplitter { + fn clone(&self) -> Self { + WrappedWordSplitter(unsafe { + std::mem::transmute::< + Box, + Box, + >(self.0.clone_box()) + }) + } +} + struct State { - options: Option>>, + options: Option< + textwrap::Options< + 'static, + textwrap::wrap_algorithms::OptimalFit, + textwrap::word_separators::UnicodeBreakProperties, + WrappedWordSplitter, + >, + >, current_text: String, start_ts: Option, @@ -125,14 +153,14 @@ impl TextWrap { Ok(standard) => standard, }; - Some(textwrap::Options::with_splitter( + Some(textwrap::Options::with_word_splitter( settings.columns as usize, - Box::new(standard), + WrappedWordSplitter(Box::new(standard)), )) } else { - Some(textwrap::Options::with_splitter( + Some(textwrap::Options::with_word_splitter( settings.columns as usize, - Box::new(textwrap::NoHyphenation), + WrappedWordSplitter(Box::new(textwrap::word_splitters::NoHyphenation)), )) }; } @@ -221,7 +249,7 @@ impl TextWrap { .as_ref() .expect("We should have a wrapper by now"); - let lines = textwrap::wrap(¤t_text, options); + let lines = textwrap::wrap(¤t_text, &*options); let mut chunks = lines.chunks(n_lines as usize).peekable(); let mut trailing = "".to_string(); @@ -287,7 +315,7 @@ impl TextWrap { .options .as_ref() .expect("We should have a wrapper by now"); - textwrap::fill(data, options) + textwrap::fill(data, &*options) }; // If the lines property was set, we want to split the result into buffers diff --git a/video/closedcaption/Cargo.toml b/video/closedcaption/Cargo.toml index f5713080..44a08526 100644 --- a/video/closedcaption/Cargo.toml +++ b/video/closedcaption/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" [dependencies] anyhow = "1" -nom = "6.0" +nom = "7.0" either = "1" uuid = { version = "0.8", features = ["v4"] } chrono = "0.4" diff --git a/video/closedcaption/src/mcc_parse/parser.rs b/video/closedcaption/src/mcc_parse/parser.rs index 3ebef48a..f08ffaa2 100644 --- a/video/closedcaption/src/mcc_parse/parser.rs +++ b/video/closedcaption/src/mcc_parse/parser.rs @@ -257,7 +257,7 @@ fn mcc_payload(s: &[u8]) -> IResult<&[u8], Vec> { context( "invalid MCC payload", - fold_many1(mcc_payload_item, Vec::new(), |mut acc: Vec<_>, item| { + fold_many1(mcc_payload_item, Vec::new, |mut acc: Vec<_>, item| { match item { Either::Left(val) => acc.push(val), Either::Right(vals) => acc.extend_from_slice(vals), diff --git a/video/closedcaption/src/scc_parse/parser.rs b/video/closedcaption/src/scc_parse/parser.rs index 26c167e5..ca2ae35f 100644 --- a/video/closedcaption/src/scc_parse/parser.rs +++ b/video/closedcaption/src/scc_parse/parser.rs @@ -109,7 +109,7 @@ fn scc_payload(s: &[u8]) -> IResult<&[u8], Vec> { context( "invalid SCC payload", - fold_many1(parse_item, Vec::new(), |mut acc: Vec<_>, item| { + fold_many1(parse_item, Vec::new, |mut acc: Vec<_>, item| { acc.push(item.0); acc.push(item.1); acc diff --git a/video/rspng/Cargo.toml b/video/rspng/Cargo.toml index 978cd7c5..bd074538 100644 --- a/video/rspng/Cargo.toml +++ b/video/rspng/Cargo.toml @@ -10,7 +10,7 @@ description = "An PNG encoder/decoder written in pure Rust" [dependencies] gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst_video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -png = "0.16.3" +png = "0.17" once_cell = "1" parking_lot = "0.11" atomic_refcell = "0.1" diff --git a/video/rspng/src/pngenc/imp.rs b/video/rspng/src/pngenc/imp.rs index 6d1829cd..dbe1e638 100644 --- a/video/rspng/src/pngenc/imp.rs +++ b/video/rspng/src/pngenc/imp.rs @@ -124,8 +124,8 @@ impl State { gst_video::VideoFormat::Gray8 | gst_video::VideoFormat::Gray16Be => { png::ColorType::Grayscale } - gst_video::VideoFormat::Rgb => png::ColorType::RGB, - gst_video::VideoFormat::Rgba => png::ColorType::RGBA, + gst_video::VideoFormat::Rgb => png::ColorType::Rgb, + gst_video::VideoFormat::Rgba => png::ColorType::Rgba, _ => { gst_error!(CAT, "format is not supported yet"); unreachable!() @@ -333,6 +333,15 @@ impl VideoEncoderImpl for PngEncoder { let mut state_guard = self.state.lock(); let state = state_guard.as_mut().ok_or(gst::FlowError::NotNegotiated)?; + // FIXME: https://github.com/image-rs/image-png/issues/301 + { + let settings = self.settings.lock(); + state.reset(*settings).map_err(|err| { + err.log_with_object(element); + gst::FlowError::Error + })?; + } + gst_debug!( CAT, obj: element,