introduce stream and container duration
[nihav.git] / nihav-llaudio / src / demuxers / ape.rs
index 2969c786d9e5750a4fb2e5f13dcac8616e4b223f..10ebc07a3648fd61525e725488a41e35ae297bc1 100644 (file)
@@ -114,7 +114,7 @@ impl<'a> DemuxCore<'a> for APEDemuxer<'a> {
         validate!(channels > 0 && channels < 256);
         validate!(bits > 0 && bits <= 32);
         validate!(nframes > 0 && nframes < (1 << 28));
-        validate!(seektab_len == nframes * 4);
+        validate!(seektab_len >= nframes * 4);
 
         self.frames = Vec::with_capacity(nframes);
         self.normal_blocks = blocksperframe;
@@ -178,7 +178,7 @@ impl<'a> DemuxCore<'a> for APEDemuxer<'a> {
 
         let ahdr = NAAudioInfo::new(srate, channels as u8, SND_S16P_FORMAT, 1);
         let ainfo = NACodecInfo::new("ape", NACodecTypeInfo::Audio(ahdr), Some(hdr));
-        strmgr.add_stream(NAStream::new(StreamType::Audio, 0, ainfo, blocksperframe, srate)).unwrap();
+        strmgr.add_stream(NAStream::new(StreamType::Audio, 0, ainfo, blocksperframe, srate, nframes as u64)).unwrap();
 
         self.cur_frame = 0;
 
@@ -223,6 +223,7 @@ impl<'a> DemuxCore<'a> for APEDemuxer<'a> {
 
         Ok(())
     }
+    fn get_duration(&self) -> u64 { 0 }
 }
 
 impl<'a> NAOptionHandler for APEDemuxer<'a> {