Fix various clippy warnings

This commit is contained in:
Sebastian Dröge 2022-01-12 19:51:08 +02:00
parent 0bc7697600
commit 81f5f0f60c
7 changed files with 27 additions and 30 deletions

View file

@ -441,7 +441,7 @@ fn write_mvhd(
// Matrix // Matrix
v.extend( v.extend(
std::array::IntoIter::new([ [
(1u32 << 16).to_be_bytes(), (1u32 << 16).to_be_bytes(),
0u32.to_be_bytes(), 0u32.to_be_bytes(),
0u32.to_be_bytes(), 0u32.to_be_bytes(),
@ -451,7 +451,8 @@ fn write_mvhd(
0u32.to_be_bytes(), 0u32.to_be_bytes(),
0u32.to_be_bytes(), 0u32.to_be_bytes(),
(16384u32 << 16).to_be_bytes(), (16384u32 << 16).to_be_bytes(),
]) ]
.into_iter()
.flatten(), .flatten(),
); );
@ -525,7 +526,7 @@ fn write_tkhd(
// Matrix // Matrix
v.extend( v.extend(
std::array::IntoIter::new([ [
(1u32 << 16).to_be_bytes(), (1u32 << 16).to_be_bytes(),
0u32.to_be_bytes(), 0u32.to_be_bytes(),
0u32.to_be_bytes(), 0u32.to_be_bytes(),
@ -535,7 +536,8 @@ fn write_tkhd(
0u32.to_be_bytes(), 0u32.to_be_bytes(),
0u32.to_be_bytes(), 0u32.to_be_bytes(),
(16384u32 << 16).to_be_bytes(), (16384u32 << 16).to_be_bytes(),
]) ]
.into_iter()
.flatten(), .flatten(),
); );

View file

@ -537,8 +537,7 @@ impl FMP4Mux {
let mut buffers = drain_gops let mut buffers = drain_gops
.into_iter() .into_iter()
.rev() .rev()
.map(|gop| gop.buffers) .flat_map(|gop| gop.buffers)
.flatten()
.collect::<Vec<Buffer>>(); .collect::<Vec<Buffer>>();
// TODO: Write prft boxes before moof // TODO: Write prft boxes before moof
@ -1472,7 +1471,7 @@ impl ElementImpl for DASHMP4Mux {
"sink", "sink",
gst::PadDirection::Sink, gst::PadDirection::Sink,
gst::PadPresence::Always, gst::PadPresence::Always,
&std::array::IntoIter::new([ &[
gst::Structure::builder("video/x-h264") gst::Structure::builder("video/x-h264")
.field("stream-format", gst::List::new(&[&"avc", &"avc3"])) .field("stream-format", gst::List::new(&[&"avc", &"avc3"]))
.field("alignment", "au") .field("alignment", "au")
@ -1491,7 +1490,8 @@ impl ElementImpl for DASHMP4Mux {
.field("channels", gst::IntRange::<i32>::new(1, u16::MAX as i32)) .field("channels", gst::IntRange::<i32>::new(1, u16::MAX as i32))
.field("rate", gst::IntRange::<i32>::new(1, i32::MAX)) .field("rate", gst::IntRange::<i32>::new(1, i32::MAX))
.build(), .build(),
]) ]
.into_iter()
.collect::<gst::Caps>(), .collect::<gst::Caps>(),
) )
.unwrap(); .unwrap();

View file

@ -109,13 +109,12 @@ pub fn parse_s3_url(url_str: &str) -> Result<GstS3Url, String> {
let mut q = url.query_pairs(); let mut q = url.query_pairs();
let v = q.next(); let v = q.next();
let version;
match v { let version = match v {
Some((ref k, ref v)) if k == "version" => version = Some((*v).to_string()), Some((ref k, ref v)) if k == "version" => Some((*v).to_string()),
None => version = None, None => None,
Some(_) => return Err("Bad query, only 'version' is supported".to_owned()), Some(_) => return Err("Bad query, only 'version' is supported".to_owned()),
} };
if q.next() != None { if q.next() != None {
return Err("Extra query terms, only 'version' is supported".to_owned()); return Err("Extra query terms, only 'version' is supported".to_owned());

View file

@ -220,8 +220,7 @@ impl JsonGstParse {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let drain; let drain = if let Some(buffer) = buffer {
if let Some(buffer) = buffer {
let buffer = buffer.into_mapped_buffer_readable().map_err(|_| { let buffer = buffer.into_mapped_buffer_readable().map_err(|_| {
gst::element_error!( gst::element_error!(
element, element,
@ -233,10 +232,10 @@ impl JsonGstParse {
})?; })?;
state.reader.push(buffer); state.reader.push(buffer);
drain = false; false
} else { } else {
drain = true; true
} };
loop { loop {
let seeking = state.seeking; let seeking = state.seeking;

View file

@ -373,8 +373,7 @@ impl MccParse {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let drain; let drain = if let Some(buffer) = buffer {
if let Some(buffer) = buffer {
let buffer = buffer.into_mapped_buffer_readable().map_err(|_| { let buffer = buffer.into_mapped_buffer_readable().map_err(|_| {
element_error!( element_error!(
element, element,
@ -386,10 +385,10 @@ impl MccParse {
})?; })?;
state.reader.push(buffer); state.reader.push(buffer);
drain = false; false
} else { } else {
drain = true; true
} };
loop { loop {
let line = state.line(drain); let line = state.line(drain);

View file

@ -299,8 +299,7 @@ impl SccParse {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let drain; let drain = if let Some(buffer) = buffer {
if let Some(buffer) = buffer {
let buffer = buffer.into_mapped_buffer_readable().map_err(|_| { let buffer = buffer.into_mapped_buffer_readable().map_err(|_| {
element_error!( element_error!(
element, element,
@ -312,10 +311,10 @@ impl SccParse {
})?; })?;
state.reader.push(buffer); state.reader.push(buffer);
drain = false; false
} else { } else {
drain = true; true
} };
loop { loop {
let line = state.line(drain); let line = state.line(drain);

View file

@ -137,7 +137,7 @@ impl Frame {
let overlays = frame let overlays = frame
.buffer() .buffer()
.iter_meta::<gst_video::VideoOverlayCompositionMeta>() .iter_meta::<gst_video::VideoOverlayCompositionMeta>()
.map(|meta| { .flat_map(|meta| {
meta.overlay() meta.overlay()
.iter() .iter()
.filter_map(|rect| { .filter_map(|rect| {
@ -168,7 +168,6 @@ impl Frame {
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
}) })
.flatten()
.collect(); .collect();
Ok(Self { frame, overlays }) Ok(Self { frame, overlays })