From: Kostya Shishkov Date: Sat, 11 Jul 2020 13:34:09 +0000 (+0200) Subject: parse requested formaton and soniton X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=e176bfee85e6cea16fccc182f56493174f3d0f8a;p=nihav-encoder.git parse requested formaton and soniton --- diff --git a/src/main.rs b/src/main.rs index b06f7b6..8d5efd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 {