From: Kostya Shishkov Date: Thu, 2 May 2019 11:32:32 +0000 (+0200) Subject: use NADecoderSupport X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=4b6a29cef820d5345b27f8c4b7bd22a4d7fca371;p=nihav-tool.git use NADecoderSupport --- diff --git a/src/main.rs b/src/main.rs index e191e7a..9f9d497 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,7 +132,7 @@ println!("trying demuxer {} on {}", dmx_name, name); br.seek(SeekFrom::Start(0)).unwrap(); let mut dmx = create_demuxer(dmx_fact, &mut br).unwrap(); - let mut decs: Vec>> = Vec::new(); + let mut decs: Vec, Box)>> = Vec::new(); let mut sids: Vec = Vec::new(); let mut writers: Vec = Vec::new(); for i in 0..dmx.get_num_streams() { @@ -150,8 +150,9 @@ println!("stream {} - {} {}", i, s, info.get_name()); return; } let mut dec = (decfunc.unwrap())(); - dec.init(info).unwrap(); - decs.push(Some(dec)); + let mut dsupp = Box::new(NADecoderSupport::new()); + dec.init(&mut dsupp, info).unwrap(); + decs.push(Some((dsupp, dec))); if !noout { writers.push(Outputter::Video(FrameOutput{prefix: "", streamno: i, frameno: 1, nmode: nmode})); has_out = true; @@ -166,8 +167,9 @@ println!("stream {} - {} {}", i, s, info.get_name()); return; } let mut dec = (decfunc.unwrap())(); - dec.init(info).unwrap(); - decs.push(Some(dec)); + let mut dsupp = Box::new(NADecoderSupport::new()); + dec.init(&mut dsupp, info).unwrap(); + decs.push(Some((dsupp, dec))); if !noout { let name = format!("out{:02}.wav", i); writers.push(Outputter::Audio(AudioOutput::new(&name))); @@ -194,8 +196,8 @@ panic!("decoder {} not found", info.get_name()); let streamno = pkt.get_stream().get_id(); let sr = sids.iter().position(|x| *x == streamno); let idx = sr.unwrap(); - if let Some(ref mut dec) = decs[idx] { - let frm = dec.decode(&pkt).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); },