+ #[cfg(feature="hwaccel")]
+ if info.get_name() == "h264" && self.use_hwaccel {
+ let mut dec = new_h264_hwdec();
+ let dsupp = Box::new(NADecoderSupport::new());
+ let props = info.get_properties().get_video_info().unwrap();
+ if props.get_width() != 0 {
+ width = props.get_width();
+ height = props.get_height();
+ }
+ if dec.init(info.clone()).is_err() {
+ println!("failed to initialise hwaccel video decoder");
+ } else {
+ video_dec = Some(DecoderStuff{ dsupp, dec: DecoderType::VideoHW(dec) });
+ self.video_str = str_id;
+ let (tbn, tbd) = s.get_timebase();
+ tb_num = tbn;
+ tb_den = tbd;
+ self.has_video = true;
+ println!(" using hardware-accelerated decoding");
+ continue;
+ }
+ }
+ if let Some(decfunc) = decfunc_mt {
+ let mut dec = (decfunc)();
+ let mut dsupp = Box::new(NADecoderSupport::new());
+ let props = info.get_properties().get_video_info().unwrap();
+ if props.get_width() != 0 {
+ width = props.get_width();
+ height = props.get_height();
+ }
+ if dec.init(&mut dsupp, info.clone(), self.vthreads).is_ok() {
+ video_dec = Some(DecoderStuff{ dsupp, dec: DecoderType::VideoMT(dec, MTFrameReorderer::new()) });
+ self.video_str = str_id;
+ let (tbn, tbd) = s.get_timebase();
+ tb_num = tbn;
+ tb_den = tbd;
+ self.has_video = true;
+ continue;
+ } else {
+ println!("failed to create multi-threaded decoder, falling back");
+ }
+ }