X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-commonfmt%2Fsrc%2Fcodecs%2Fcinepakenc.rs;h=d258df97114c1014eedbe2a4a72894d7cc0f23c9;hb=77d52ff687dc8ebb0a565b3be4777a3adba3b953;hp=ce50eee63d3899cd36c0958ef05585923e0be977;hpb=ee0ca773d99115f67d776735bcad168e1993d2e8;p=nihav.git diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs index ce50eee..d258df9 100644 --- a/nihav-commonfmt/src/codecs/cinepakenc.rs +++ b/nihav-commonfmt/src/codecs/cinepakenc.rs @@ -707,10 +707,10 @@ impl CinepakEncoder { self.render_stripe(true, start_line, end_line); - if self.v1_idx.len() == 0 { + if self.v4_idx.len() == 0 { bw.write_byte(0x32)?; - bw.write_u24be((self.v4_idx.len() + 4) as u32)?; - bw.write_buf(self.v4_idx.as_slice())?; + bw.write_u24be((self.v1_idx.len() + 4) as u32)?; + bw.write_buf(self.v1_idx.as_slice())?; } else { bw.write_byte(0x30)?; bw.write_u24be(0)?; @@ -945,7 +945,7 @@ impl NAEncoder for CinepakEncoder { let buf = alloc_video_buffer(out_info, 2)?; self.lastfrm = Some(buf.get_vbuf().unwrap()); - + Ok(stream) }, } @@ -998,7 +998,6 @@ impl NAOptionHandler for CinepakEncoder { fn get_supported_options(&self) -> &[NAOptionDefinition] { ENCODER_OPTS } fn set_options(&mut self, options: &[NAOption]) { for option in options.iter() { -println!("option {}", option.name); for opt_def in ENCODER_OPTS.iter() { if opt_def.check(option).is_ok() { match option.name { @@ -1030,7 +1029,7 @@ println!("option {}", option.name); } fn query_option_value(&self, name: &str) -> Option { match name { - "key_int" => Some(NAValue::Int(i64::from(self.key_int))), + KEYFRAME_OPTION => Some(NAValue::Int(i64::from(self.key_int))), "nstrips" => Some(NAValue::Int(self.nstrips as i64)), "quant_mode" => Some(NAValue::String(self.qmode.to_string())), _ => None, @@ -1079,6 +1078,7 @@ mod test { height: 0, format: YUV420_FORMAT, flipped: true, + bits: 12, }; let enc_params = EncodeParameters { format: NACodecTypeInfo::Video(dst_vinfo),