use new NAFrameRef
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 29 Apr 2019 11:37:36 +0000 (13:37 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 29 Apr 2019 11:38:25 +0000 (13:38 +0200)
src/frmwriter.rs
src/main.rs

index c743fc0132fbf5f6fae2bc44898c16dd73ec0ed1..a9c0612d81e0c438f862817a175ebb42988537de 100644 (file)
@@ -3,9 +3,8 @@ extern crate nihav_core;
 use nihav_core::frame::*;
 use std::io::prelude::*;
 use std::fs::File;
 use nihav_core::frame::*;
 use std::io::prelude::*;
 use std::fs::File;
-use std::cell::Ref;
 
 
-pub fn write_pgmyuv(pfx: &str, strno: usize, num: u64, frm: Ref<NAFrame>) {
+pub fn write_pgmyuv(pfx: &str, strno: usize, num: u64, frm: NAFrameRef) {
     if let NABufferType::None = frm.get_buffer() { return; }
     let name = format!("{}out{:02}_{:08}.pgm", pfx, strno, num);
     let mut ofile = File::create(name).unwrap();
     if let NABufferType::None = frm.get_buffer() { return; }
     let name = format!("{}out{:02}_{:08}.pgm", pfx, strno, num);
     let mut ofile = File::create(name).unwrap();
@@ -64,7 +63,7 @@ pub fn write_pgmyuv(pfx: &str, strno: usize, num: u64, frm: Ref<NAFrame>) {
     }
 }
 
     }
 }
 
-pub fn write_palppm(pfx: &str, strno: usize, num: u64, frm: Ref<NAFrame>) {
+pub fn write_palppm(pfx: &str, strno: usize, num: u64, frm: NAFrameRef) {
     let name = format!("{}out{:02}_{:08}.ppm", pfx, strno, num);
     let mut ofile = File::create(name).unwrap();
     let buf = frm.get_buffer().get_vbuf().unwrap();
     let name = format!("{}out{:02}_{:08}.ppm", pfx, strno, num);
     let mut ofile = File::create(name).unwrap();
     let buf = frm.get_buffer().get_vbuf().unwrap();
@@ -95,7 +94,7 @@ pub fn write_palppm(pfx: &str, strno: usize, num: u64, frm: Ref<NAFrame>) {
     }
 }
 
     }
 }
 
-pub fn write_ppm(pfx: &str, strno: usize, num: u64, frm: Ref<NAFrame>) {
+pub fn write_ppm(pfx: &str, strno: usize, num: u64, frm: NAFrameRef) {
     let name = format!("{}out{:02}_{:08}.ppm", pfx, strno, num);
     let mut ofile = File::create(name).unwrap();
     if let NABufferType::VideoPacked(ref buf) = frm.get_buffer() {
     let name = format!("{}out{:02}_{:08}.ppm", pfx, strno, num);
     let mut ofile = File::create(name).unwrap();
     if let NABufferType::VideoPacked(ref buf) = frm.get_buffer() {
index d30dd871d8aceadbe6dd08a3eb03d3756b8251d5..e191e7a4087dc11e246bb4ecec0ec60a5f7e9592 100644 (file)
@@ -33,8 +33,7 @@ struct FrameOutput {
 }
 
 impl FrameOutput {
 }
 
 impl FrameOutput {
-    fn output_frame(&mut self, pkt: &NAPacket, frmref: NAFrameRef) {
-        let frm = frmref.borrow();
+    fn output_frame(&mut self, pkt: &NAPacket, frm: NAFrameRef) {
         if frm.get_frame_type() != FrameType::Skip {
             let pts = match self.nmode {
                     NumberMode::Counter => { self.frameno },
         if frm.get_frame_type() != FrameType::Skip {
             let pts = match self.nmode {
                     NumberMode::Counter => { self.frameno },
@@ -65,10 +64,10 @@ impl AudioOutput {
     fn new(name: &String) -> Self { Self { wwr: WavWriter::new(name), wrote_header: false } }
     fn output_frame(&mut self, _pkt: &NAPacket, frm: NAFrameRef) {
         if !self.wrote_header {
     fn new(name: &String) -> Self { Self { wwr: WavWriter::new(name), wrote_header: false } }
     fn output_frame(&mut self, _pkt: &NAPacket, frm: NAFrameRef) {
         if !self.wrote_header {
-            self.wwr.write_header(frm.borrow().get_info().as_ref().get_properties().get_audio_info().unwrap()).unwrap();
+            self.wwr.write_header(frm.get_info().as_ref().get_properties().get_audio_info().unwrap()).unwrap();
             self.wrote_header = true;
         }
             self.wrote_header = true;
         }
-        self.wwr.write_frame(frm.borrow().get_buffer()).unwrap();
+        self.wwr.write_frame(frm.get_buffer()).unwrap();
     }
 }
 
     }
 }