}
impl NADecoder for TMRTDecoder {
- fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
+ fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Video(vinfo) = info.get_properties() {
let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, YUV410_FORMAT));
self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref();
Err(DecoderError::InvalidData)
}
}
- fn decode(&mut self, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
+ fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
let src = pkt.get_buffer();
validate!(src.len() > 10);
let hdr_size = (src[0].rotate_left(3) & 0x7F) as usize;
let height = (hdr[5] as usize) | ((hdr[6] as usize) << 8);
let myinfo = NAVideoInfo::new(width, height, false, YUV410_FORMAT);
- let bufret = alloc_video_buffer(myinfo, 2);
- if let Err(_) = bufret { return Err(DecoderError::InvalidData); }
- let bufinfo = bufret.unwrap();
+ let bufinfo = alloc_video_buffer(myinfo, 2)?;
let mut buf = bufinfo.get_vbuf().unwrap();
let mut br = BitReader::new(&src[hdr_size..], src.len() - hdr_size, BitReaderMode::LE);
}
}
-pub fn get_decoder() -> Box<NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder> {
Box::new(TMRTDecoder::new())
}