Update various dependencies

This commit is contained in:
Sebastian Dröge 2021-08-26 09:18:58 +03:00
parent a8a3a6ec3e
commit 4a870af19c
10 changed files with 65 additions and 27 deletions

View file

@ -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"

View file

@ -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<u32> = crc::Crc::<u32>::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<Vec<u8>, io::
(&mut res[0..4]).write_u32::<BigEndian>(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::<BigEndian>(prelude_crc)?;
// Message CRC
let message_crc = crc32::checksum_ieee(&res);
let message_crc = CRC.checksum(&res);
res.write_u32::<BigEndian>(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 {

View file

@ -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"

View file

@ -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]

View file

@ -62,8 +62,36 @@ impl Default for Settings {
}
}
// FIXME: https://github.com/mgeisler/textwrap/issues/412
#[derive(Debug)]
struct WrappedWordSplitter(Box<dyn textwrap::word_splitters::WordSplitter + Send>);
impl textwrap::word_splitters::WordSplitter for WrappedWordSplitter {
fn split_points(&self, word: &str) -> Vec<usize> {
self.0.split_points(word)
}
}
impl Clone for WrappedWordSplitter {
fn clone(&self) -> Self {
WrappedWordSplitter(unsafe {
std::mem::transmute::<
Box<dyn textwrap::word_splitters::WordSplitter + 'static>,
Box<dyn textwrap::word_splitters::WordSplitter + Send + 'static>,
>(self.0.clone_box())
})
}
}
struct State {
options: Option<textwrap::Options<'static, Box<dyn textwrap::WordSplitter + Send>>>,
options: Option<
textwrap::Options<
'static,
textwrap::wrap_algorithms::OptimalFit,
textwrap::word_separators::UnicodeBreakProperties,
WrappedWordSplitter,
>,
>,
current_text: String,
start_ts: Option<gst::ClockTime>,
@ -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(&current_text, options);
let lines = textwrap::wrap(&current_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

View file

@ -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"

View file

@ -257,7 +257,7 @@ fn mcc_payload(s: &[u8]) -> IResult<&[u8], Vec<u8>> {
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),

View file

@ -109,7 +109,7 @@ fn scc_payload(s: &[u8]) -> IResult<&[u8], Vec<u8>> {
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

View file

@ -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"

View file

@ -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,