X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=videoplayer%2Fsrc%2Fvideodec.rs;h=295cfc753ee64002f9288eacf7f54f256d6fbbba;hb=6efb6f30892427a02282e39cc4d21a23d5c8add5;hp=d385e68a591a6bd5983a3f4e1a88cb4ff20ac56e;hpb=bbd6955561e875bf89815e09e2191ca9a98fde8f;p=nihav-player.git diff --git a/videoplayer/src/videodec.rs b/videoplayer/src/videodec.rs index d385e68..295cfc7 100644 --- a/videoplayer/src/videodec.rs +++ b/videoplayer/src/videodec.rs @@ -137,6 +137,16 @@ impl VideoDecoder { return self.convert_buf(bt, ts); } }, + #[cfg(feature="hwaccel")] + DecoderType::VideoHW(ref mut vdec) => { + let _ = vdec.queue_pkt(pkt); + while let Some(frm) = vdec.get_frame() { + let bt = frm.get_buffer(); + if let NABufferType::None = bt { continue; } + let ts = frm.get_dts().unwrap_or_else(|| frm.get_pts().unwrap_or(0)); + return self.convert_buf(bt, ts); + } + }, _ => panic!("not a video decoder!"), }; None @@ -188,6 +198,15 @@ impl VideoDecoder { return self.convert_buf(bt, ts); } }, + #[cfg(feature="hwaccel")] + DecoderType::VideoHW(ref mut vdec) => { + while let Some(frm) = vdec.get_frame() { + let bt = frm.get_buffer(); + if let NABufferType::None = bt { continue; } + let ts = frm.get_dts().unwrap_or_else(|| frm.get_pts().unwrap_or(0)); + return self.convert_buf(bt, ts); + } + }, _ => {}, }; None @@ -210,6 +229,15 @@ impl VideoDecoder { return self.convert_buf(bt, ts); } }, + #[cfg(feature="hwaccel")] + DecoderType::VideoHW(ref mut dec) => { + while let Some(frm) = dec.get_last_frames() { + let bt = frm.get_buffer(); + if let NABufferType::None = bt { continue; } + let ts = frm.get_dts().unwrap_or_else(|| frm.get_pts().unwrap_or(0)); + return self.convert_buf(bt, ts); + } + }, _ => {}, }; None @@ -224,6 +252,10 @@ impl VideoDecoder { dec.flush(); reord.flush(); }, + #[cfg(feature="hwaccel")] + DecoderType::VideoHW(ref mut dec) => { + dec.flush(); + }, _ => {}, }; } @@ -274,6 +306,7 @@ fn start_video_decoding(width: usize, height: usize, tb_num: u32, tb_den: u32, v Ok(PktSendEvent::HurryUp) => { skip_mode = skip_mode.advance(); if let DecoderType::Video(ref mut dec, ref mut _reord) = vdec.dec.dec { + println!("setting hurry up mode to {}", skip_mode.to_string()); dec.set_options(&[NAOption{ name: FRAME_SKIP_OPTION, value: NAValue::String(skip_mode.to_string()),