aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2023-02-17 18:23:38 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2023-02-17 18:23:38 +0100
commit405cec9eed5d7f58440ec8495f5cbc1f5c6fee40 (patch)
treea115c0efc0cf1d50e54590dcb1663fec4a9751c4
parentf638a5b1b3241b3433689983aca22d9e6518a64f (diff)
downloadnihav-405cec9eed5d7f58440ec8495f5cbc1f5c6fee40.tar.gz
rename "str" variable to avoid confusion with the primitive type
-rw-r--r--nihav-codec-support/src/test/enc_video.rs4
-rw-r--r--nihav-commonfmt/src/codecs/cinepakenc.rs4
-rw-r--r--nihav-commonfmt/src/muxers/avi.rs36
-rw-r--r--nihav-core/src/demuxers/mod.rs14
-rw-r--r--nihav-core/src/frame.rs12
-rw-r--r--nihav-core/src/muxers/mod.rs10
-rw-r--r--nihav-core/src/options.rs12
-rw-r--r--nihav-itu/src/codecs/h264/mod.rs4
-rw-r--r--nihav-realmedia/src/codecs/rv60.rs12
-rw-r--r--nihav-registry/src/detect.rs6
10 files changed, 57 insertions, 57 deletions
diff --git a/nihav-codec-support/src/test/enc_video.rs b/nihav-codec-support/src/test/enc_video.rs
index 16ea415..900a040 100644
--- a/nihav-codec-support/src/test/enc_video.rs
+++ b/nihav-codec-support/src/test/enc_video.rs
@@ -217,7 +217,7 @@ pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &Encode
let mut br = ByteReader::new(&mut fr);
let mut dmx = create_demuxer(dmx_f, &mut br).unwrap();
- let in_stream = dmx.get_streams().find(|str| str.get_media_type() == dec_config.stream_type).unwrap();
+ let in_stream = dmx.get_streams().find(|strm| strm.get_media_type() == dec_config.stream_type).unwrap();
let in_stream_id = in_stream.id;
let decfunc = dec_config.dec_reg.find_decoder(in_stream.get_info().get_name()).unwrap();
let mut dec = (decfunc)();
@@ -326,7 +326,7 @@ pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTes
let mut br = ByteReader::new(&mut fr);
let mut dmx = create_demuxer(dmx_f, &mut br).unwrap();
- let in_stream = dmx.get_streams().find(|str| str.get_media_type() == dec_config.stream_type).unwrap();
+ let in_stream = dmx.get_streams().find(|strm| strm.get_media_type() == dec_config.stream_type).unwrap();
let in_stream_id = in_stream.id;
let decfunc = dec_config.dec_reg.find_decoder(in_stream.get_info().get_name()).unwrap();
let mut dec = (decfunc)();
diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs
index 604bc87..c6af8f6 100644
--- a/nihav-commonfmt/src/codecs/cinepakenc.rs
+++ b/nihav-commonfmt/src/codecs/cinepakenc.rs
@@ -1053,8 +1053,8 @@ impl NAOptionHandler for CinepakEncoder {
}
},
"quant_mode" => {
- if let NAValue::String(ref str) = option.value {
- match str.as_str() {
+ if let NAValue::String(ref strval) = option.value {
+ match strval.as_str() {
"elbg" => self.qmode = QuantMode::ELBG,
"hybrid" => self.qmode = QuantMode::Hybrid,
"mediancut" => self.qmode = QuantMode::MedianCut,
diff --git a/nihav-commonfmt/src/muxers/avi.rs b/nihav-commonfmt/src/muxers/avi.rs
index 0977aac..fad358c 100644
--- a/nihav-commonfmt/src/muxers/avi.rs
+++ b/nihav-commonfmt/src/muxers/avi.rs
@@ -72,10 +72,10 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
if strmgr.get_num_streams() > 99 {
return Err(MuxerError::UnsupportedFormat);
}
- for (str_no, str) in strmgr.iter().enumerate() {
- if str.get_media_type() == StreamType::Video {
+ for (str_no, strm) in strmgr.iter().enumerate() {
+ if strm.get_media_type() == StreamType::Video {
self.video_str = Some(str_no);
- self.video_id = str.id;
+ self.video_id = strm.id;
break;
}
}
@@ -111,20 +111,20 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.pal_pos.clear();
self.pal_pos.resize(strmgr.get_num_streams(), 0);
- for (strno, str) in strmgr.iter().enumerate() {
+ for (strno, strm) in strmgr.iter().enumerate() {
let strl_pos = self.bw.tell() + 8;
self.bw.write_buf(b"LIST\0\0\0\0strlstrh")?;
self.bw.write_u32le(56)?; // strh size
- match str.get_media_type() {
+ match strm.get_media_type() {
StreamType::Video => {
self.bw.write_buf(b"vids")?;
- let fcc = find_avi_fourcc(str.get_info().get_name());
+ let fcc = find_avi_fourcc(strm.get_info().get_name());
if fcc.is_none() {
return Err(MuxerError::UnsupportedFormat);
}
self.bw.write_buf(&fcc.unwrap_or([0; 4]))?;
- let vinfo = str.get_info().get_properties().get_video_info().unwrap();
+ let vinfo = strm.get_info().get_properties().get_video_info().unwrap();
if vinfo.width >= (1 << 16) || vinfo.height >= (1 << 16) {
return Err(MuxerError::UnsupportedFormat);
}
@@ -141,7 +141,7 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
};
self.stream_info.push(AVIStream {
strh_pos: self.bw.tell(),
- is_video: str.get_media_type() == StreamType::Video,
+ is_video: strm.get_media_type() == StreamType::Video,
nframes: 0,
max_size: 0,
});
@@ -150,8 +150,8 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.bw.write_u16le(0)?; // priority
self.bw.write_u16le(0)?; // language
self.bw.write_u32le(0)?; // initial frames
- self.bw.write_u32le(str.tb_num)?;
- self.bw.write_u32le(str.tb_den)?;
+ self.bw.write_u32le(strm.tb_num)?;
+ self.bw.write_u32le(strm.tb_den)?;
self.bw.write_u32le(0)?; // start
self.bw.write_u32le(0)?; // length
self.bw.write_u32le(0)?; // suggested buffer size
@@ -165,9 +165,9 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.bw.write_buf(b"strf")?;
self.bw.write_u32le(0)?;
let strf_pos = self.bw.tell();
- match str.get_media_type() {
+ match strm.get_media_type() {
StreamType::Video => {
- let vinfo = str.get_info().get_properties().get_video_info().unwrap();
+ let vinfo = strm.get_info().get_properties().get_video_info().unwrap();
let hdr_pos = self.bw.tell();
self.bw.write_u32le(0)?;
self.bw.write_u32le(vinfo.width as u32)?;
@@ -179,7 +179,7 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.bw.write_u16le(1)?;
self.bw.write_u16le(8)?;
}
- let fcc = find_avi_fourcc(str.get_info().get_name());
+ let fcc = find_avi_fourcc(strm.get_info().get_name());
if fcc.is_none() {
return Err(MuxerError::UnsupportedFormat);
}
@@ -198,7 +198,7 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.bw.write_u32le(0)?; // total colors
self.bw.write_u32le(0)?; // important colors
}
- if let Some(ref edata) = str.get_info().get_extradata() {
+ if let Some(ref edata) = strm.get_info().get_extradata() {
self.bw.write_buf(edata.as_slice())?;
}
let bisize = self.bw.tell() - hdr_pos;
@@ -207,8 +207,8 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.bw.seek(SeekFrom::End(0))?;
},
StreamType::Audio => {
- let ainfo = str.get_info().get_properties().get_audio_info().unwrap();
- let twocc = find_wav_twocc(str.get_info().get_name());
+ let ainfo = strm.get_info().get_properties().get_audio_info().unwrap();
+ let twocc = find_wav_twocc(strm.get_info().get_name());
if twocc.is_none() {
return Err(MuxerError::UnsupportedFormat);
}
@@ -218,12 +218,12 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
self.bw.write_u32le(0)?; // avg bytes per second
self.bw.write_u16le(ainfo.block_len as u16)?;
self.bw.write_u16le(ainfo.format.bits as u16)?;
- if let Some(ref edata) = str.get_info().get_extradata() {
+ if let Some(ref edata) = strm.get_info().get_extradata() {
self.bw.write_buf(edata.as_slice())?;
}
},
StreamType::Subtitles => {
- if let Some(ref edata) = str.get_info().get_extradata() {
+ if let Some(ref edata) = strm.get_info().get_extradata() {
self.bw.write_buf(edata.as_slice())?;
}
},
diff --git a/nihav-core/src/demuxers/mod.rs b/nihav-core/src/demuxers/mod.rs
index 181f88a..300b6af 100644
--- a/nihav-core/src/demuxers/mod.rs
+++ b/nihav-core/src/demuxers/mod.rs
@@ -45,18 +45,18 @@ pub trait DemuxCore<'a>: NAOptionHandler {
/// An auxiliary trait to make bytestream reader read packet data.
pub trait NAPacketReader {
/// Reads input and constructs a packet containing it.
- fn read_packet(&mut self, str: NAStreamRef, ts: NATimeInfo, keyframe: bool, size: usize) -> DemuxerResult<NAPacket>;
+ fn read_packet(&mut self, strm: NAStreamRef, ts: NATimeInfo, keyframe: bool, size: usize) -> DemuxerResult<NAPacket>;
/// Reads input into already existing packet.
fn fill_packet(&mut self, pkt: &mut NAPacket) -> DemuxerResult<()>;
}
impl<'a> NAPacketReader for ByteReader<'a> {
- fn read_packet(&mut self, str: NAStreamRef, ts: NATimeInfo, kf: bool, size: usize) -> DemuxerResult<NAPacket> {
+ fn read_packet(&mut self, strm: NAStreamRef, ts: NATimeInfo, kf: bool, size: usize) -> DemuxerResult<NAPacket> {
let mut buf: Vec<u8> = Vec::with_capacity(size);
if buf.capacity() < size { return Err(DemuxerError::MemoryError); }
buf.resize(size, 0);
self.read_buf(buf.as_mut_slice())?;
- let pkt = NAPacket::new(str, ts, kf, buf);
+ let pkt = NAPacket::new(strm, ts, kf, buf);
Ok(pkt)
}
fn fill_packet(&mut self, pkt: &mut NAPacket) -> DemuxerResult<()> {
@@ -300,8 +300,8 @@ impl SeekIndex {
}
/// Adds a new stream to the index.
pub fn stream_id_to_index(&self, id: u32) -> Option<usize> {
- for (idx, str) in self.seek_info.iter().enumerate() {
- if str.id == id {
+ for (idx, strm) in self.seek_info.iter().enumerate() {
+ if strm.id == id {
return Some(idx);
}
}
@@ -354,10 +354,10 @@ pub struct Demuxer<'a> {
impl<'a> Demuxer<'a> {
/// Constructs a new `Demuxer` instance.
- fn new(dmx: Box<dyn DemuxCore<'a> + 'a>, str: StreamManager, seek_idx: SeekIndex) -> Self {
+ fn new(dmx: Box<dyn DemuxCore<'a> + 'a>, strmgr: StreamManager, seek_idx: SeekIndex) -> Self {
Demuxer {
dmx,
- streams: str,
+ streams: strmgr,
seek_idx,
}
}
diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs
index 792bfb4..61741d7 100644
--- a/nihav-core/src/frame.rs
+++ b/nihav-core/src/frame.rs
@@ -1388,14 +1388,14 @@ pub struct NAPacket {
impl NAPacket {
/// Constructs a new `NAPacket` instance.
- pub fn new(str: NAStreamRef, ts: NATimeInfo, kf: bool, vec: Vec<u8>) -> Self {
+ pub fn new(stream: NAStreamRef, ts: NATimeInfo, kf: bool, vec: Vec<u8>) -> Self {
// let mut vec: Vec<u8> = Vec::new();
// vec.resize(size, 0);
- NAPacket { stream: str, ts, keyframe: kf, buffer: NABufferRef::new(vec), side_data: Vec::new() }
+ NAPacket { stream, ts, keyframe: kf, buffer: NABufferRef::new(vec), side_data: Vec::new() }
}
/// Constructs a new `NAPacket` instance reusing a buffer reference.
- pub fn new_from_refbuf(str: NAStreamRef, ts: NATimeInfo, kf: bool, buffer: NABufferRef<Vec<u8>>) -> Self {
- NAPacket { stream: str, ts, keyframe: kf, buffer, side_data: Vec::new() }
+ pub fn new_from_refbuf(stream: NAStreamRef, ts: NATimeInfo, kf: bool, buffer: NABufferRef<Vec<u8>>) -> Self {
+ NAPacket { stream, ts, keyframe: kf, buffer, side_data: Vec::new() }
}
/// Returns information about the stream packet belongs to.
pub fn get_stream(&self) -> NAStreamRef { self.stream.clone() }
@@ -1414,8 +1414,8 @@ impl NAPacket {
/// Adds side data for a packet.
pub fn add_side_data(&mut self, side_data: NASideData) { self.side_data.push(side_data); }
/// Assigns packet to a new stream.
- pub fn reassign(&mut self, str: NAStreamRef, ts: NATimeInfo) {
- self.stream = str;
+ pub fn reassign(&mut self, stream: NAStreamRef, ts: NATimeInfo) {
+ self.stream = stream;
self.ts = ts;
}
}
diff --git a/nihav-core/src/muxers/mod.rs b/nihav-core/src/muxers/mod.rs
index 40a6eb3..e8334e5 100644
--- a/nihav-core/src/muxers/mod.rs
+++ b/nihav-core/src/muxers/mod.rs
@@ -74,10 +74,10 @@ pub struct Muxer<'a> {
impl<'a> Muxer<'a> {
/// Constructs a new `Muxer` instance.
- fn new(mux: Box<dyn MuxCore<'a> + 'a>, str: StreamManager) -> Self {
+ fn new(mux: Box<dyn MuxCore<'a> + 'a>, strmgr: StreamManager) -> Self {
Muxer {
mux,
- streams: str,
+ streams: strmgr,
}
}
/// Returns a stream reference by its number.
@@ -134,10 +134,10 @@ pub trait MuxerCreator {
}
/// Creates muxer for a provided bytestream writer.
-pub fn create_muxer<'a>(mxcr: &dyn MuxerCreator, str: StreamManager, bw: &'a mut ByteWriter<'a>) -> MuxerResult<Muxer<'a>> {
+pub fn create_muxer<'a>(mxcr: &dyn MuxerCreator, strmgr: StreamManager, bw: &'a mut ByteWriter<'a>) -> MuxerResult<Muxer<'a>> {
let mut mux = mxcr.new_muxer(bw);
- mux.create(&str)?;
- Ok(Muxer::new(mux, str))
+ mux.create(&strmgr)?;
+ Ok(Muxer::new(mux, strmgr))
}
/// List of registered muxers.
diff --git a/nihav-core/src/options.rs b/nihav-core/src/options.rs
index b09bf05..d065892 100644
--- a/nihav-core/src/options.rs
+++ b/nihav-core/src/options.rs
@@ -89,8 +89,8 @@ impl NAOptionDefinition {
NAOptionDefinitionType::None => Ok((NAOption { name: self.name, value: NAValue::None }, 1)),
NAOptionDefinitionType::Bool => Ok((NAOption { name: self.name, value: NAValue::Bool(true) }, 1)),
NAOptionDefinitionType::Int(_, _) => {
- if let Some(str) = value {
- let ret = str.parse::<i64>();
+ if let Some(strval) = value {
+ let ret = strval.parse::<i64>();
if let Ok(val) = ret {
let opt = NAOption { name: self.name, value: NAValue::Int(val) };
self.check(&opt)?;
@@ -103,8 +103,8 @@ impl NAOptionDefinition {
}
},
NAOptionDefinitionType::Float(_, _) => {
- if let Some(str) = value {
- let ret = str.parse::<f64>();
+ if let Some(strval) = value {
+ let ret = strval.parse::<f64>();
if let Ok(val) = ret {
let opt = NAOption { name: self.name, value: NAValue::Float(val) };
self.check(&opt)?;
@@ -117,8 +117,8 @@ impl NAOptionDefinition {
}
},
NAOptionDefinitionType::String(_) => {
- if let Some(str) = value {
- let opt = NAOption { name: self.name, value: NAValue::String(str.to_string()) };
+ if let Some(strval) = value {
+ let opt = NAOption { name: self.name, value: NAValue::String(strval.to_string()) };
self.check(&opt)?;
Ok((opt, 2))
} else {
diff --git a/nihav-itu/src/codecs/h264/mod.rs b/nihav-itu/src/codecs/h264/mod.rs
index e8d46c6..270a989 100644
--- a/nihav-itu/src/codecs/h264/mod.rs
+++ b/nihav-itu/src/codecs/h264/mod.rs
@@ -1072,8 +1072,8 @@ impl NAOptionHandler for H264Decoder {
for opt_def in DECODER_OPTIONS.iter() {
if opt_def.check(option).is_ok() {
match (option.name, &option.value) {
- (FRAME_SKIP_OPTION, NAValue::String(ref str)) => {
- if let Ok(smode) = FrameSkipMode::from_str(str) {
+ (FRAME_SKIP_OPTION, NAValue::String(ref strval)) => {
+ if let Ok(smode) = FrameSkipMode::from_str(strval) {
self.skip_mode = smode;
}
},
diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs
index 5748cde..844e1ab 100644
--- a/nihav-realmedia/src/codecs/rv60.rs
+++ b/nihav-realmedia/src/codecs/rv60.rs
@@ -595,11 +595,11 @@ impl DeblockInfo {
fn get_left_strength(&self, pos: usize) -> u8 {
self.left_str[pos] & 3
}
- fn set_top_strength(&mut self, pos: usize, str: u8) {
- self.top_str[pos] |= str;
+ fn set_top_strength(&mut self, pos: usize, strength: u8) {
+ self.top_str[pos] |= strength;
}
- fn set_left_strength(&mut self, pos: usize, str: u8) {
- self.left_str[pos] |= str;
+ fn set_left_strength(&mut self, pos: usize, strength: u8) {
+ self.left_str[pos] |= strength;
}
}
@@ -1552,8 +1552,8 @@ impl NAOptionHandler for RealVideo60Decoder {
for opt_def in DECODER_OPTIONS.iter() {
if opt_def.check(option).is_ok() {
match (option.name, &option.value) {
- (FRAME_SKIP_OPTION, NAValue::String(ref str)) => {
- if let Ok(smode) = FrameSkipMode::from_str(str) {
+ (FRAME_SKIP_OPTION, NAValue::String(ref strval)) => {
+ if let Ok(smode) = FrameSkipMode::from_str(strval) {
self.skip_mode = smode;
}
},
diff --git a/nihav-registry/src/detect.rs b/nihav-registry/src/detect.rs
index bb452b2..3c5a60a 100644
--- a/nihav-registry/src/detect.rs
+++ b/nihav-registry/src/detect.rs
@@ -176,11 +176,11 @@ impl<'a> CC<'a> {
CC::Le(ref arg) => { arg.le(src) },
CC::Gt(ref arg) => { arg.gt(src) },
CC::Ge(ref arg) => { arg.ge(src) },
- CC::Str(str) => {
- let mut val: Vec<u8> = vec![0; str.len()];
+ CC::Str(strng) => {
+ let mut val: Vec<u8> = vec![0; strng.len()];
let res = src.peek_buf(val.as_mut_slice());
if res.is_err() { return false; }
- val == str
+ val == strng
}
}
}