Audio,
Subtitles,
Data,
+ None,
}
impl fmt::Display for StreamType {
StreamType::Audio => write!(f, "Audio"),
StreamType::Subtitles => write!(f, "Subtitles"),
StreamType::Data => write!(f, "Data"),
+ StreamType::None => write!(f, "-"),
}
}
}
impl fmt::Display for NAStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "({}#{})", self.media_type, self.id)
+ write!(f, "({}#{} - {})", self.media_type, self.id, self.info.get_properties())
}
}
buf.resize(size, 0);
let res = self.read_buf(buf.as_mut_slice());
if let Err(_) = res { return Err(DemuxerError::IOError); }
- if res.unwrap() < buf.len() { return Err(DemuxerError::IOError); }
let pkt = NAPacket::new(str, pts, dts, dur, kf, buf);
Ok(pkt)
}
let mut buf = Rc::make_mut(&mut refbuf);
let res = self.read_buf(buf.as_mut_slice());
if let Err(_) = res { return Err(DemuxerError::IOError); }
- if res.unwrap() < buf.len() { return Err(DemuxerError::IOError); }
Ok(())
}
}
use std::collections::HashMap;
+use std::fmt;
use std::rc::Rc;
use formats::*;
}
}
+impl fmt::Display for NAAudioInfo {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{} Hz, {} ch", self.sample_rate, self.channels)
+ }
+}
+
#[allow(dead_code)]
#[derive(Clone,Copy)]
pub struct NAVideoInfo {
}
}
+impl fmt::Display for NAVideoInfo {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{}x{}", self.width, self.height)
+ }
+}
+
#[derive(Clone,Copy)]
pub enum NACodecTypeInfo {
None,
Video(NAVideoInfo),
}
+impl fmt::Display for NACodecTypeInfo {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ let ret = match *self {
+ NACodecTypeInfo::None => format!(""),
+ NACodecTypeInfo::Audio(fmt) => format!("{}", fmt),
+ NACodecTypeInfo::Video(fmt) => format!("{}", fmt),
+ };
+ write!(f, "{}", ret)
+ }
+}
+
+
#[allow(dead_code)]
pub struct NABuffer<'a> {
id: u64,