]> git.nihav.org Git - nihav-player.git/blobdiff - videoplayer/src/videodec.rs
use NAPacketiser::attach_stream() where appropriate
[nihav-player.git] / videoplayer / src / videodec.rs
index d385e68a591a6bd5983a3f4e1a88cb4ff20ac56e..295cfc753ee64002f9288eacf7f54f256d6fbbba 100644 (file)
@@ -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()),