factor out keyframe interval option
[nihav.git] / nihav-commonfmt / src / codecs / cinepakenc.rs
index 645bd834d1496e2ea26e0f066a49a5d6fd01a545..ce50eee63d3899cd36c0958ef05585923e0be977 100644 (file)
@@ -929,7 +929,9 @@ 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 stream = NAStream::new(StreamType::Video, stream_id, info, encinfo.tb_num, encinfo.tb_den).into_ref();
+                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();
 
                 self.stream = Some(stream.clone());
                 self.quality = encinfo.quality;
@@ -982,7 +984,7 @@ impl NAEncoder for CinepakEncoder {
 
 const ENCODER_OPTS: &[NAOptionDefinition] = &[
     NAOptionDefinition {
-        name: "key_int", description: "Keyframe interval (0 - automatic)",
+        name: KEYFRAME_OPTION, description: KEYFRAME_OPTION_DESC,
         opt_type: NAOptionDefinitionType::Int(Some(0), Some(128)) },
     NAOptionDefinition {
         name: "nstrips", description: "Number of strips per frame (0 - automatic)",
@@ -1000,7 +1002,7 @@ println!("option {}", option.name);
             for opt_def in ENCODER_OPTS.iter() {
                 if opt_def.check(option).is_ok() {
                     match option.name {
-                        "key_int" => {
+                        KEYFRAME_OPTION => {
                             if let NAValue::Int(intval) = option.value {
                                 self.key_int = intval as u8;
                             }