1 use std::collections::HashMap;
7 pub struct NAAudioInfo {
15 pub fn new(sr: u32, ch: u8, fmt: NASoniton, bl: usize) -> Self {
16 NAAudioInfo { sample_rate: sr, channels: ch, format: fmt, block_len: bl }
22 pub struct NAVideoInfo {
26 format: NAPixelFormaton,
30 pub fn new(w: u32, h: u32, flip: bool, fmt: NAPixelFormaton) -> Self {
31 NAVideoInfo { width: w, height: h, flipped: flip, format: fmt }
36 pub enum NACodecTypeInfo {
43 pub struct NABuffer<'a> {
50 pub struct NACodecInfo {
51 properties: NACodecTypeInfo,
52 extradata: Option<Rc<Vec<u8>>>,
56 pub fn new(p: NACodecTypeInfo, edata: Option<Vec<u8>>) -> Self {
57 let extradata = match edata {
59 Some(vec) => Some(Rc::new(vec)),
61 NACodecInfo { properties: p, extradata: extradata }
63 pub fn get_properties(&self) -> NACodecTypeInfo { self.properties }
64 pub fn get_extradata(&self) -> Option<Rc<Vec<u8>>> {
65 if let Some(ref vec) = self.extradata { return Some(vec.clone()); }
70 pub trait NABufferAllocator {
71 fn alloc_buf(info: &NACodecInfo) -> NABuffer<'static>;
75 pub enum NAValue<'a> {
84 pub struct NAFrame<'a> {
87 duration: Option<u64>,
88 buffer: &'a mut NABuffer<'a>,
89 info: &'a NACodecInfo,
90 options: HashMap<String, NAValue<'a>>,
94 pub struct NACodecContext<'a> {
95 info: &'a NACodecInfo,