- if let Some(ref mut dec) = decs[idx] {
- let frm = dec.decode(&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); },
- _ => {},
- };
- }
+ if dump_frames {
+ let name = format!("out{:02}_{:08}.frm", streamno, pkt.get_pts().unwrap_or(frmnum));
+ let mut ofile = File::create(name).unwrap();
+ ofile.write(pkt.get_buffer().as_slice()).unwrap();
+ frmnum += 1;
+ }
+ if let Some((ref mut dsupp, ref mut dec)) = decs[idx] {
+ 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);
+ if !ignore_errors {
+ break;
+ }
+ },
+ };
+ if pkt.get_pts() != None && lastpts.is_some() && pkt.get_pts() >= lastpts { break; }