X-Git-Url: https://git.nihav.org/?p=nihav-tool.git;a=blobdiff_plain;f=src%2Fmain.rs;h=bb6a7bc1c6fde740f353f0b5b10ef7fe9b3def87;hp=784fccb8382db37051eb71d7b069b19ca6f40169;hb=a319c93c35587d7c2fd7a90fbd3c9e2c66f15f4e;hpb=fde9f7c350f401dec51e6a08c4aa8134744b4b68 diff --git a/src/main.rs b/src/main.rs index 784fccb..bb6a7bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ extern crate nihav_core; +extern crate nihav_registry; extern crate nihav_allstuff; use std::io::SeekFrom; @@ -8,7 +9,7 @@ use nihav_core::io::byteio::{FileReader, ByteReader}; use nihav_core::frame::*; use nihav_core::codecs::*; use nihav_core::demuxers::*; -use nihav_core::detect; +use nihav_registry::detect; use nihav_allstuff::*; use std::env; @@ -218,16 +219,26 @@ panic!("decoder {} not found", info.get_name()); let sr = sids.iter().position(|x| *x == streamno); let idx = sr.unwrap(); if let Some((ref mut dsupp, ref mut dec)) = decs[idx] { - let frm = dec.decode(dsupp, &pkt).unwrap(); - if !noout { - match writers[idx] { - Outputter::Video(ref mut wr) => { wr.output_frame(&pkt, frm); }, - Outputter::Audio(ref mut wr) => { wr.output_frame(&pkt, frm); }, - _ => {}, - }; - } + match dec.decode(dsupp, &pkt) { + Ok(frm) => { + if !noout { + match writers[idx] { + Outputter::Video(ref mut wr) => { wr.output_frame(&pkt, frm); }, + Outputter::Audio(ref mut wr) => { wr.output_frame(&pkt, frm); }, + _ => {}, + }; + } + }, + Err(DecoderError::MissingReference) if seek_time > 0 => { + println!("ignoring missing ref"); + }, + Err(reason) => { + println!("error decoding frame {:?}", reason); + break; + }, + }; + if pkt.get_pts() != None && lastpts.is_some() && pkt.get_pts() >= lastpts { break; } } - if pkt.get_pts() != None && lastpts.is_some() && pkt.get_pts() >= lastpts { break; } } //panic!("end"); }