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
v.extend(
std::array::IntoIter::new([
[
(1u32 << 16).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(),
(16384u32 << 16).to_be_bytes(),
])
]
.into_iter()
.flatten(),
);
@ -525,7 +526,7 @@ fn write_tkhd(
// Matrix
v.extend(
std::array::IntoIter::new([
[
(1u32 << 16).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(),
(16384u32 << 16).to_be_bytes(),
])
]
.into_iter()
.flatten(),
);

View file

@ -537,8 +537,7 @@ impl FMP4Mux {
let mut buffers = drain_gops
.into_iter()
.rev()
.map(|gop| gop.buffers)
.flatten()
.flat_map(|gop| gop.buffers)
.collect::<Vec<Buffer>>();
// TODO: Write prft boxes before moof
@ -1472,7 +1471,7 @@ impl ElementImpl for DASHMP4Mux {
"sink",
gst::PadDirection::Sink,
gst::PadPresence::Always,
&std::array::IntoIter::new([
&[
gst::Structure::builder("video/x-h264")
.field("stream-format", gst::List::new(&[&"avc", &"avc3"]))
.field("alignment", "au")
@ -1491,7 +1490,8 @@ impl ElementImpl for DASHMP4Mux {
.field("channels", gst::IntRange::<i32>::new(1, u16::MAX as i32))
.field("rate", gst::IntRange::<i32>::new(1, i32::MAX))
.build(),
])
]
.into_iter()
.collect::<gst::Caps>(),
)
.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 v = q.next();
let version;
match v {
Some((ref k, ref v)) if k == "version" => version = Some((*v).to_string()),
None => version = None,
let version = match v {
Some((ref k, ref v)) if k == "version" => Some((*v).to_string()),
None => None,
Some(_) => return Err("Bad query, only 'version' is supported".to_owned()),
}
};
if q.next() != None {
return Err("Extra query terms, only 'version' is supported".to_owned());

View file

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

View file

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

View file

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

View file

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