set stream number in encoders too
[nihav.git] / nihav-ms / src / codecs / msvideo1enc.rs
index f9b06cf848134627c1209245747bae0f97b75f9e..41d5ff7168127b2ed229316a9cdfae3e52ac10cd 100644 (file)
@@ -410,7 +410,7 @@ impl NAEncoder for MSVideo1Encoder {
             NACodecTypeInfo::Audio(_) => return Err(EncoderError::FormatError),
             NACodecTypeInfo::Video(vinfo) => {
                 let outinfo = NAVideoInfo::new((vinfo.width + 3) & !3, (vinfo.height + 3) & !3, true, RGB555_FORMAT);
-                let mut ofmt = EncodeParameters::default();
+                let mut ofmt = *encinfo;
                 ofmt.format = NACodecTypeInfo::Video(outinfo);
                 Ok(ofmt)
             }
@@ -430,7 +430,9 @@ impl NAEncoder for MSVideo1Encoder {
 
                 let out_info = NAVideoInfo::new(vinfo.width, vinfo.height, true, RGB555_FORMAT);
                 let info = NACodecInfo::new("msvideo1", 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();
                 if let Err(_) = self.pool.prealloc_video(out_info, 2) {
                     return Err(EncoderError::AllocError);
                 }
@@ -479,6 +481,12 @@ impl NAEncoder for MSVideo1Encoder {
     }
 }
 
+impl NAOptionHandler for MSVideo1Encoder {
+    fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] }
+    fn set_options(&mut self, _options: &[NAOption]) { }
+    fn query_option_value(&self, _name: &str) -> Option<NAValue> { None }
+}
+
 pub fn get_encoder() -> Box<dyn NAEncoder + Send> {
     Box::new(MSVideo1Encoder::new())
 }