let vhdr = NAVideoInfo::new(width, height, false, PAL8_FORMAT);
let vci = NACodecTypeInfo::Video(vhdr);
let vinfo = NACodecInfo::new(if !self.is_indeo { "vmd-video" } else { "indeo3" }, vci, Some(edata));
- self.vid_id = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, 1, 12)).unwrap();
+ self.vid_id = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, 1, 12, nframes as u64)).unwrap();
let is_ext_audio = (hdr_size & 0xF) == 4;
let ext_audio_id = if is_ext_audio {
}
};
let ainfo = NACodecInfo::new(ac_name, NACodecTypeInfo::Audio(ahdr), Some(aedata));
- self.aud_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, srate)).unwrap();
+ self.aud_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, srate, 0)).unwrap();
} else {
block_size = 0;
}
let is_video = cur_frame.chtype == CHTYPE_VIDEO;
let mut buf: Vec<u8> = Vec::with_capacity(FRAME_HDR_SIZE + (cur_frame.size as usize));
- if !(is_video && self.is_indeo) && !(!is_video && self.is_lhaud) {
+ if !((is_video && self.is_indeo) || (!is_video && self.is_lhaud)) {
buf.extend_from_slice(&cur_frame.hdr);
buf.resize(FRAME_HDR_SIZE + (cur_frame.size as usize), 0);
self.src.read_buf(&mut buf[FRAME_HDR_SIZE..])?;
Ok(pkt)
}
- fn seek(&mut self, _time: u64, _seek_index: &SeekIndex) -> DemuxerResult<()> {
+ fn seek(&mut self, _time: NATimePoint, _seek_index: &SeekIndex) -> DemuxerResult<()> {
Err(DemuxerError::NotPossible)
}
+
+ fn get_duration(&self) -> u64 { 0 }
+}
+
+impl<'a> NAOptionHandler for VMDDemuxer<'a> {
+ fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] }
+ fn set_options(&mut self, _options: &[NAOption]) { }
+ fn query_option_value(&self, _name: &str) -> Option<NAValue> { None }
}
impl<'a> VMDDemuxer<'a> {
#[test]
fn test_vmd_demux() {
+ // sample: https://samples.mplayerhq.hu/game-formats/sierra-vmd/Lighthouse/128.vmd
let mut file = File::open("assets/Game/128.vmd").unwrap();
//let mut file = File::open("assets/Game/1491.VMD").unwrap();
let mut fr = FileReader::new_read(&mut file);