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,
#[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>>> {