use super::*;
+use register;
use super::DemuxerError::*;
use io::byteio::*;
use frame::*;
let height = dmx.src.read_u32le()? as i32;
let planes = dmx.src.read_u16le()?;
let bitcount = dmx.src.read_u16le()?;
- let compression = dmx.src.read_u32be()?;
+ let mut compression: [u8; 4] = [0; 4];
+ dmx.src.read_buf(&mut compression)?;
let img_size = dmx.src.read_u32le()?;
let xdpi = dmx.src.read_u32le()?;
let ydpi = dmx.src.read_u32le()?;
let vhdr = NAVideoInfo::new(width, if flip { -height as u32 } else { height as u32}, flip, PAL8_FORMAT);
let vci = NACodecTypeInfo::Video(vhdr);
let edata = dmx.read_extradata(size - 40)?;
- let vinfo = NACodecInfo::new(vci, edata);
+ let cname = match register::find_codec_from_avi_fourcc(&compression) {
+ None => "unknown",
+ Some(name) => name,
+ };
+ let vinfo = NACodecInfo::new(cname, vci, edata);
let res = dmx.dmx.add_stream(NAStream::new(StreamType::Video, dmx.sstate.strm_no as u32, vinfo));
if let None = res { return Err(MemoryError); }
dmx.sstate.reset();
let soniton = NASoniton::new(bits_per_sample as u8, SONITON_FLAG_SIGNED);
let ahdr = NAAudioInfo::new(samplespersec, channels as u8, soniton, block_align as usize);
let edata = dmx.read_extradata(size - 16)?;
- let ainfo = NACodecInfo::new(NACodecTypeInfo::Audio(ahdr), edata);
+ let cname = match register::find_codec_from_wav_twocc(w_format_tag) {
+ None => "unknown",
+ Some(name) => name,
+ };
+ let ainfo = NACodecInfo::new(cname, NACodecTypeInfo::Audio(ahdr), edata);
let res = dmx.dmx.add_stream(NAStream::new(StreamType::Audio, dmx.sstate.strm_no as u32, ainfo));
if let None = res { return Err(MemoryError); }
dmx.sstate.reset();
fn parse_strf_xxxx(dmx: &mut AVIDemuxer, size: usize) -> DemuxerResult<usize> {
let edata = dmx.read_extradata(size)?;
- let info = NACodecInfo::new(NACodecTypeInfo::None, edata);
+ let info = NACodecInfo::new("unknown", NACodecTypeInfo::None, edata);
let res = dmx.dmx.add_stream(NAStream::new(StreamType::Data, dmx.sstate.strm_no as u32, info));
if let None = res { return Err(MemoryError); }
dmx.sstate.reset();
if max_fs > 0 {
let vhdr = NAVideoInfo::new(width as u32, height as u32, false, PAL8_FORMAT);
let vci = NACodecTypeInfo::Video(vhdr);
- let vinfo = NACodecInfo::new(vci, None);
+ let vinfo = NACodecInfo::new("video-gdv", 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(NACodecTypeInfo::Audio(ahdr), None);
+ let ainfo = NACodecInfo::new("audio-gdv", 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 };
#[allow(dead_code)]
#[derive(Clone)]
pub struct NACodecInfo {
+ name: &'static str,
properties: NACodecTypeInfo,
extradata: Option<Rc<Vec<u8>>>,
}
impl NACodecInfo {
- pub fn new(p: NACodecTypeInfo, edata: Option<Vec<u8>>) -> Self {
+ pub fn new(name: &'static str, p: NACodecTypeInfo, edata: Option<Vec<u8>>) -> Self {
let extradata = match edata {
None => None,
Some(vec) => Some(Rc::new(vec)),
};
- NACodecInfo { properties: p, extradata: extradata }
+ NACodecInfo { name: name, properties: p, extradata: extradata }
}
pub fn get_properties(&self) -> NACodecTypeInfo { self.properties }
pub fn get_extradata(&self) -> Option<Rc<Vec<u8>>> {