X-Git-Url: https://git.nihav.org/?p=nihav.git;a=blobdiff_plain;f=nihav-game%2Fsrc%2Fdemuxers%2Fbmv.rs;h=f548fdc7593cbd82e1038b182e87cf4591dc8b1c;hp=afb17317c152da7a6d7c816ff595968f7cd622c5;hb=a480a0de101483d802a11e72d758dae00fa4860a;hpb=e69b11482edfe7d2d3604a828e46990df78ef852 diff --git a/nihav-game/src/demuxers/bmv.rs b/nihav-game/src/demuxers/bmv.rs index afb1731..f548fdc 100644 --- a/nihav-game/src/demuxers/bmv.rs +++ b/nihav-game/src/demuxers/bmv.rs @@ -12,17 +12,17 @@ struct BMVDemuxer<'a> { impl<'a> DemuxCore<'a> for BMVDemuxer<'a> { #[allow(unused_variables)] - fn open(&mut self, strmgr: &mut StreamManager) -> DemuxerResult<()> { + fn open(&mut self, strmgr: &mut StreamManager, _seek_index: &mut SeekIndex) -> DemuxerResult<()> { let src = &mut self.src; let vhdr = NAVideoInfo::new(640, 429, false, PAL8_FORMAT); let vci = NACodecTypeInfo::Video(vhdr); let vinfo = NACodecInfo::new("bmv-video", vci, None); - 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, 0)).unwrap(); let ahdr = NAAudioInfo::new(22050, 2, SND_S16_FORMAT, 1); let ainfo = NACodecInfo::new("bmv-audio", NACodecTypeInfo::Audio(ahdr), None); - self.aud_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, 22050)).unwrap(); + self.aud_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, 22050, 0)).unwrap(); self.vpos = 0; self.apos = 0; @@ -70,10 +70,16 @@ impl<'a> DemuxCore<'a> for BMVDemuxer<'a> { } } - #[allow(unused_variables)] - fn seek(&mut self, time: u64) -> DemuxerResult<()> { - Err(DemuxerError::NotImplemented) + fn seek(&mut self, _time: NATimePoint, _seek_index: &SeekIndex) -> DemuxerResult<()> { + Err(DemuxerError::NotPossible) } + fn get_duration(&self) -> u64 { 0 } +} + +impl<'a> NAOptionHandler for BMVDemuxer<'a> { + fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } + fn set_options(&mut self, _options: &[NAOption]) { } + fn query_option_value(&self, _name: &str) -> Option { None } } impl<'a> BMVDemuxer<'a> { @@ -111,7 +117,8 @@ struct BMV3Demuxer<'a> { impl<'a> DemuxCore<'a> for BMV3Demuxer<'a> { #[allow(unused_variables)] - fn open(&mut self, strmgr: &mut StreamManager) -> DemuxerResult<()> { + #[allow(clippy::cast_lossless)] + fn open(&mut self, strmgr: &mut StreamManager, _seek_index: &mut SeekIndex) -> DemuxerResult<()> { let src = &mut self.src; let mut magic = [0u8; 4]; @@ -145,11 +152,11 @@ impl<'a> DemuxCore<'a> for BMV3Demuxer<'a> { let vhdr = NAVideoInfo::new(width, height, false, RGB565_FORMAT); let vci = NACodecTypeInfo::Video(vhdr); let vinfo = NACodecInfo::new("bmv3-video", vci, None); - self.vid_id = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, 256, fps)).unwrap(); + self.vid_id = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, 256, fps, nframes as u64)).unwrap(); let ahdr = NAAudioInfo::new(22050, 2, SND_S16_FORMAT, audio_blob_size); let ainfo = NACodecInfo::new("bmv3-audio", NACodecTypeInfo::Audio(ahdr), None); - self.aud_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, 22050)).unwrap(); + self.aud_id = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, 1, 22050, 0)).unwrap(); self.vpos = 0; self.apos = 0; @@ -212,10 +219,16 @@ impl<'a> DemuxCore<'a> for BMV3Demuxer<'a> { } } - #[allow(unused_variables)] - fn seek(&mut self, time: u64) -> DemuxerResult<()> { - Err(DemuxerError::NotImplemented) + fn seek(&mut self, _time: NATimePoint, _seek_index: &SeekIndex) -> DemuxerResult<()> { + Err(DemuxerError::NotPossible) } + fn get_duration(&self) -> u64 { 0 } +} + +impl<'a> NAOptionHandler for BMV3Demuxer<'a> { + fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } + fn set_options(&mut self, _options: &[NAOption]) { } + fn query_option_value(&self, _name: &str) -> Option { None } } impl<'a> BMV3Demuxer<'a> { @@ -254,7 +267,8 @@ mod test { let mut br = ByteReader::new(&mut fr); let mut dmx = BMVDemuxer::new(&mut br); let mut sm = StreamManager::new(); - dmx.open(&mut sm).unwrap(); + let mut si = SeekIndex::new(); + dmx.open(&mut sm, &mut si).unwrap(); loop { let pktres = dmx.get_frame(&mut sm); if let Err(e) = pktres { @@ -272,7 +286,8 @@ mod test { let mut br = ByteReader::new(&mut fr); let mut dmx = BMV3Demuxer::new(&mut br); let mut sm = StreamManager::new(); - dmx.open(&mut sm).unwrap(); + let mut si = SeekIndex::new(); + dmx.open(&mut sm, &mut si).unwrap(); loop { let pktres = dmx.get_frame(&mut sm); if let Err(e) = pktres {