X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=src%2Fframe.rs;h=97b0a501f53b8ea4331606a884f119a35144c4e4;hb=87a1ebc36a32f626c622d813240af64cf9003198;hp=19c1733c9c716b7101f199d9301e62931f68c5e5;hpb=10a00d5246e055230d666ed0455b5cf18aa00505;p=nihav.git diff --git a/src/frame.rs b/src/frame.rs index 19c1733..97b0a50 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -88,8 +88,6 @@ impl fmt::Display for NACodecTypeInfo { } } -pub type BufferRef = Rc>>; - pub type NABufferRefT = Rc>>; #[derive(Clone)] @@ -149,6 +147,12 @@ impl NAAudioBuffer { } } +impl NAAudioBuffer { + pub fn new_from_buf(info: NAAudioInfo, data: NABufferRefT, chmap: NAChannelMap) -> Self { + NAAudioBuffer { info: info, data: data, chmap: chmap, offs: Vec::new() } + } +} + #[derive(Clone)] pub enum NABufferType { Video (NAVideoBuffer), @@ -156,6 +160,7 @@ pub enum NABufferType { VideoPacked(NAVideoBuffer), AudioU8 (NAAudioBuffer), AudioI16 (NAAudioBuffer), + AudioI32 (NAAudioBuffer), AudioF32 (NAAudioBuffer), AudioPacked(NAAudioBuffer), Data (NABufferRefT), @@ -178,6 +183,38 @@ impl NABufferType { pub fn get_vbuf(&mut self) -> Option> { match *self { NABufferType::Video(ref vb) => Some(vb.clone()), + NABufferType::VideoPacked(ref vb) => Some(vb.clone()), + _ => None, + } + } + pub fn get_vbuf16(&mut self) -> Option> { + match *self { + NABufferType::Video16(ref vb) => Some(vb.clone()), + _ => None, + } + } + pub fn get_abuf_u8(&mut self) -> Option> { + match *self { + NABufferType::AudioU8(ref ab) => Some(ab.clone()), + NABufferType::AudioPacked(ref ab) => Some(ab.clone()), + _ => None, + } + } + pub fn get_abuf_i16(&mut self) -> Option> { + match *self { + NABufferType::AudioI16(ref ab) => Some(ab.clone()), + _ => None, + } + } + pub fn get_abuf_i32(&mut self) -> Option> { + match *self { + NABufferType::AudioI32(ref ab) => Some(ab.clone()), + _ => None, + } + } + pub fn get_abuf_f32(&mut self) -> Option> { + match *self { + NABufferType::AudioF32(ref ab) => Some(ab.clone()), _ => None, } }