]> git.nihav.org Git - nihav.git/blobdiff - src/demuxers/gdv.rs
use frame buffers with codec-specific type of data
[nihav.git] / src / demuxers / gdv.rs
index 09c26202cca75333db51aa5618043b3d1b9a622e..9cd62ecac0fec4b42eb97d6bd1fbf796b3a164f4 100644 (file)
@@ -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,
@@ -43,13 +43,13 @@ impl<'a> Demux<'a> for GremlinVideoDemuxer<'a> {
         if max_fs > 0 {
             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);
+            let vinfo = NACodecInfo::new("gdv-video", vci, None);
             self.v_id = self.dmx.add_stream(NAStream::new(StreamType::Video, 0, vinfo));
         }
         if (aflags & 1) != 0 {
             let channels = if (aflags & 2) != 0 { 2 } else { 1 };
             let ahdr = NAAudioInfo::new(rate as u32, channels as u8, if (aflags & 4) != 0 { SND_S16_FORMAT } else { SND_U8_FORMAT }, 2);
-            let ainfo = NACodecInfo::new("audio-gdv", NACodecTypeInfo::Audio(ahdr), None);
+            let ainfo = NACodecInfo::new("gdv-audio", NACodecTypeInfo::Audio(ahdr), None);
             self.a_id = self.dmx.add_stream(NAStream::new(StreamType::Audio, 1, ainfo));
 
             let packed = if (aflags & 8) != 0 { 1 } else { 0 };
@@ -90,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,
@@ -126,6 +126,15 @@ pktdta: Vec::new(),
     }
 }
 
+pub struct GDVDemuxerCreator { }
+
+impl DemuxerCreator for GDVDemuxerCreator {
+    fn new_demuxer<'a>(&self, br: &'a mut ByteReader<'a>) -> Box<Demux<'a> + 'a> {
+        Box::new(GremlinVideoDemuxer::new(br))
+    }
+    fn get_name(&self) -> &'static str { "gdv" }
+}
+
 #[cfg(test)]
 mod test {
     use super::*;