}
impl CmdLineState {
pub fn new() -> Self {
- let mut orig_state: termios = unsafe { std::mem::MaybeUninit::uninit().assume_init() };
+ let mut orig_state: termios = unsafe { let tmp = std::mem::MaybeUninit::uninit(); tmp.assume_init() };
unsafe { tcgetattr(0, &mut orig_state); }
let mut new_state = orig_state;
new_state.c_lflag &= !(libc::ECHO | libc::ICANON);
Self { orig_state }
}
pub fn new_normal() -> Self {
- let mut orig_state: termios = unsafe { std::mem::MaybeUninit::uninit().assume_init() };
+ let mut orig_state: termios = unsafe { let tmp = std::mem::MaybeUninit::uninit(); tmp.assume_init() };
unsafe { tcgetattr(0, &mut orig_state); }
let mut new_state = orig_state;
new_state.c_lflag |= libc::ECHO | libc::ICANON;
if !is_raw {
let res = detect::detect_format(name, br);
let (dmx_name, _) = res.unwrap_or(("", detect::DetectionScore::No));
- if dmx_name != "" {
+ if !dmx_name.is_empty() {
println!("trying demuxer {} on {}", dmx_name, name);
if let Some(dmx_fact) = reg.dmx_reg.find_demuxer(dmx_name) {
br.seek(SeekFrom::Start(0)).unwrap();
return DemuxerObject::Normal(dmx);
}
}
- if dmx_name != "" {
+ if !dmx_name.is_empty() {
println!("trying raw demuxer {} on {}", dmx_name, name);
if let Some(rdmx_fact) = reg.rdmx_reg.find_demuxer(dmx_name) {
br.seek(SeekFrom::Start(0)).unwrap();
break;
}
}
- if pname != "" {
+ if !pname.is_empty() {
println!("found raw stream of type {} for {}", pname, name);
let pcreate = reg.pkt_reg.find_packetiser(pname).unwrap();
let mut packetiser = (pcreate)();
}
}
pub fn is_none(&self) -> bool {
- match *self {
- DemuxerObject::None => true,
- _ => false,
- }
+ matches!(*self, DemuxerObject::None)
}
pub fn get_duration(&self) -> u64 {
match *self {
tmp.clear();
tmp.resize(src.len(), 0);
}
- device.queue(&tmp);
+ device.queue(tmp);
}
fn output_vol_u8(device: &AudioDevice, tmp: &mut Vec<i16>, src: &[u8], mute: bool, volume: u8) {
tmp.clear();
tmp.resize(src.len() / 2, 0);
}
- device.queue(&tmp);
+ device.queue(tmp);
}
impl<'a> Decoder<'a> {
match out_buf {
NABufferType::AudioI16(abuf) => {
if !self.mute && self.volume == 100 {
- device.queue(&abuf.get_data());
+ device.queue(abuf.get_data());
} else {
- output_vol_i16(device, self.buf, &abuf.get_data(), self.mute, self.volume);
+ output_vol_i16(device, self.buf, abuf.get_data(), self.mute, self.volume);
}
self.samplepos += abuf.get_length() as u64;
},
NABufferType::AudioPacked(abuf) => {
if !self.mute && self.volume == 100 {
- device.queue_bytes(&abuf.get_data());
+ device.queue_bytes(abuf.get_data());
} else {
- output_vol_u8(device, self.buf, &abuf.get_data(), self.mute, self.volume);
+ output_vol_u8(device, self.buf, abuf.get_data(), self.mute, self.volume);
}
self.samplepos += abuf.get_length() as u64;
},