diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-05-26 16:22:42 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-05-26 16:22:42 +0200 |
commit | b4a0ee1dd70e9b69fddef9cdb22083f96a29914a (patch) | |
tree | c9e821a6b7cd886619f0ffc455ccbb6085eb2295 /src/main.rs | |
parent | 17d1bf82a978619921c691a1ee951ba262c27730 (diff) | |
download | nihav-tool-b4a0ee1dd70e9b69fddef9cdb22083f96a29914a.tar.gz |
use PNM writer from nihav-codec-support
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index 59c1878..0892c43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ extern crate nihav_core; +extern crate nihav_codec_support; extern crate nihav_registry; extern crate nihav_allstuff; @@ -9,13 +10,11 @@ use nihav_core::io::byteio::{FileReader, ByteReader}; use nihav_core::frame::*; use nihav_core::codecs::*; use nihav_core::demuxers::*; +use nihav_codec_support::imgwrite::*; use nihav_registry::detect; use nihav_allstuff::*; use std::env; -mod frmwriter; -use crate::frmwriter::*; - mod wavwriter; use crate::wavwriter::WavWriter; @@ -41,15 +40,8 @@ impl FrameOutput { NumberMode::PktPTS => { pkt.get_pts().unwrap() }, NumberMode::FrmPTS => { if let Some(pt) = frm.get_pts() { pt } else { pkt.get_pts().unwrap() } }, }; - let vinfo = frm.get_buffer().get_video_info().unwrap(); - if vinfo.get_format().is_paletted() { - write_palppm(&self.prefix, self.streamno, pts, frm); - } else if vinfo.get_format().get_model().is_yuv() { - write_pgmyuv(&self.prefix, self.streamno, pts, frm); - } else if vinfo.get_format().get_model().is_rgb() { - write_ppm(&self.prefix, self.streamno, pts, frm); - } else { -panic!(" unknown format"); + if let Err(_) = write_pnm(&self.prefix, self.streamno, pts, frm) { + println!("error writing output picture"); } } self.frameno += 1; |