const VIDEO_CODECS: &[(i32, &str)] = &[
( 1, "movinglines"),
+ ( 2, "arm_rawvideo"),
+ ( 3, "arm_rawvideo"),
+ ( 5, "arm_rawvideo"),
( 7, "movingblocks"),
( 17, "movingblockshq"),
( 19, "supermovingblocks"),
(122, "escape122"),
(124, "escape124"),
(130, "escape130"),
+ (600, "msvideo1"),
+ (601, "msvideo1"),
+ (602, "cinepak"),
(800, "linepack"),
(802, "movie16_3"),
];
let mut res = Vec::new();
loop {
let c = self.read_byte()?;
- if c == b'\n' {
+ if c == b'\n' || c == 0 {
break;
}
res.push(c);
let width = parse_int(&width)?;
let height = self.src.read_string()?;
let height = parse_int(&height)?;
- validate!((video_codec <= 0) ^ (width > 0 && height > 0));
+ validate!((video_codec <= 0) || (width > 0 && height > 0));
let width = width as usize;
let height = height as usize;
let vformat = self.src.read_string()?;
}
let tb_den = tbase as u32;
- let vci = NACodecTypeInfo::Video(NAVideoInfo::new(width, height, false, YUV420_FORMAT));
- let vinfo = NACodecInfo::new(codec_name, vci, Some(vformat));
+ let mut edata = vec![video_codec as u8, (video_codec >> 8) as u8];
+ edata.extend_from_slice(&vformat);
+
+ let fmt = match video_codec {
+ 600 => PAL8_FORMAT,
+ 601 => RGB565_FORMAT,
+ _ => YUV420_FORMAT,
+ };
+
+ let vci = NACodecTypeInfo::Video(NAVideoInfo::new(width, height, false, fmt));
+ let vinfo = NACodecInfo::new(codec_name, vci, Some(edata));
let ret = strmgr.add_stream(NAStream::new(StreamType::Video, stream_id, vinfo, tb_num, tb_den, (frm_per_chunk * num_chunks) as u64));
if ret.is_some() {
stream_id += 1;
for ((&id, &sratestr), (&chan, &fmt)) in sound_ids.iter().zip(srates.iter())
.zip(channels.iter().zip(sndformats.iter())) {
let codec_id = parse_uint(id)?;
- let codec_name = if codec_id == 1 { "pcm" } else { "unknown" };
+ let codec_name = if codec_id == 1 { "arm_rawaudio" } else { "unknown" };
let channels = parse_uint(chan)?;
validate!(channels > 0 && channels < 16);
+ let edata = fmt.to_owned();
let bits = parse_uint(fmt)?;
let mut srate = parse_uint(sratestr)?;
if srate > 0 && srate < 1000 { // probably in microseconds instead of Hertz
let fmt = if bits == 8 { SND_U8_FORMAT } else { SND_S16_FORMAT };
let aci = NACodecTypeInfo::Audio(NAAudioInfo::new(srate, channels as u8, fmt, 0));
- let ainfo = NACodecInfo::new(codec_name, aci, None);
+ let ainfo = NACodecInfo::new(codec_name, aci, Some(edata));
let ret = strmgr.add_stream(NAStream::new(StreamType::Audio, stream_id, ainfo, 1, srate, 0));
if let Some(id) = ret {
self.audio_ids.push(id);