From: Kostya Shishkov Date: Fri, 16 Jun 2023 16:07:39 +0000 (+0200) Subject: rawvideoenc: suggest YUV during format negotiation X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=e9aa1a76a93164b2997251d0c28bd98ebd4e8f66;p=nihav.git rawvideoenc: suggest YUV during format negotiation --- diff --git a/nihav-commonfmt/src/codecs/rawvideoenc.rs b/nihav-commonfmt/src/codecs/rawvideoenc.rs index 8847520..c7285e6 100644 --- a/nihav-commonfmt/src/codecs/rawvideoenc.rs +++ b/nihav-commonfmt/src/codecs/rawvideoenc.rs @@ -23,7 +23,15 @@ impl NAEncoder for RawEncoder { ..Default::default() }) }, - NACodecTypeInfo::Video(_) => Ok(*encinfo), + NACodecTypeInfo::Video(_) => { + let mut new_info = *encinfo; + if let NACodecTypeInfo::Video(ref mut vinfo) = new_info.format { + if !vinfo.format.model.is_yuv() { + vinfo.format = YUV420_FORMAT; + } + } + Ok(new_info) + }, NACodecTypeInfo::Audio(_) => Err(EncoderError::FormatError), } }