br.seek(SeekFrom::Start(0)).unwrap();
let mut dmx = create_demuxer(dmx_fact, &mut br).unwrap();
- let mut decs: Vec<Option<Box<NADecoder>>> = Vec::new();
+ let mut decs: Vec<Option<(Box<NADecoderSupport>, Box<NADecoder>)>> = Vec::new();
let mut sids: Vec<u32> = Vec::new();
let mut writers: Vec<Outputter> = Vec::new();
for i in 0..dmx.get_num_streams() {
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;
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)));
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); },