codec/packet: refactoring to allow zero-copy packet creation

This commit is contained in:
meh
2015-10-08 17:54:09 +02:00
parent 7e2ebcf36b
commit 306b9c6698
9 changed files with 375 additions and 295 deletions

View File

@ -4,14 +4,14 @@ use libc::c_int;
use ffi::*;
use super::Opened;
use ::{Packet, Error, AudioService, ChannelLayout};
use ::{packet, Error, AudioService, ChannelLayout};
use ::frame;
use ::util::format;
pub struct Audio(pub Opened);
impl Audio {
pub fn decode(&mut self, packet: &Packet, out: &mut frame::Audio) -> Result<bool, Error> {
pub fn decode<P: packet::Ref>(&mut self, packet: &P, out: &mut frame::Audio) -> Result<bool, Error> {
unsafe {
let mut got: c_int = 0;