X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=src%2Fdemuxers%2Fgdv.rs;h=897550f19f13983279f2a12dccdf7c55fecc4048;hb=48c88fde06894a7692eb6350cbef12aa85d923f1;hp=57b67921dc2c09580a89d9e24a68e02865e2738c;hpb=ccae5343c71a92519937b9eafd9af0fe0ce3d799;p=nihav.git diff --git a/src/demuxers/gdv.rs b/src/demuxers/gdv.rs index 57b6792..897550f 100644 --- a/src/demuxers/gdv.rs +++ b/src/demuxers/gdv.rs @@ -10,7 +10,7 @@ enum GDVState { } #[allow(dead_code)] -pub struct GremlinVideoDemuxer<'a> { +struct GremlinVideoDemuxer<'a> { opened: bool, src: &'a mut ByteReader<'a>, frames: u16, @@ -41,7 +41,7 @@ impl<'a> Demux<'a> for GremlinVideoDemuxer<'a> { let width = src.read_u16le()?; let height = src.read_u16le()?; if max_fs > 0 { - let vhdr = NAVideoInfo::new(width as u32, height as u32, false, PAL8_FORMAT); + let vhdr = NAVideoInfo::new(width as usize, height as usize, false, PAL8_FORMAT); let vci = NACodecTypeInfo::Video(vhdr); let vinfo = NACodecInfo::new("video-gdv", vci, None); self.v_id = self.dmx.add_stream(NAStream::new(StreamType::Video, 0, vinfo)); @@ -75,6 +75,9 @@ impl<'a> Demux<'a> for GremlinVideoDemuxer<'a> { } } + fn get_num_streams(&self) -> usize { self.dmx.get_num_streams() } + fn get_stream(&self, idx: usize) -> Option> { self.dmx.get_stream(idx) } + #[allow(unused_variables)] fn seek(&mut self, time: u64) -> DemuxerResult<()> { if !self.opened { return Err(DemuxerError::NoSuchInput); } @@ -87,7 +90,7 @@ impl<'a> Demux<'a> for GremlinVideoDemuxer<'a> { } }*/ impl<'a> GremlinVideoDemuxer<'a> { - pub fn new(io: &'a mut ByteReader<'a>) -> Self { + fn new(io: &'a mut ByteReader<'a>) -> Self { GremlinVideoDemuxer { cur_frame: 0, frames: 0, @@ -123,6 +126,15 @@ pktdta: Vec::new(), } } +pub struct GDVDemuxerCreator { } + +impl DemuxerCreator for GDVDemuxerCreator { + fn new_demuxer<'a>(&self, br: &'a mut ByteReader<'a>) -> Box + 'a> { + Box::new(GremlinVideoDemuxer::new(br)) + } + fn get_name(&self) -> &'static str { "gdv" } +} + #[cfg(test)] mod test { use super::*;