From: Kostya Shishkov Date: Mon, 27 Apr 2020 13:54:03 +0000 (+0200) Subject: clearvdeo: support MOV variant of extradata as well X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=4c6a05ff74cba9a3e84c8628f9f0189ce2ffae30;p=nihav.git clearvdeo: support MOV variant of extradata as well --- diff --git a/nihav-commonfmt/src/codecs/clearvideo.rs b/nihav-commonfmt/src/codecs/clearvideo.rs index 3802de8..4236ae0 100644 --- a/nihav-commonfmt/src/codecs/clearvideo.rs +++ b/nihav-commonfmt/src/codecs/clearvideo.rs @@ -624,7 +624,6 @@ impl ClearVideoDecoder { impl NADecoder for ClearVideoDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { - if info.get_extradata().is_none() { return Err(DecoderError::InvalidData); } if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { let w = vinfo.get_width(); let h = vinfo.get_height(); @@ -633,9 +632,11 @@ impl NADecoder for ClearVideoDecoder { let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, f, fmt)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.frmmgr.clear(); - let edata = info.get_extradata().unwrap(); + let edata = info.get_extradata().unwrap_or(std::sync::Arc::new(vec![])); //todo detect simply by extradata contents? - if !self.is_rm { + if edata.len() == 0 || edata.len() < 0x60 { // no or short extradata probably comes from MOV + self.tsize = 4; + } else if !self.is_rm { let mut mr = MemoryReader::new_read(edata.as_slice()); let mut br = ByteReader::new(&mut mr); br.read_skip(0x5E).unwrap();