set stream number in encoders too
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 5 Jun 2020 16:42:02 +0000 (18:42 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 5 Jun 2020 16:42:02 +0000 (18:42 +0200)
nihav-commonfmt/src/codecs/cinepakenc.rs
nihav-ms/src/codecs/msadpcm.rs
nihav-ms/src/codecs/msvideo1enc.rs

index 645bd834d1496e2ea26e0f066a49a5d6fd01a545..4271e1a7d1575cb13a174a724f8017c181f6f40c 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;
index e6e995b6d25465a72478264ff6a580648b58bdd2..d47d9224f083e04bdf5be2acb2ad99a8e2d1d279 100644 (file)
@@ -346,7 +346,9 @@ impl NAEncoder for MSADPCMEncoder {
                 let soniton = NASoniton::new(4, 0);
                 let out_ainfo = NAAudioInfo::new(ainfo.sample_rate, ainfo.channels, soniton, Self::calc_block_size(self.block_len, self.channels));
                 let info = NACodecInfo::new("ms-adpcm", NACodecTypeInfo::Audio(out_ainfo), None);
-                let stream = NAStream::new(StreamType::Audio, stream_id, info.clone(), self.block_len as u32, ainfo.sample_rate).into_ref();
+                let mut stream = NAStream::new(StreamType::Audio, stream_id, info.clone(), self.block_len as u32, ainfo.sample_rate);
+                stream.set_num(stream_id as usize);
+                let stream = stream.into_ref();
 
                 self.stream = Some(stream.clone());
                 self.samples = Vec::with_capacity(self.block_len * self.channels);
index f842297d2affedec3405031b90e7b4ac29bc8611..41d5ff7168127b2ed229316a9cdfae3e52ac10cd 100644 (file)
@@ -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);
                 }