codec: improve decoder state transitions

This commit improves the state transitions for the `codec::*` structs as
discussed in #7.
This commit is contained in:
lummax
2015-08-25 15:20:58 +02:00
committed by meh
parent 8ed092c0c3
commit ee6004d05e
8 changed files with 185 additions and 186 deletions

View File

@ -3,12 +3,12 @@ use std::ops::{Deref, DerefMut};
use libc::c_int;
use ffi::*;
use super::Decoder;
use super::Opened;
use ::{Packet, Error, AudioService, ChannelLayout};
use ::frame;
use ::util::format;
pub struct Audio(pub Decoder);
pub struct Audio(pub Opened);
impl Audio {
pub fn decode(&mut self, packet: &Packet, out: &mut frame::Audio) -> Result<bool, Error> {
@ -99,7 +99,7 @@ impl Audio {
}
impl Deref for Audio {
type Target = Decoder;
type Target = Opened;
fn deref(&self) -> &<Self as Deref>::Target {
&self.0