From fd03a232220da2f5eca07bcc3e0229089cca1e3e Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 18 May 2023 18:54:45 +0200 Subject: [PATCH] do not use 'str' as the variable name --- src/main.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3c39857..1958bed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,7 +148,7 @@ macro_rules! parse_and_apply_options { matches = name == opt_def.name; } if matches { - let arg = if let Some(ref str) = opt.value { Some(str) } else { None }; + let arg = if let Some(ref strval) = opt.value { Some(strval) } else { None }; let ret = opt_def.parse(&opt.name, arg); if let Ok((val, _)) = ret { opts.push(val); @@ -174,7 +174,7 @@ impl Transcoder { if ret.is_err() { return false; } let streamno = ret.unwrap(); - let sidx = if let Some(idx) = self.istr_opts.iter().position(|str| str.id == streamno) { + let sidx = if let Some(idx) = self.istr_opts.iter().position(|el| el.id == streamno) { idx } else { self.istr_opts.push(InputStreamOptions {id: streamno, drop: false, dec_opts: Vec::new() }); @@ -205,7 +205,7 @@ impl Transcoder { if ret.is_err() { return false; } let streamno = ret.unwrap(); - let sidx = if let Some(idx) = self.ostr_opts.iter().position(|str| str.id == streamno) { + let sidx = if let Some(idx) = self.ostr_opts.iter().position(|el| el.id == streamno) { idx } else { self.ostr_opts.push(OutputStreamOptions {id: streamno, enc_name: String::new(), enc_params: EncodeParameters::default(), enc_opts: Vec::new() }); @@ -473,7 +473,7 @@ impl Transcoder { true } fn apply_decoder_options(&self, dec: &mut dyn NADecoder, str_id: u32) { - if let Some(str_idx) = self.istr_opts.iter().position(|str| str.id == str_id) { + if let Some(str_idx) = self.istr_opts.iter().position(|el| el.id == str_id) { let dec_opts = dec.get_supported_options(); if dec_opts.is_empty() { return; } let name = format!("input stream {}", str_id); @@ -482,14 +482,14 @@ impl Transcoder { } fn register_output_stream(&mut self, cname: &str, istr: NAStreamRef, out_sm: &mut StreamManager, enc_reg: &RegisteredEncoders) -> bool { let out_id = out_sm.get_num_streams() as u32; - if let Some(str_idx) = self.istr_opts.iter().position(|str| str.id == (istr.get_num() as u32)) { + if let Some(str_idx) = self.istr_opts.iter().position(|el| el.id == (istr.get_num() as u32)) { if self.istr_opts[str_idx].drop { self.encoders.push(OutputMode::Drop); return true; } } - if let Some(str_idx) = self.ostr_opts.iter().position(|str| str.id == out_id) { + if let Some(str_idx) = self.ostr_opts.iter().position(|el| el.id == out_id) { let oopts = &mut self.ostr_opts[str_idx]; if oopts.enc_name.as_str() == "copy" && (cname == "any" || istr.get_info().get_name() == cname) { out_sm.add_stream_ref(istr); @@ -1108,12 +1108,12 @@ println!("stream {} - {} {}", i, s, info.get_name()); } } - let output_fmt = if let Some(ref str) = transcoder.output_fmt { - str + let output_fmt = if let Some(ref fmtname) = transcoder.output_fmt { + fmtname } else if transcoder.output_name.as_str() == "/dev/null" { "null" - } else if let Some(str) = detect::detect_format_by_name(transcoder.output_name.as_str()) { - str + } else if let Some(fmtname) = detect::detect_format_by_name(transcoder.output_name.as_str()) { + fmtname } else { println!("Cannot guess muxer for output"); return; @@ -1249,8 +1249,8 @@ println!("stream {} - {} {}", i, s, info.get_name()); }, }; } - 'reord_flush_loop: for str in dmx.get_streams() { - let src_id = str.get_num(); + 'reord_flush_loop: for stream in dmx.get_streams() { + let src_id = stream.get_num(); if let OutputMode::Encode(dst_id, ref mut encoder, ref mut cvt) = transcoder.encoders[src_id] { if let Some((_, _, ref mut reorderer)) = transcoder.decoders[src_id] { while let Some(frm) = reorderer.get_last_frames() { -- 2.39.5