From e9aa1a76a93164b2997251d0c28bd98ebd4e8f66 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 16 Jun 2023 18:07:39 +0200 Subject: [PATCH] rawvideoenc: suggest YUV during format negotiation --- nihav-commonfmt/src/codecs/rawvideoenc.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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), } } -- 2.30.2