diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-02-17 18:23:38 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-02-17 18:23:38 +0100 |
commit | 405cec9eed5d7f58440ec8495f5cbc1f5c6fee40 (patch) | |
tree | a115c0efc0cf1d50e54590dcb1663fec4a9751c4 /nihav-core | |
parent | f638a5b1b3241b3433689983aca22d9e6518a64f (diff) | |
download | nihav-405cec9eed5d7f58440ec8495f5cbc1f5c6fee40.tar.gz |
rename "str" variable to avoid confusion with the primitive type
Diffstat (limited to 'nihav-core')
-rw-r--r-- | nihav-core/src/demuxers/mod.rs | 14 | ||||
-rw-r--r-- | nihav-core/src/frame.rs | 12 | ||||
-rw-r--r-- | nihav-core/src/muxers/mod.rs | 10 | ||||
-rw-r--r-- | nihav-core/src/options.rs | 12 |
4 files changed, 24 insertions, 24 deletions
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 { |