X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=src%2Fmain.rs;h=8d5efd377fd67aa680101adeacd4e6ea267caafe;hb=e176bfee85e6cea16fccc182f56493174f3d0f8a;hp=0d5082d78162452bf0b74b10c1b501eba76dc574;hpb=7b6dcb1ec809818b7f76fd1d0db7e3df7d85ce48;p=nihav-encoder.git diff --git a/src/main.rs b/src/main.rs index 0d5082d..8d5efd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,7 +121,7 @@ impl Transcoder { self.istr_opts.len() - 1 }; let istr = &mut self.istr_opts[sidx]; - + for opt in opt1.split(',') { let oval: Vec<_> = opt.split('=').collect(); if oval.len() == 1 { @@ -152,7 +152,7 @@ impl Transcoder { self.ostr_opts.len() - 1 }; let ostr = &mut self.ostr_opts[sidx]; - + for opt in opt1.split(',') { let oval: Vec<_> = opt.split('=').collect(); if oval.len() == 1 { @@ -222,7 +222,21 @@ impl Transcoder { println!("video option for audio stream"); } }, -//todo formaton + "pixfmt" => { + if ostr.enc_params.format == NACodecTypeInfo::None { + ostr.enc_params.format = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, false, YUV420_FORMAT)); + } + if let NACodecTypeInfo::Video(ref mut vinfo) = ostr.enc_params.format { + let ret = oval[1].parse::(); + if let Ok(val) = ret { + vinfo.format = val; + } else { + println!("invalid pixel format"); + } + } else { + println!("video option for audio stream"); + } + }, "srate" => { if ostr.enc_params.format == NACodecTypeInfo::None { ostr.enc_params.format = NACodecTypeInfo::Audio(NAAudioInfo::new(0, 0, SND_S16_FORMAT, 0)); @@ -268,7 +282,37 @@ impl Transcoder { println!("audio option for video stream"); } }, -//todo soniton, channel map + "sfmt" => { + if ostr.enc_params.format == NACodecTypeInfo::None { + ostr.enc_params.format = NACodecTypeInfo::Audio(NAAudioInfo::new(0, 0, SND_S16_FORMAT, 0)); + } + if let NACodecTypeInfo::Audio(ref mut ainfo) = ostr.enc_params.format { + let ret = oval[1].parse::(); + if let Ok(val) = ret { + ainfo.format = val; + } else { + println!("invalid audio format"); + } + } else { + println!("audio option for video stream"); + } + }, +// todo channel map negotiation + /*"chmap" => { + if ostr.enc_params.format == NACodecTypeInfo::None { + ostr.enc_params.format = NACodecTypeInfo::Audio(NAAudioInfo::new(0, 0, SND_S16_FORMAT, 0)); + } + if let NACodecTypeInfo::Audio(ref mut ainfo) = ostr.enc_params.format { + let ret = oval[1].parse::(); + if let Ok(val) = ret { + ainfo.chmap = val; + } else { + println!("invalid channel map"); + } + } else { + println!("audio option for video stream"); + } + },*/ "bitrate" => { let ret = oval[1].parse::(); if let Ok(val) = ret {