annotate the sources for test samples
[nihav.git] / nihav-game / src / demuxers / gdv.rs
index 778329ad451d1e9b7cf6bded3b2847ed6a5c94d5..8f54bca750d55779614926074b962f70ca6ce6fb 100644 (file)
@@ -78,7 +78,7 @@ impl<'a> DemuxCore<'a> for GremlinVideoDemuxer<'a> {
                 edata.resize(768, 0);
                 src.read_buf(edata.as_mut_slice())?;
             }
-            let vhdr = NAVideoInfo::new(width as usize, height as usize, false, PAL8_FORMAT);
+            let vhdr = NAVideoInfo::new(width as usize, height as usize, false, if depth < 2 { PAL8_FORMAT } else { RGB565_FORMAT });
             let vci = NACodecTypeInfo::Video(vhdr);
             let vinfo = NACodecInfo::new("gdv-video", vci, if edata.is_empty() { None } else { Some(edata) });
             self.v_id = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, 1, u32::from(fps), u64::from(frames)));
@@ -91,7 +91,7 @@ impl<'a> DemuxCore<'a> for GremlinVideoDemuxer<'a> {
             let ahdr = NAAudioInfo::new(u32::from(rate), channels as u8, if depth == 16 { SND_S16_FORMAT } else { SND_U8_FORMAT }, 2);
             let ainfo = NACodecInfo::new(if packed != 0 { "gdv-audio" } else { "pcm" },
                                          NACodecTypeInfo::Audio(ahdr), None);
-            self.a_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, u32::from(rate), 0));
+            self.a_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, u32::from(fps), 0));
 
             self.asize = (((rate / fps) * channels * (depth / 8)) >> packed) as usize;
             self.apacked = (aflags & 8) != 0;
@@ -180,6 +180,7 @@ mod test {
 
     #[test]
     fn test_gdv_demux() {
+        // sample from Normality game
         let mut file = File::open("assets/Game/intro1.gdv").unwrap();
         let mut fr = FileReader::new_read(&mut file);
         let mut br = ByteReader::new(&mut fr);