X-Git-Url: https://git.nihav.org/?p=nihav.git;a=blobdiff_plain;f=nihav-commonfmt%2Fsrc%2Fcodecs%2Fcinepakenc.rs;h=95994eedae1f73dd2107841a29c52b1fd88371b3;hp=09bb112e87c02d6ecba10dd669c6357dfb4bd316;hb=78fb6560c73965d834b215fb0b49505ae5443288;hpb=36ce88be3f590a876fe539c8f631a58af2ea2cac diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs index 09bb112..95994ee 100644 --- a/nihav-commonfmt/src/codecs/cinepakenc.rs +++ b/nihav-commonfmt/src/codecs/cinepakenc.rs @@ -218,7 +218,7 @@ enum QuantMode { MedianCut, } -impl QuantMode { +impl std::string::ToString for QuantMode { fn to_string(&self) -> String { match *self { QuantMode::ELBG => "elbg".to_string(), @@ -436,7 +436,7 @@ impl CinepakEncoder { for _ in (start..end).step_by(4) { for x in (0..width).step_by(4) { if cur_bit == 0 { - if !intra || self.v1_idx.len() > 0 { + if !intra || !self.v1_idx.is_empty() { cur_mask = *miter.next().unwrap(); } else { cur_mask = 0xFFFFFFFF; @@ -722,7 +722,7 @@ impl CinepakEncoder { self.render_stripe(true, start_line, end_line); - if self.v4_idx.len() == 0 { + if self.v4_idx.is_empty() { bw.write_byte(0x32)?; bw.write_u24be((self.v1_idx.len() + 4) as u32)?; bw.write_buf(self.v1_idx.as_slice())?; @@ -917,7 +917,7 @@ impl NAEncoder for CinepakEncoder { ofmt.format = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, true, YUV420_FORMAT)); Ok(ofmt) }, - NACodecTypeInfo::Audio(_) => return Err(EncoderError::FormatError), + NACodecTypeInfo::Audio(_) => Err(EncoderError::FormatError), NACodecTypeInfo::Video(vinfo) => { let pix_fmt = if vinfo.format == GRAY_FORMAT { GRAY_FORMAT } else { YUV420_FORMAT }; let outinfo = NAVideoInfo::new((vinfo.width + 3) & !3, (vinfo.height + 3) & !3, true, pix_fmt); @@ -943,7 +943,7 @@ impl NAEncoder for CinepakEncoder { } let out_info = NAVideoInfo::new(vinfo.width, vinfo.height, false, vinfo.format); - let info = NACodecInfo::new("cinepak", NACodecTypeInfo::Video(out_info.clone()), None); + let info = NACodecInfo::new("cinepak", NACodecTypeInfo::Video(out_info), None); let mut stream = NAStream::new(StreamType::Video, stream_id, info, encinfo.tb_num, encinfo.tb_den); stream.set_num(stream_id as usize); let stream = stream.into_ref(); @@ -1069,7 +1069,7 @@ mod test { let mut dmx_reg = RegisteredDemuxers::new(); generic_register_all_demuxers(&mut dmx_reg); let mut dec_reg = RegisteredDecoders::new(); - generic_register_all_codecs(&mut dec_reg); + generic_register_all_decoders(&mut dec_reg); let mut mux_reg = RegisteredMuxers::new(); generic_register_all_muxers(&mut mux_reg); let mut enc_reg = RegisteredEncoders::new();