]>
Commit | Line | Data |
---|---|---|
1 | #[cfg(feature="decoder_indeo2")] | |
2 | pub mod indeo2; | |
3 | ||
4 | use std::rc::Rc; | |
5 | use frame::*; | |
6 | use demuxers::*; | |
7 | use io::byteio::ByteIOError; | |
8 | use io::bitreader::BitReaderError; | |
9 | use io::codebook::CodebookError; | |
10 | ||
11 | #[derive(Debug,Clone,Copy,PartialEq)] | |
12 | #[allow(dead_code)] | |
13 | pub enum DecoderError { | |
14 | InvalidData, | |
15 | ShortData, | |
16 | MissingReference, | |
17 | NotImplemented, | |
18 | Bug, | |
19 | } | |
20 | ||
21 | type DecoderResult<T> = Result<T, DecoderError>; | |
22 | ||
23 | impl From<ByteIOError> for DecoderError { | |
24 | fn from(_: ByteIOError) -> Self { DecoderError::ShortData } | |
25 | } | |
26 | ||
27 | impl From<BitReaderError> for DecoderError { | |
28 | fn from(e: BitReaderError) -> Self { | |
29 | match e { | |
30 | BitReaderError::BitstreamEnd => DecoderError::ShortData, | |
31 | _ => DecoderError::InvalidData, | |
32 | } | |
33 | } | |
34 | } | |
35 | ||
36 | impl From<CodebookError> for DecoderError { | |
37 | fn from(_: CodebookError) -> Self { DecoderError::InvalidData } | |
38 | } | |
39 | ||
40 | pub trait NADecoder { | |
41 | fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()>; | |
42 | fn decode(&mut self, pkt: &NAPacket) -> DecoderResult<Rc<NAFrame>>; | |
43 | } | |
44 |